Variable names are defined at compile time.automate the initialization of the instance variable "series".
You can create new "named" variables by using a Map. The Map's key can be treated as the variable name.
Code:String name = "series"; for(int i=0; i < nbrOfSeries; i++) { name += i; // build new name for this one XYSeries aSeries = new XYSeries("Series " + i); // create the instance aSeries.add(....); // fill with data ... theMap.put(name, aSeries); // Save the reference }




Reply With Quote