JFreeChart: One Axis Distribution Chart -


i'm using jfreechart , i'd have chart 1 dimension only: x-axis (that indicates milliseconds) , shapes (that rapresents events).

i created xylinechart , xyplot hidden y-axis :

 this.chart = chartfactory.createxylinechart(      "","","",dataset,plotorientation.vertical, false, true,false);   xyplot plot = (xyplot) chart.getplot();   plot.setbackgroundpaint( color.lightgray );  plot.setdomaingridlinepaint( color.white );  plot.setrangegridlinepaint( color.white );  plot.setrangegridlinesvisible(false);  plot.setdomaincrosshairvisible( true );  plot.setrangecrosshairvisible( false );    numberaxis range = (numberaxis) plot.getrangeaxis();  range.setvisible(false);  range.setrange(0.0, 1.0);  range.settickunit(new numbertickunit(0.5)); 

in dataset used fixed y-coordinate.

i obtained result:

image 1 http://imageshack.us/a/img46/4935/pointsuw.jpg

but i'd have this:

image 2 http://img521.imageshack.us/img521/3721/points2.jpg

if resize panel, entire chart resized (title, numbers, shapes). i'd resize "grey area" only.

obviously it's better if , appropriate chart type exist.

thanks lot.

the entire chart resized in case width / height below configurable threshold.

i have modified example adding code chartpanel , using 2 methods chartpanel.setminimumdrawwidth(int) , chartpanel.setminimumdrawwidth(int) set these thresholds.

this.chart = chartfactory.createxylinechart(  "","","",dataset,plotorientation.vertical, false, true,false);  xyplot plot = (xyplot) chart.getplot();  plot.setbackgroundpaint( color.lightgray ); plot.setdomaingridlinepaint( color.white ); plot.setrangegridlinepaint( color.white ); plot.setrangegridlinesvisible(false); plot.setdomaincrosshairvisible( true ); plot.setrangecrosshairvisible( false );   numberaxis range = (numberaxis) plot.getrangeaxis(); range.setvisible(false); range.setrange(0.0, 1.0); range.settickunit(new numbertickunit(0.5));  chartpanel chartpanel = new chartpanel(this.chart); chart.setminimumdrawheight(10); chart.setminimumdrawwidth(10); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -