使系列上的邊緣很簡單,但是關於如何使圖2中顯示的圖形沒有找到任何示例。下面顯示的代碼生成圖1所示的圖形。我想找到一種方法來獲得圖2中顯示的圖形。如何製作Stacked Bar類型圖形的邊緣?
您有些人曾經遇到過這種需求嗎?有沒有簡單的方法來獲得結果?
非常感謝。
private static CategoryDataset createDataset()
{
DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
defaultcategorydataset.addValue(10D, "Series 1", "Jan");
defaultcategorydataset.addValue(12D, "Series 1", "Feb");
defaultcategorydataset.addValue(13D, "Series 1", "Mar");
defaultcategorydataset.addValue(4D, "Series 2", "Jan");
defaultcategorydataset.addValue(3D, "Series 2", "Feb");
defaultcategorydataset.addValue(2D, "Series 2", "Mar");
defaultcategorydataset.addValue(2D, "Series 3", "Jan");
defaultcategorydataset.addValue(3D, "Series 3", "Feb");
defaultcategorydataset.addValue(2D, "Series 3", "Mar");
defaultcategorydataset.addValue(2D, "Series 4", "Jan");
defaultcategorydataset.addValue(3D, "Series 4", "Feb");
defaultcategorydataset.addValue(4D, "Series 4", "Mar");
return defaultcategorydataset;
}
private static JFreeChart createChart(CategoryDataset categorydataset)
{
JFreeChart jfreechart = ChartFactory.createStackedBarChart("Stacked Bar Chart Demo 3", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, false, false);
CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
ExtendedStackedBarRenderer extendedstackedbarrenderer = new ExtendedStackedBarRenderer();
extendedstackedbarrenderer.setBaseItemLabelsVisible(true);
extendedstackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
extendedstackedbarrenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
categoryplot.setRenderer(extendedstackedbarrenderer);
NumberAxis numberaxis = (NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
numberaxis.setLowerMargin(0.14999999999999999D);
numberaxis.setUpperMargin(0.14999999999999999D);
numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());
ChartUtilities.applyCurrentTheme(jfreechart);
return jfreechart;
}
交叉發佈[這裏](http://www.jfree.org/forum/viewtopic.php?f=3&t=115725)。 – trashgod