Package org.geoforge.jfreechart.data.xy

Source Code of org.geoforge.jfreechart.data.xy.GfrXYSeriesCollectionKeysPoint2D

/*
*  Copyright (C) 2011-2014 GeoForge Project
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Lesser General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.geoforge.jfreechart.data.xy;

import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class GfrXYSeriesCollectionKeysPoint2D extends XYSeriesCollection
{

  public GfrXYSeriesCollectionKeysPoint2D(
           String[] strsKeys,
           ArrayList<ArrayList<Point2D.Double>> altsDataSeries) throws Exception
   {
      super();

      if (strsKeys == null || strsKeys.length < 1)
         throw new Exception("strsKeys == null || strsKeys.length < 1");

      if (altsDataSeries == null || altsDataSeries.size() < 1)
         throw new Exception("altsDataSeries == null || altsDataSeries.length < 1");

      if (strsKeys.length != altsDataSeries.size())
         throw new Exception("strsKeys.length != altsDataSeries.length");

      for (int i = 0; i < strsKeys.length; i++)
      {
         //--
         XYSeries serCur = new XYSeries(strsKeys[i]);
         ArrayList<Point2D.Double> altDataCurs = altsDataSeries.get(i);

         for (int j = 0; j < altDataCurs.size(); j++)
         {
            Point2D.Double p2d = altDataCurs.get(j);
            serCur.add(p2d.x, p2d.y);
         }

         this.addSeries(serCur);
      }

   }

}
TOP

Related Classes of org.geoforge.jfreechart.data.xy.GfrXYSeriesCollectionKeysPoint2D

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.