25package umontreal.ssj.charts;
27import org.jfree.data.xy.XYSeries;
28import org.jfree.data.xy.XYSeriesCollection;
29import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
40 private void initYListSeries(
double h,
double[] data,
int numPoints) {
41 renderer =
new XYLineAndShapeRenderer(
true,
false);
42 seriesCollection =
new XYSeriesCollection();
44 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
45 XYSeries serie =
new XYSeries(
" ");
46 for (
int j = 0; j < numPoints; j++)
47 serie.add(h * (j + 1), data[j]);
48 tempSeriesCollection.addSeries(serie);
51 renderer.setSeriesPaint(0, getDefaultColor(0));
54 plotStyle =
new String[1];
55 marksType =
new String[1];
56 dashPattern =
new String[1];
58 plotStyle[0] =
"smooth";
59 dashPattern[0] =
"solid";
62 private void initYListSeries(
boolean flag,
double[]... data) {
65 renderer =
new XYLineAndShapeRenderer(
true,
false);
66 seriesCollection =
new XYSeriesCollection();
68 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
69 for (
int i = 0; i < data.length; i++) {
70 XYSeries serie =
new XYSeries(
" ");
74 h = 1.0 / data[i].length;
75 for (
int j = 0; j < data[i].length; j++)
76 serie.add(h * (j + 1), data[i][j]);
77 tempSeriesCollection.addSeries(serie);
80 final int s = tempSeriesCollection.getSeriesCount();
83 for (
int i = 0; i < s; i++) {
84 renderer.setSeriesPaint(i, getDefaultColor(i));
88 plotStyle =
new String[s];
89 marksType =
new String[s];
90 dashPattern =
new String[s];
91 for (
int i = 0; i < s; i++) {
93 plotStyle[i] =
"smooth";
94 dashPattern[i] =
"solid";
111 initYListSeries(
true, data);
125 initYListSeries(flag, data);
142 initYListSeries(1, data, numPoints);
156 initYListSeries(h, data, numPoints);
174 renderer =
new XYLineAndShapeRenderer(
true,
false);
175 seriesCollection =
new XYSeriesCollection();
177 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
178 for (
int i = 0; i < data.length; i++) {
179 XYSeries serie =
new XYSeries(
" ");
180 for (
int j = 0; j < numPoints; j++)
181 serie.add(j + 1, data[i][j]);
182 tempSeriesCollection.addSeries(serie);
185 final int s = tempSeriesCollection.getSeriesCount();
188 for (
int i = 0; i < s; i++) {
189 renderer.setSeriesPaint(i, getDefaultColor(i));
193 plotStyle =
new String[s];
194 marksType =
new String[s];
195 dashPattern =
new String[s];
196 for (
int i = 0; i < s; i++) {
198 plotStyle[i] =
"smooth";
199 dashPattern[i] =
"solid";
YListSeriesCollection(double h, double[] data, int numPoints)
Similar to the constructor YListSeriesCollection(data, numPoints) above, but the points are.
YListSeriesCollection(double[]... data)
Creates a new YListSeriesCollection instance with default parameters and given data series.
YListSeriesCollection(boolean flag, double[]... data)
Similar to the constructor YListSeriesCollection(data) above, except that if flag is true,...
YListSeriesCollection(double[] data, int numPoints)
Creates a new YListSeriesCollection instance with default parameters and one data series.
YListSeriesCollection(double[][] data, int numPoints)
Creates a new YListSeriesCollection instance with default parameters and given data series.
XYListSeriesCollection()
Stores data used in a XYLineChart or in other related charts, and provides complementary tools to dra...