To change the X-axis starting value of graph in Jfreechart

后端 未结 2 1752
孤城傲影
孤城傲影 2021-01-18 16:51

I am calculating histogram of red component of the image and stored it in redhisto[]. The index of the array represent the intensity(0 to 255) and the value represent the n

2条回答
  •  悲&欢浪女
    2021-01-18 17:44

    You can change the lower bound of the domain axis and set the series paint as shown below. The default XYBarPainter has a gradient color highlight, so I used a StandardXYBarPainter.

    image

    XYPlot plot = (XYPlot) chart.getPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setLowerBound(0);
    XYBarRenderer r = (XYBarRenderer) plot.getRenderer();
    r.setBarPainter(new StandardXYBarPainter());
    r.setSeriesPaint(0, Color.blue);
    

提交回复
热议问题