• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting Initial Value In JFreeChart  RSS feed

 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42970
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42970
73
  • Mark post as helpful
  • send pies
  • 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?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!