[英]How can I create a bar-chart with JFreeChart, that shortens too long bars with a visible hint?
[英]How can I change the colour of specific bars in jFreeChart bar
生成數據集:
final double[][] data = new double[][] {{4.0, 3.0, -2.0, 3.0, 6.0}};
DatasetUtilities.createCategoryDataset("Length", "Day of the Month", data);
創建渲染器時,迭代每個點並定義其自己的顏色:
Paint[] colors = new Paint[data.length];
for (int i = 0; i < colors.length; i++) {
color[i] = data > 18 ? Color.blue : Color.red;
}
final CategoryItemRenderer renderer = new CustomRenderer(colors);
本文可能會有用: 系列中不同的條形圖顏色
希望能幫助到你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.