是否有可能在标签中显示 stcaked bar 总量。
我正在添加一个示例,它为每个系列添加一个标签
stackedxybarrenderer.setSeriesItemLabelGenerator(index, new MyItemLabelGenerator());
不太行。它在系列中绘制标签(在小方块内)。有什么建议么?
我正在使用这个(来自 omnline 示例)
private JFreeChart createChart(TableXYDataset tablexydataset) {
DateAxis dateaxis = new DateAxis("Date");
dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
NumberAxis numberaxis = new NumberAxis("Y");
StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.10000000000000001D);
stackedxybarrenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
stackedxybarrenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
stackedxybarrenderer.setBaseItemLabelsVisible(true);
stackedxybarrenderer.setDrawBarOutline(false);
XYPlot xyplot = new XYPlot(tablexydataset, dateaxis, numberaxis, stackedxybarrenderer);
JFreeChart jfreechart = new JFreeChart("Stacked XY Bar Chart demo 2", xyplot);
return jfreechart;
}
和
private TableXYDataset createDataset() {
TimeTableXYDataset timetablexydataset = new TimeTableXYDataset();
Day day = new Day(1, 3, 2005);
Day day1 = new Day(2, 3, 2005);
Day day2 = new Day(3, 3, 2005);
Day day3 = new Day(4, 3, 2005);
Day day4 = new Day(5, 3, 2005);
timetablexydataset.add(day, 1.0D, "Series 1");
timetablexydataset.add(day1, 1.7D, "Series 1");
timetablexydataset.add(day2, 2.2999999999999998D, "Series 1");
timetablexydataset.add(day3, 3.7000000000000002D, "Series 1");
timetablexydataset.add(day4, 2.6000000000000001D, "Series 1");
timetablexydataset.add(day, 3.2000000000000002D, "Series 2");
timetablexydataset.add(day1, 1.1000000000000001D, "Series 2");
timetablexydataset.add(day2, 1.3999999999999999D, "Series 2");
timetablexydataset.add(day3, 2.8999999999999999D, "Series 2");
timetablexydataset.add(day4, 0.59999999999999998D, "Series 2");
return timetablexydataset;
}