• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting Initial Value In JFreeChart

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The program is creating time chart using

In the program, take the current sysdate. Now chart should start with one hour back date form current sysdate,
And it must be of ten minutes of interval.
How to achieve this?


Thansk,
Tanzy.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lots of JFreeChart TimeSeries demos can be found at http://www.java2s.com/Code/Java/Chart/Time-Series-Chart.htm
 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ulf for the reply.
Well i used this for the the demonstration.

In this example, what i saw that x axis value is not fixed. Its getting changed as per value of minute given in data.
For example --

1. Use the sample program with nothing changed.
X axis --> 20:02, 20:04,20:06.......

2. commented these four value --


x axis value --> 21:01:00, 21:01:30, 21:02:00,....

And so on.
I am not getting, how to control these value?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way to alter the display of axis values is: JFreeChart.getPlot --> Plot --> cast to XYPlot --> getDomainAxis --> valueAxis --> cast to DateAxis --> setDateFormatOverride(DateFormat). Check the javadocs of those classes for details.
 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ulf.
I added this to above piece of code


Now the formatting is under control. But still the core problem is not fulfilled, i.e. how to start the x-axis value with one hour back time from the current time. For example if current time is 11:30 PM, the xaxis should start with 10:30 PM.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's just a matter of passing the correct data to JFC. Which values *are* you passing to it? What prevents you from passing the correct values?
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic