SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
XYListSeriesCollection.java
1/*
2 * Class: XYListSeriesCollection
3 * Description:
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.charts;
26
27import umontreal.ssj.functions.MathFunction;
28import umontreal.ssj.functionfit.SmoothingCubicSpline;
29import umontreal.ssj.util.RootFinder;
30
31import org.jfree.data.xy.*;
32import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
33
34import cern.colt.list.DoubleArrayList;
35
36import java.util.Locale;
37import java.util.Formatter;
38import java.awt.Color;
39
53 protected String[] marksType; // marks on points (+, x, *...)
54 protected String[] dashPattern; // line dashing (solid, dotted, densely dotted, loosely dotted,
55 // dashed, densely dashed, loosely dashed, only marks)
56 protected String[] plotStyle; // plot style (lines, curves...)
57 private boolean autoCompletion = false;
58
63 renderer = new XYLineAndShapeRenderer(true, false);
64 // ((XYLineAndShapeRenderer)renderer).setShapesVisible(false);
65 seriesCollection = new XYSeriesCollection();
66 }
67
98 public XYListSeriesCollection(double[][]... data) {
99 renderer = new XYLineAndShapeRenderer(true, false);
100 // ((XYLineAndShapeRenderer)renderer).setShapesVisible(false);
101 seriesCollection = new XYSeriesCollection();
102
103 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
104 for (int i = 0; i < data.length; i++) {
105
106 if (data[i].length < 2)
107 throw new IllegalArgumentException(
108 "Unable to render the plot. data[" + i + "] contains less than two rows");
109
110 for (int j = 0; j < data[i].length - 1; j++)
111 if (data[i][j].length != data[i][j + 1].length)
112 throw new IllegalArgumentException(
113 "data[" + i + "][" + j + "] and data[" + i + "][" + (j + 1) + "] must share the same length");
114
115 for (int j = 1; j < data[i].length; j++) {
116 XYSeries serie = new XYSeries(" ");
117 for (int k = 0; k < data[i][0].length; k++)
118 serie.add(data[i][0][k], data[i][j][k]);
119 tempSeriesCollection.addSeries(serie);
120 }
121 }
122
123 // set default colors
124 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++)
125 renderer.setSeriesPaint(i, getDefaultColor(i));
126
127 // set default plot style
128 plotStyle = new String[tempSeriesCollection.getSeriesCount()];
129 marksType = new String[tempSeriesCollection.getSeriesCount()];
130 dashPattern = new String[tempSeriesCollection.getSeriesCount()];
131 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++) {
132 marksType[i] = " ";
133 plotStyle[i] = "smooth";
134 dashPattern[i] = "solid";
135 }
136 }
137
154 public XYListSeriesCollection(double[][] data, int numPoints) {
155 renderer = new XYLineAndShapeRenderer(true, false);
156 // ((XYLineAndShapeRenderer)renderer).setShapesVisible(false);
157 seriesCollection = new XYSeriesCollection();
158
159 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
160 if (data.length < 2)
161 throw new IllegalArgumentException("Unable to render the plot. data contains less than two rows");
162
163 // n-1 curves: data[0] is x; data[i] is y for each curve
164 for (int j = 1; j < data.length; j++) {
165 XYSeries serie = new XYSeries(" ");
166 for (int k = 0; k < numPoints; k++)
167 serie.add(data[0][k], data[j][k]);
168 tempSeriesCollection.addSeries(serie);
169 }
170
171 // set default colors
172 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++)
173 renderer.setSeriesPaint(i, getDefaultColor(i));
174
175 // set default plot style
176 plotStyle = new String[tempSeriesCollection.getSeriesCount()];
177 marksType = new String[tempSeriesCollection.getSeriesCount()];
178 dashPattern = new String[tempSeriesCollection.getSeriesCount()];
179 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++) {
180 marksType[i] = " ";
181 plotStyle[i] = "smooth";
182 dashPattern[i] = "solid";
183 }
184 }
185
195 public XYListSeriesCollection(DoubleArrayList... data) {
196 renderer = new XYLineAndShapeRenderer(true, false);
197 // ((XYLineAndShapeRenderer)renderer).setShapesVisible(false);
198 seriesCollection = new XYSeriesCollection();
199 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
200
201 XYSeries serie;
202 double[] elements;
203 int count = 0;
204 DoubleArrayList temp;
205 for (int i = 0; i < data.length; i++) {
206 serie = new XYSeries(" ");
207
208 temp = data[i].copy(); // deep copy
209 temp.trimToSize(); // set capacity to the current size
210 temp.quickSortFromTo(0, temp.size() - 1); // sort list in increasing order, simplify the next processings
211 elements = temp.elements();
212
213 int j = 0;
214 int l = 0;
215 while (j < elements.length) {
216 while (j < elements.length && elements[j] == elements[l]) {
217 j++;
218 count++;
219 }
220 serie.add(elements[l], count);
221 count = 0;
222 l = j;
223 }
224 tempSeriesCollection.addSeries(serie);
225 }
226
227 // set default colors
228 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++) {
229 renderer.setSeriesPaint(i, getDefaultColor(i));
230 }
231
232 // set default plot style
233 plotStyle = new String[tempSeriesCollection.getSeriesCount()];
234 marksType = new String[tempSeriesCollection.getSeriesCount()];
235 dashPattern = new String[tempSeriesCollection.getSeriesCount()];
236 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++) {
237 marksType[i] = " ";
238 plotStyle[i] = "smooth";
239 dashPattern[i] = "solid";
240 }
241 }
242
250 public XYListSeriesCollection(XYSeriesCollection data) {
251 renderer = new XYLineAndShapeRenderer(true, false);
252 // ((XYLineAndShapeRenderer)renderer).setShapesVisible(false);
253 seriesCollection = data;
254 for (int i = 0; i < data.getSeriesCount(); i++) {
255 XYSeries serie = data.getSeries(i);
256 }
257
258 // set default colors
259 for (int i = 0; i < data.getSeriesCount(); i++) {
260 renderer.setSeriesPaint(i, getDefaultColor(i));
261 }
262
263 // set default plot style
264 plotStyle = new String[data.getSeriesCount()];
265 marksType = new String[data.getSeriesCount()];
266 dashPattern = new String[data.getSeriesCount()];
267 for (int i = 0; i < data.getSeriesCount(); i++) {
268 marksType[i] = " ";
269 plotStyle[i] = "smooth";
270 dashPattern[i] = "solid";
271 }
272 }
273
277
288 public int add(double[] x, double[] y) {
289 if (x.length != y.length)
290 throw new IllegalArgumentException("x and y must have the same length");
291 return add(x, y, x.length);
292 }
293
306 public int add(double[] x, double[] y, int numPoints) {
307 XYSeries serie = new XYSeries(" ");
308 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
309 serie.setNotify(true);
310 if ((x.length < numPoints) || (y.length < numPoints))
311 throw new IllegalArgumentException("numPoints > length of x or y");
312 for (int i = 0; i < numPoints; i++)
313 serie.add(x[i], y[i]);
314 tempSeriesCollection.addSeries(serie);
315
316 // color
317 int j = tempSeriesCollection.getSeriesCount() - 1;
318 renderer.setSeriesPaint(j, getDefaultColor(j));
319
320 int co = tempSeriesCollection.getSeriesCount();
321 String[] newPlotStyle = new String[co];
322 String[] newMarksType = new String[co];
323 String[] newDashPattern = new String[co];
324 for (j = 0; j < co - 1; j++) {
325 newPlotStyle[j] = plotStyle[j];
326 newMarksType[j] = marksType[j];
327 newDashPattern[j] = dashPattern[j];
328 }
329
330 newPlotStyle[j] = "smooth";
331 newMarksType[j] = " ";
332 newDashPattern[j] = "solid";
333 plotStyle = newPlotStyle;
334 marksType = newMarksType;
335 dashPattern = newDashPattern;
336
337 return tempSeriesCollection.getSeriesCount() - 1;
338 }
339
348 public int add(double[][] data) {
349 return add(data, data[0].length);
350 }
351
363 public int add(double[][] data, int numPoints) {
364 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
365 int n = tempSeriesCollection.getSeriesCount();
366
367 if (data.length < 2)
368 throw new IllegalArgumentException("Unable to render the plot. data contains less than two rows");
369
370 for (int j = 0; j < data.length; j++)
371 if (data[j].length < numPoints)
372 throw new IllegalArgumentException("data[" + j + "] has not enough points");
373
374 for (int j = 1; j < data.length; j++) {
375 XYSeries serie = new XYSeries(" ");
376 serie.setNotify(true);
377 for (int k = 0; k < numPoints; k++)
378 serie.add(data[0][k], data[j][k]);
379 tempSeriesCollection.addSeries(serie);
380 }
381
382 // color
383 for (int j = n; j < tempSeriesCollection.getSeriesCount(); j++)
384 renderer.setSeriesPaint(j, getDefaultColor(j));
385
386 String[] newPlotStyle = new String[tempSeriesCollection.getSeriesCount()];
387 String[] newMarksType = new String[tempSeriesCollection.getSeriesCount()];
388 String[] newDashPattern = new String[tempSeriesCollection.getSeriesCount()];
389 for (int j = 0; j < n; j++) {
390 newPlotStyle[j] = plotStyle[j];
391 newMarksType[j] = marksType[j];
392 newDashPattern[j] = dashPattern[j];
393 }
394
395 for (int j = n; j < tempSeriesCollection.getSeriesCount(); j++) {
396 newPlotStyle[j] = "smooth";
397 newMarksType[j] = " ";
398 newDashPattern[j] = "solid";
399 }
400 plotStyle = newPlotStyle;
401 marksType = newMarksType;
402 dashPattern = newDashPattern;
403
404 return (tempSeriesCollection.getSeriesCount() - n);
405 }
406
415 public int add(DoubleArrayList data) {
416 XYSeries serie = new XYSeries(" ");
417 DoubleArrayList temp = data.copy(); // deep copy
418 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
419
420 temp.trimToSize(); // set capacity to the current size
421 temp.quickSortFromTo(0, temp.size() - 1); // sort list in increasing order, simplify the next processings
422 double[] elements = temp.elements();
423
424 int count = 0;
425 int j = 0;
426 int l = 0;
427 while (j < elements.length) {
428 while (j < elements.length && elements[j] == elements[l]) {
429 j++;
430 count++;
431 }
432 serie.add(elements[l], count);
433 count = 0;
434 l = j;
435 }
436 tempSeriesCollection.addSeries(serie);
437
438 // color
439 j = tempSeriesCollection.getSeriesCount() - 1;
440 renderer.setSeriesPaint(j, getDefaultColor(j));
441
442 String[] newPlotStyle = new String[tempSeriesCollection.getSeriesCount()];
443 String[] newMarksType = new String[tempSeriesCollection.getSeriesCount()];
444 String[] newDashPattern = new String[tempSeriesCollection.getSeriesCount()];
445 for (j = 0; j < tempSeriesCollection.getSeriesCount() - 1; j++) {
446 newPlotStyle[j] = plotStyle[j];
447 newMarksType[j] = marksType[j];
448 newDashPattern[j] = dashPattern[j];
449 }
450
451 newPlotStyle[j] = "smooth";
452 newMarksType[j] = " ";
453 newDashPattern[j] = "solid";
454 plotStyle = newPlotStyle;
455 marksType = newMarksType;
456 dashPattern = newDashPattern;
457
458 return tempSeriesCollection.getSeriesCount() - 1;
459 }
460
467 public String getName(int series) {
468 return (String) ((XYSeriesCollection) seriesCollection).getSeries(series).getKey();
469 }
470
477 public void setName(int series, String name) {
478 if (name == null)
479 name = " ";
480 ((XYSeriesCollection) seriesCollection).getSeries(series).setKey(name);
481 }
482
486
490
499 public void enableAutoCompletion() {
500 this.autoCompletion = true;
501 }
502
506 public void disableAutoCompletion() {
507 this.autoCompletion = false;
508 }
509
516 public String getMarksType(int series) {
517 return marksType[series];
518 }
519
530 public void setMarksType(int series, String marksType) {
531 this.marksType[series] = marksType;
532 }
533
540 public String getDashPattern(int series) {
541 return dashPattern[series];
542 }
543
556 public void setDashPattern(int series, String dashPattern) {
557 this.dashPattern[series] = dashPattern;
558 if (dashPattern.equals("only marks")) {
559 ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(series, false);
560 ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(series, true);
561 } else {
562 ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(series, true);
563 ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(series, false);
564 }
565 }
566
573 public String getPlotStyle(int series) {
574 return plotStyle[series];
575 }
576
589 public void setPlotStyle(int series, String plotStyle) {
590 this.plotStyle[series] = plotStyle;
591 }
592
593 public String toLatex(double XScale, double YScale, double XShift, double YShift, double xmin, double xmax,
594 double ymin, double ymax) {
595
596 // Calcule les bornes reelles du graphique, en prenant en compte la position des
597 // axes
598 xmin = Math.min(XShift, xmin);
599 xmax = Math.max(XShift, xmax);
600 ymin = Math.min(YShift, ymin);
601 ymax = Math.max(YShift, ymax);
602
603 Formatter formatter = new Formatter(Locale.US);
604 XYSeriesCollection tempSeriesCollection = (XYSeriesCollection) seriesCollection;
605 double XEPSILON = (1.0E-4 / XScale) + XShift;
606 double YEPSILON = (1.0E-4 / YScale) + YShift;
607 boolean outOfBounds = false;
608 MathFunction[] spline = null;
609 double[] xBounds = getRangeBounds();
610 double[] yBounds = getDomainBounds();
611 double x, y;
612// Smoothing splines, consulter ref: QA278.2 G74, QA278.2 T35, QA278.2 E87
613
614// if(xBounds[0] < xmin || xBounds[1] > xmax || yBounds[0] < ymin || yBounds[1] > ymax) {
615// // on sait qu'il y a des points qui vont sortir du chart
616// // initialisation d'une spline pour chaque courbe
617// spline = new SmoothingCubicSpline[seriesCollection.getSeriesCount()];
618// for(int i = 0; i<seriesCollection.getSeriesCount(); i++)
619// spline[i] = new SmoothingCubicSpline( (seriesCollection.getSeries(i).toArray())[0],
620// (seriesCollection.getSeries(i).toArray())[1], 0.5);
621// }
622
623 // on sait qu'il y a des points qui vont sortir du chart
624 // initialisation d'une spline pour chaque courbe
625 if (true) {
626 spline = new SmoothingCubicSpline[tempSeriesCollection.getSeriesCount()];
627 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++)
628 spline[i] = new SmoothingCubicSpline((tempSeriesCollection.getSeries(i).toArray())[0],
629 (tempSeriesCollection.getSeries(i).toArray())[1], 1);
630 } else {
631 spline = new AffineFit[tempSeriesCollection.getSeriesCount()];
632 for (int i = 0; i < tempSeriesCollection.getSeriesCount(); i++)
633 spline[i] = new AffineFit((tempSeriesCollection.getSeries(i).toArray())[0],
634 (tempSeriesCollection.getSeries(i).toArray())[1]);
635 }
636
637 for (int i = tempSeriesCollection.getSeriesCount() - 1; i >= 0; i--) {
638 XYSeries temp = tempSeriesCollection.getSeries(i);
639
640 if (temp.getItemCount() < 2)
641 throw new IllegalArgumentException(
642 "Unable to plot series " + i + ": this series must have two points at least");
643
644 Color color = (Color) renderer.getSeriesPaint(i);
645 String colorString = detectXColorClassic(color);
646 if (colorString == null) {
647 colorString = "color" + i;
648 formatter.format("\\definecolor{%s}{rgb}{%.2f, %.2f, %.2f}%n", colorString, color.getRed() / 255.0,
649 color.getGreen() / 255.0, color.getBlue() / 255.0);
650 }
651
652 // Cas particulier pour le premier point, on doit savoir si il est dans le chart
653 // ou pas
654 if (temp.getX(0).doubleValue() >= xmin && temp.getX(0).doubleValue() <= xmax
655 && temp.getY(0).doubleValue() >= ymin && temp.getY(0).doubleValue() <= ymax) {
656 outOfBounds = false;
657 formatter.format("\\draw [%s, color=%s, mark=%s, style=%s] plot coordinates {%%%n", plotStyle[i],
658 colorString, marksType[i], dashPattern[i]);
659 } else {
660 outOfBounds = true;
661 formatter.format("%% ");
662 }
663 formatter.format("(%.2f,%.4f)", (temp.getX(0).doubleValue() - XShift) * XScale,
664 (temp.getY(0).doubleValue() - YShift) * YScale);
665 formatter.format(" %% (%f, %f)%n", temp.getX(0).doubleValue(), temp.getY(0).doubleValue());
666
667 // Cas general
668 for (int j = 1; j < temp.getItemCount(); j++) {
669 double[] result;
670 if (!outOfBounds) { // on est dans le chart
671 result = evalLimitValues(xmin, xmax, ymin, ymax, XEPSILON, YEPSILON, spline[i], temp, j, false);
672 // on regarde si on ne sort pas du chart, si c'est le cas on evalue le point en
673 // limite
674 if (result != null) { // le point courant n'est pas dans le chart, on sort donc du chart
675 outOfBounds = true;
676 if (autoCompletion)
677 formatter.format("(%.2f,%.4f) %%%n", (result[0] - XShift) * XScale, (result[1] - YShift) * YScale);
678 formatter.format("}%%%n%% ");
679 }
680 } else { // le point precedent etait hors du chart
681 if (temp.getX(j).doubleValue() >= xmin && temp.getX(j).doubleValue() <= xmax
682 && temp.getY(j).doubleValue() >= ymin && temp.getY(j).doubleValue() <= ymax) {
683 // on rentre dans le chart, il faut evaluer le point en limite
684 j = j - 1;
685 result = evalLimitValues(xmin, xmax, ymin, ymax, XEPSILON, YEPSILON, spline[i], temp, j, true);
686 // ici result ne peut pas etre null
687 formatter.format(";%%%n\\draw [%s, color=%s, mark=%s, style=%s] plot coordinates {%%%n", plotStyle[i],
688 colorString, marksType[i], dashPattern[i]);
689 if (autoCompletion)
690 formatter.format("(%.2f,%.4f) %%%n ", (result[0] - XShift) * XScale,
691 (result[1] - YShift) * YScale);
692 formatter.format("%% ");
693 outOfBounds = false;
694 } else {
695 formatter.format("%% ");
696 // on les donnees sont toujours hors du chart
697 }
698 }
699 /*
700 * on affiche les coordonnees du point quoiqu'il arrive, si celui ci est hors du
701 * chart alors la balise de commentaire a ete deja place
702 */
703 formatter.format("(%.2f,%.4f)", (temp.getX(j).doubleValue() - XShift) * XScale,
704 (temp.getY(j).doubleValue() - YShift) * YScale);
705 if (j == temp.getItemCount() - 1)
706 formatter.format("}");
707 formatter.format(" %% (%f, %f)%n", temp.getX(j).doubleValue(), temp.getY(j).doubleValue());
708// formatter.format(" %%%n");
709 }
710 formatter.format(" node[right] {%s};%n", (String) temp.getKey());
711 }
712 return formatter.toString();
713 }
714
732 private static double[] evalLimitValues(double xmin, double xmax, double ymin, double ymax, double XEPSILON,
733 double YEPSILON, MathFunction spline, XYSeries temp, int numPoint, boolean sens) {
734 int j = numPoint;
735 int k = 0;
736 double x, y;
737 if (sens)
738 k = j + 1;
739 else
740 k = j - 1;
741 if (temp.getX(j).doubleValue() < xmin) {// Hors du chart mais on etait dans le chart au point precedent
742 x = xmin;
743 y = spline.evaluate(xmin); // spline puis evaluer en xmin
744 while (y < ymin) {
745 x += XEPSILON;
746 y = spline.evaluate(x);
747 } // evaluer un x>xmin tantque y<ymin, y peut etre superieur a ymin car le point
748 // precedent est dans le chart
749 while (y > ymax) {
750 x += XEPSILON;
751 y = spline.evaluate(x);
752 } // evaluer un x en ymax avec x > xmin
753 } else if (temp.getX(j).doubleValue() > xmax) {
754 x = xmax;
755 y = spline.evaluate(xmax);
756 while (y < ymin) {
757 x -= XEPSILON;
758 y = spline.evaluate(x);
759 } // evaluer un x<xmax tantque y<ymin
760 while (y > ymax) {
761 x -= XEPSILON;
762 y = spline.evaluate(x);
763 } // evaluer un x<xmax tantque y>ymax
764 } else if (temp.getY(j).doubleValue() < ymin) {
765 y = ymin;
766 x = evaluateX(spline, y, temp.getX(j).doubleValue(), temp.getX(k).doubleValue());// spline puis evaluer en ymin
767 // avec x ente
768 // xValue(ptCourant) et
769 // xValue(ptCourant-1)
770 while (x < xmin) {
771 y += YEPSILON;
772 x = evaluateX(spline, y, x, temp.getX(k).doubleValue());
773 }
774 while (x > xmax) {
775 y += YEPSILON;
776 x = evaluateX(spline, y, x, temp.getX(k).doubleValue());
777 }
778 } else if (temp.getY(j).doubleValue() > ymax) {
779 y = ymax;
780 x = evaluateX(spline, y, temp.getX(j).doubleValue(), temp.getX(k).doubleValue());// spline puis evaluer en ymax
781 // avec x ente
782 // xValue(ptCourant) et
783 // xValue(ptCourant-1)
784 while (x < xmin) {
785 y -= YEPSILON;
786 x = evaluateX(spline, y, x, temp.getX(k).doubleValue());
787 }
788 while (x > xmax) {
789 y -= YEPSILON;
790 x = evaluateX(spline, y, x, temp.getX(k).doubleValue());
791 }
792 } else
793 return null;
794 double[] retour = new double[2];
795 retour[0] = x;
796 retour[1] = y;
797 return retour;
798 }
799
800 private static double evaluateX(final MathFunction spline, final double y, double xPrincipal, double xAnnexe) {
801 final MathFunction xFunction = new MathFunction() {
802 public double evaluate(double t) {
803 return spline.evaluate(t) - y;
804 }
805 };
806 return RootFinder.brentDekker(xPrincipal, xAnnexe - 1.0E-6, xFunction, 1e-6);
807 }
808
809 private class AffineFit implements MathFunction {
810
811 double[] x;
812 double[] y;
813
814 public AffineFit(double[] x, double[] y) {
815 this.x = x;
816 this.y = y;
817 }
818
819 public double evaluate(double t) {
820 int i = 0;
821 if (t <= x[0])
822 return y[0];
823 while (i < x.length && t > x[i])
824 i++;
825 i--;
826 if (i == x.length)
827 return x[x.length - 1];
828
829 return y[i] + ((t - x[i]) / (x[i + 1] - x[i])) * (y[i + 1] - y[i]);
830 }
831 }
832}
833
void setPlotStyle(int series, String plotStyle)
Selects the plot style for a given series.
int add(double[] x, double[] y)
Adds a data series into the series collection.
void setMarksType(int series, String marksType)
Adds marks on the points of a data series.
String getName(int series)
Gets the current name of the selected series.
void setName(int series, String name)
Sets the name of the selected series.
String getMarksType(int series)
Returns the mark type associated with the seriesth data series.
String getDashPattern(int series)
Returns the dash pattern associated with the seriesth data series.
XYListSeriesCollection()
Stores data used in a XYLineChart or in other related charts, and provides complementary tools to dra...
void setDashPattern(int series, String dashPattern)
Selects dash pattern for a data series.
void enableAutoCompletion()
Enables the auto completion option.
String getPlotStyle(int series)
Gets the current plot style for the selected series.
void disableAutoCompletion()
Disables auto completion option.