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) {
        final CategoryDataset dataset = DatasetUtilities.createCategoryDataset(
        		  countries,years, data
6 Years
Discussion Span
Last Post by libathos

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.

Edited by NormR1: n/a


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[].

Edited by Ezzaral: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.