简体   繁体   中英

How to show Multiple data series in jfree chart

I want to add multiple datasets in one row. How we can do this with Jfree chart? so that my output comes with multiple color codes in single row of BAR graph

public class Demo {

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);
      }
    }

通过使用ChartFactory.createStackedBarChart3D()方法解决了我的问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM