All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.wickedcharts.highcharts.options.series.PointSeries Maven / Gradle / Ivy

Go to download

A Java abstraction of the Highcharts javascript library to include interactive charts in your Java web application.

The newest version!
/**
 *   Copyright 2012-2013 Wicked Charts (http://wicked-charts.googlecode.com)
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package com.googlecode.wickedcharts.highcharts.options.series;

import java.util.Arrays;
import java.util.List;

/**
 * A series containing of {@link Point}s.
 * 
 * @see http://api.highcharts.com/highcharts#series.data
 * @author Tom Hombergs ([email protected])
 * 
 */
public class PointSeries extends Series {

	private static final long serialVersionUID = 1L;

	/**
	 * Adds a point with only a number.
	 * 
	 * @param y
	 *          the number.
	 */
	public PointSeries addNumberPoint(final Number y) {
		Point point = new Point(y);
		addPoint(point);
		return this;
	}

	/**
	 * Adds a list of point with only numbers.
	 * 
	 * @param values
	 *          the number values to add.
	 */
	public PointSeries addNumbers(final List values) {
		for (Number number : values) {
			addNumberPoint(number);
		}
		return this;
	}

	@Override
	public List getData() {
		return super.getData();
	}

	@Override
	public PointSeries setData(final List data) {
		super.setData(data);
		return this;
	}

	@Override
	public PointSeries setData(final Point... data) {
		super.setData(Arrays.asList(data));
		return this;
	}

	public PointSeries setNumberData(final List data) {
		for (Number number : data) {
			addPoint(new Point(number));
		}
		return this;
	}

	public PointSeries setNumberData(final Number... data) {
		for (Number number : data) {
			addPoint(new Point(number));
		}
		return this;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy