在 JFreeChart 中更改温度计中的水银颜色
我已经使用 JFreeChart 创建了温度计图表,但我想更改温度计中的水银颜色。我该怎么做?这是到目前为止我的代码;请解释在哪里更改此代码:
final DefaultValueDataset dataset = new DefaultValueDataset(new Double(10));
// create the chart...
final ThermometerPlot plot = new ThermometerPlot(dataset);
final JFreeChart chart = new JFreeChart("Thermometer Demo 2", // chart title
JFreeChart.DEFAULT_TITLE_FONT,
plot, // plot
false); // include legend
chart.setBackgroundPaint(new Color(241,250,224));
plot.setMercuryPaint();
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setUpperBound(50);
I have created a thermometer chart with JFreeChart, but I want to change the mercury color in thermometer. How can I do this? Here is my code so far; please explain where to change this code:
final DefaultValueDataset dataset = new DefaultValueDataset(new Double(10));
// create the chart...
final ThermometerPlot plot = new ThermometerPlot(dataset);
final JFreeChart chart = new JFreeChart("Thermometer Demo 2", // chart title
JFreeChart.DEFAULT_TITLE_FONT,
plot, // plot
false); // include legend
chart.setBackgroundPaint(new Color(241,250,224));
plot.setMercuryPaint();
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setUpperBound(50);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能正在寻找
setSubrangePaint()
,如下所示。You may be looking for
setSubrangePaint()
, demonstrated below.