我想在一行中添加多个数据集。我们如何用Jfree图表做到这一点?这样我的输出在BAR图的单行中带有多个颜色代码
公共课演示 {
public static void main(String arg[]){
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(2, "Amu-referet Form", "Dtest");
dataset.setValue(7, "ApraisalForm", "Richa Dept");
dataset.setValue(4, "Feedback", "Test department");
dataset.setValue(12, "HES report", "Vipul HR dept");
dataset.setValue(6, "Marks", "Chandan");
JFreeChart chart = ChartFactory.createBarChart3D("Any title", "x label", "y label", dataset, PlotOrientation.HORIZONTAL, true, true, true);
ChartFrame frame1=new ChartFrame("Bar Chart",chart);
frame1.setVisible(true);
frame1.setSize(400,350);
}
}
答案 0 :(得分:1)
使用ChartFactory.createStackedBarChart3D()方法解决了我的问题