I want to have two or more sets of data in my ScatterPlot. How should I do, is it possible? The following code I use at the moment, because the ScatterPlot require the type XYDataset, but it is only one set of data. I can not find data.add() or something like this.... please help me
/Mike
XYDataset data = createDataset();
JFreeChart chart = ChartFactory.createScatterPlot(
"Scatter-plot diagram", // chart title
"X", // x axis label
"Y", // y axis label
data, // <------------------------data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
Two or more XYDatasets in ScatterPlot
Two or more XYDatasets in ScatterPlot
Writing examination thesis,Master, in computer science.
Re: Two or more XYDatasets in ScatterPlot
I'm new to JFreeChart myself, but you can add and remove data series from an XYSeriesCollection, like this:droop wrote:I want to have two or more sets of data in my ScatterPlot. How should I do, is it possible? The following code I use at the moment, because the ScatterPlot require the type XYDataset, but it is only one set of data. I can not find data.add() or something like this.... please help me
/Mike
XYDataset data = createDataset();
JFreeChart chart = ChartFactory.createScatterPlot(
"Scatter-plot diagram", // chart title
"X", // x axis label
"Y", // y axis label
data, // <------------------------data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
XYSeriesCollection dataSet = new XYSeriesCollection();
dataSet.addSeries(line1);
dataSet.addSeries(line2); ... etc. where the line1 and line2 are XYSeries. Depending upon the type of data you're displaying XYSeriesCollection may not be the right choice, but when you figure out the correct class, it will have an add mehtod.
Was this what you were asking for?
John