Shift the origin from (0,0) to (0,50) in JFreeChart

前端 未结 1 913
孤街浪徒
孤街浪徒 2021-01-22 17:57

As shown in image the graph is from line y=0, here i want to plot a graph from y=50, how can i specify this in JFreeChart?

1条回答
  •  [愿得一人]
    2021-01-22 18:20

    You can specify the bottom value of the Y axis with the setLowerBound() method of the ValueAxis class.

    Using your example:

    JFreeChart chart;
    chart = ChartFactory.createXYAreaChart("Profile View Of Contour", "Distance", "Contour Value", xyDataset, PlotOrientation.VERTICAL, true, true, false);
    
    ValueAxis rangeAxis = chart.getXYPlot().getRangeAxis();
    rangeAxis.setLowerBound(50.0f);
    

    0 讨论(0)
提交回复
热议问题