• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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: 43028
76
  • 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: 43028
76
  • 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: 43028
76
  • 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?
 
Hot dog! An advertiser loves us THIS much:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic