java - JFREECHART line chart : Want X axis to be collection of date ranges -


i new jfreechart. requirement display x axis (time-axis) following (time ranges configurable per user input) line chart suppose 3 variables:

3rdaug-8thaug..10thaug-15thaug.. [ , on ]

currently graph's x axis :

1..2..3..4..5 ..

[unable attach screenshots]

my demo code follows :

private jfreechart createchart(final xydataset dataset) {      // create chart...     final jfreechart chart = chartfactory.createxylinechart(         "line chart demo ",      // chart title         "x",                      // x axis label         "y",                      // y axis label         dataset,                  // data         plotorientation.vertical,         true,                     // include legend         true,                     // tooltips         false                     // urls     );      //  optional customisation of chart...     chart.setbackgroundpaint(color.white);        // reference plot further customisation...     final xyplot plot = chart.getxyplot();     plot.setbackgroundpaint(color.white);     plot.setdomaingridlinepaint(color.white);     plot.setrangegridlinepaint(color.white);      final xylineandshaperenderer renderer = new xylineandshaperenderer();     renderer.setserieslinesvisible(0, true);  //for line visibility     renderer.setseriesshapesvisible(1, false);     plot.setrenderer(renderer);     // change auto tick unit selection integer units only...     final numberaxis rangeaxis = (numberaxis) plot.getrangeaxis();    // final axis range = plot.get      rangeaxis.setstandardtickunits(numberaxis.createintegertickunits());     // optional customisation completed.      return chart;  } 

can point me in right direction here? how required values shown on x axis?

xyplot differ between domain axes , range axes. in case x axis domain axis whereas y axis range axis.

valuexis domainaxis = plot.getdomainaxis(); 

you can set different domain axis:

valueaxis daxis = new ... plot.setdomainaxis(daxis); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -