I am trying to add seriesnames to my defaultcategorydataset, but can't seem to do it. I don't know how many names I will need, tnough, and the argument that it takes in a string[]. How can I do this? I have this:
DefaultCategoryDataset dataset = new DefaultCategoryDataset(data);
datasetSeriesNames(s);
s is this:
for (int i = 1; i <= 3; i++) {
String stringi = new Integer(i).toString();
dataset.setSeriesName(i,stringi);
}
I am getting this error:
java.lang.IllegalArgumentException: DefaultCategoryDataset.setSeriesName(...): no such series.
at com.jrefinery.data.DefaultCategoryDataset.setSeriesName(Unknown Source)
I can't seem to find any examples of what I want to do in the demos and I am very new to jfreechart so I have no ideas where to look for other help. I hope someone knows how to do this easily. Thanks.
Allyson
Adding series names to dataset
Re: Adding series names to dataset
Oops! A typo just in this example. My code does not have this typo:
datasetSeriesNames(s);
should be:
dataset.setSeriesNames(s);
datasetSeriesNames(s);
should be:
dataset.setSeriesNames(s);
Re: Adding series names to dataset
Gosh, I have no idea where my head is. There is no s. DUH! This is the code:
for (int i = 1; i <= 3; i++) {
String stringi = new Integer(i).toString();
dataset.setSeriesName(i,stringi);
}
That is it. With these errors:
java.lang.IllegalArgumentException: DefaultCategoryDataset.setSeriesName(...): no such series.
at com.jrefinery.data.DefaultCategoryDataset.setSeriesName(Unknown Source)
Ignore the person behind the curtain. She has not had enough coffee today. Sorry about that.
Allyson
for (int i = 1; i <= 3; i++) {
String stringi = new Integer(i).toString();
dataset.setSeriesName(i,stringi);
}
That is it. With these errors:
java.lang.IllegalArgumentException: DefaultCategoryDataset.setSeriesName(...): no such series.
at com.jrefinery.data.DefaultCategoryDataset.setSeriesName(Unknown Source)
Ignore the person behind the curtain. She has not had enough coffee today. Sorry about that.
Allyson
Re: Adding series names to dataset
And once again, I kind of figured out the error. I am using the wrong setSeriesNames. I want to have multiple names and you have to use the String[] and the setStringNames with an "s" for that. But I don't know how many names I will have. So, does that mean I can't use the setSeriesNames since an array has to know how many things it will have? UGH! I am so sorry about all this. I guess I should have looked more closely at the code before I posted it.
Anyway, is there any way to ...
As I was typing this I think I figured out the problem. I DO know how many names there will be. Loser that I am. I wish I could just delete this whole message.
Don't read this. Sorry everyone.
Allyson
Anyway, is there any way to ...
As I was typing this I think I figured out the problem. I DO know how many names there will be. Loser that I am. I wish I could just delete this whole message.
Don't read this. Sorry everyone.
Allyson