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

后端 未结 2 1769
孤城傲影
孤城傲影 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:54

        XYPlot plot = (XYPlot) chart.getPlot();  
    
        //To change the lower bound of X-axis
        NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
        xAxis.setLowerBound(0);
    
        //To change the lower bound of Y-axis       
        NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
        yAxis.setLowerBound(0);
    
        // To change the color
        XYItemRenderer renderer = plot.getRenderer();
        renderer.setSeriesPaint(0, Color.green);
    

提交回复
热议问题