I am plotting data where the data starts at values much greater than zero ,but the origin(0,0) point is always included when it plots using autorange(true). The result is the data appears on the right hand side of the plot looking as though it is on top of each other.
Is there a way to autorange the data to only inlclude the data added to the series.
My code is of the form:
chart2 = ChartFactory.createScatterPlot("Models", "Time (ms)", "Number",dataset2, true);
chart2.addTitle(new TextTitle(datasource));
XYPlot Subplot2 = chart2.getXYPlot();
ValueAxis axis= Subplot2.getDomainAxis(); //x axis
axis.setAutoRange(true);
I know the numberaxis has autoRangeIncludesZero but i can't work out how to use it.
Any help or tips would be great
can i get rid of the origin(0,0) if i use autorange
Re: can i get rid of the origin(0,0) if i use autorange
Hi Robert,
You just need to cast the domain axis to a NumberAxis, then set the autoRangeIncludesZero attribute to false:
NumberAxis axis = (NumberAxis) subplot2.getDomainAxis();
axis.setAutoRange(true);
axis.setAutoRangeIncludesZero(false);
Regards,
DG
You just need to cast the domain axis to a NumberAxis, then set the autoRangeIncludesZero attribute to false:
NumberAxis axis = (NumberAxis) subplot2.getDomainAxis();
axis.setAutoRange(true);
axis.setAutoRangeIncludesZero(false);
Regards,
DG