I am using a JFreeChart from this link http://www.java2s.com/Code/Java/Chart/JFreeChartCategoryStepChartDemo.htm the format of the datasetUtilities.createCategoryDataset is (new String[]{..,..,},new String[]{..,..,},data).Is there any way that i can pass an already filled arrays for countries and years?

public Chart(String tablenm,final double[][] data,String[] countries,String[] years) {
        super();
       
     
        final CategoryDataset dataset = DatasetUtilities.createCategoryDataset(
        		  countries,years, data
        );

Recommended Answers

All 3 Replies

Is this a java syntax problem or does it have to do with the way the package you are using works?

You can create an array anywhere in your code and then pass a reference to that array to a method as its argument. You do not need to create the array in the method call.

Yes, as Norm said, you do not need to create those arrays in the method call. I merely did that as a quick example in your other thread. That signature is actually

createCategoryDataset(java.lang.Comparable[] rowKeys, java.lang.Comparable[] columnKeys, double[][] data)

The arrays do not even necessarily have to be String[].

ok it worked...thx a lot guys :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.