是否有可能在標籤中顯示酒吧總額。
我加入其中,它增加了一個標籤,每個系列jfreechart - 將標籤總數添加到堆疊酒吧
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;
}
沒有。沒有做一件事。謝謝。 – Jeb 2012-07-24 08:51:33
你可能會顯示代碼並解釋什麼是不正確的? – Dirk 2012-07-24 08:54:33
是的。剛剛添加。 – Jeb 2012-07-24 08:57:48