Prevent JFreeChart DialPlot wrapping around with large values?

I would be interested to hear if there are better methods.

The disparity between the DialValueIndicator and the maximumValue may be confusing. As an alternative, signify distinct ranges using StandardDialRange:

int redLine = 3 * maximumValue / 5;
plot.addLayer(new StandardDialRange(minimumValue, redLine, Color.blue));
plot.addLayer(new StandardDialRange(redLine, maximumValue, Color.red));

Setting the frame’s preferred size is problematic. Instead, override the getPreferredSize() method of ChartPanel:

return new ChartPanel(new JFreeChart(plot)) {
    @Override
    public Dimension getPreferredSize() {
        return new Dimension(300, 300);
    }
};

test image

Leave a Comment