Java Code Examples for org.achartengine.model.XYMultipleSeriesDataset

The following examples show how to use org.achartengine.model.XYMultipleSeriesDataset. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: gsn   Source File: AbstractChart.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Builds an XY multiple time dataset using the provided values.
 * 
 * @param titles the series titles
 * @param xValues the values for the X axis
 * @param yValues the values for the Y axis
 * @return the XY multiple time dataset
 */
protected XYMultipleSeriesDataset buildDateDataset(String[] titles, List<Date[]> xValues,
    List<double[]> yValues) {
  XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
  int length = titles.length;
  for (int i = 0; i < length; i++) {
    TimeSeries series = new TimeSeries(titles[i]);
    Date[] xV = xValues.get(i);
    double[] yV = yValues.get(i);
    int seriesLength = xV.length;
    
    Log.v("X", xV.length + "");
    Log.v("Y", yV.length + "");
    
    for (int k = 0; k < seriesLength; k++) {
      series.add(xV[k], yV[k]);
    }
    dataset.addSeries(series);
  }
  return dataset;
}
 
Example 2
Source Project: PressureNet   Source File: StatsChart.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Builds an XY multiple dataset using the provided values.
 * 
 * @param titles
 *            the series titles
 * @param xValues
 *            the values for the X axis
 * @param yValues
 *            the values for the Y axis
 * @return the XY multiple dataset
 */
protected XYMultipleSeriesDataset buildDataset(String[] titles,
		ArrayList<CbStats> statsList) {
	XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
	// add each component to the dataset
	List<Date[]> xValues = new ArrayList<Date[]>();
	List<double[]> yValues = new ArrayList<double[]>();
	int count = 0;
	for (CbStats obs : statsList) {
		Date[] dates = new Date[1];
		double[] values = new double[1];
		dates[0] = new Date(obs.getTimeStamp());

		values[0] = obs.getMean();

		xValues.add(dates);
		yValues.add(values);

	}

	dataset = addXYSeries(dataset, titles, xValues, yValues, 0);
	return dataset;
}
 
Example 3
Source Project: PressureNet   Source File: StatsChart.java    License: GNU General Public License v3.0 6 votes vote down vote up
public XYMultipleSeriesDataset addXYSeries(XYMultipleSeriesDataset dataset,
		String[] titles, List<Date[]> xValues, List<double[]> yValues,
		int scale) {
	TimeSeries series = new TimeSeries(titles[0]);
	for (int i = 0; i < xValues.size(); i++) {
		Date[] xV = xValues.get(i);
		double[] yV = yValues.get(i);
		if (yV[0] < 0.0) {
			continue;
		}
		series.add(xV[0], yV[0]);

	}
	dataset.addSeries(series);
	return dataset;
}
 
Example 4
Source Project: PressureNet   Source File: Chart.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Builds an XY multiple dataset using the provided values.
 * 
 * @param titles
 *            the series titles
 * @param xValues
 *            the values for the X axis
 * @param yValues
 *            the values for the Y axis
 * @return the XY multiple dataset
 */
protected XYMultipleSeriesDataset buildDataset(String[] titles,
		ArrayList<CbObservation> obsList) {
	XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
	// add each component to the dataset
	List<Date[]> xValues = new ArrayList<Date[]>();
	List<double[]> yValues = new ArrayList<double[]>();
	int count = 0;
	for (CbObservation obs : obsList) {
		Date[] dates = new Date[1];
		double[] values = new double[1];
		dates[0] = new Date(obs.getTime());

		values[0] = obs.getObservationValue();

		xValues.add(dates);
		yValues.add(values);

	}

	dataset = addXYSeries(dataset, titles, xValues, yValues, 0);
	return dataset;
}
 
Example 5
Source Project: PressureNet   Source File: Chart.java    License: GNU General Public License v3.0 6 votes vote down vote up
public XYMultipleSeriesDataset addXYSeries(XYMultipleSeriesDataset dataset,
		String[] titles, List<Date[]> xValues, List<double[]> yValues,
		int scale) {
	TimeSeries series = new TimeSeries(titles[0]);
	for (int i = 0; i < xValues.size(); i++) {
		Date[] xV = xValues.get(i);
		double[] yV = yValues.get(i);
		if (yV[0] < 0.0) {
			continue;
		}
		series.add(xV[0], yV[0]);

	}
	dataset.addSeries(series);
	return dataset;
}
 
Example 6
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
private static void a(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    if (xymultipleseriesdataset == null || xymultipleseriesrenderer == null || xymultipleseriesdataset.getSeriesCount() != xymultipleseriesrenderer.getSeriesRendererCount())
    {
        throw new IllegalArgumentException("Dataset and renderer should be not null and should have the same number of series");
    } else
    {
        return;
    }
}
 
Example 7
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getBarChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, org.achartengine.chart.BarChart.Type type, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    intent.putExtra("chart", new BarChart(xymultipleseriesdataset, xymultipleseriesrenderer, type));
    intent.putExtra("title", s);
    return intent;
}
 
Example 8
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getBubbleChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    intent.putExtra("chart", new BubbleChart(xymultipleseriesdataset, xymultipleseriesrenderer));
    intent.putExtra("title", s);
    return intent;
}
 
Example 9
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getCombinedXYChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String as[], String s)
{
    if (xymultipleseriesdataset == null || xymultipleseriesrenderer == null || as == null || xymultipleseriesdataset.getSeriesCount() != as.length)
    {
        throw new IllegalArgumentException("Datasets, renderers and types should be not null and the datasets series count should be equal to the types length");
    } else
    {
        a(xymultipleseriesdataset, xymultipleseriesrenderer);
        Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
        intent.putExtra("chart", new CombinedXYChart(xymultipleseriesdataset, xymultipleseriesrenderer, as));
        intent.putExtra("title", s);
        return intent;
    }
}
 
Example 10
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final GraphicalView getCombinedXYChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String as[])
{
    if (xymultipleseriesdataset == null || xymultipleseriesrenderer == null || as == null || xymultipleseriesdataset.getSeriesCount() != as.length)
    {
        throw new IllegalArgumentException("Dataset, renderer and types should be not null and the datasets series count should be equal to the types length");
    } else
    {
        a(xymultipleseriesdataset, xymultipleseriesrenderer);
        return new GraphicalView(context, new CombinedXYChart(xymultipleseriesdataset, xymultipleseriesrenderer, as));
    }
}
 
Example 11
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getCubicLineChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, float f, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    intent.putExtra("chart", new CubicLineChart(xymultipleseriesdataset, xymultipleseriesrenderer, f));
    intent.putExtra("title", s);
    return intent;
}
 
Example 12
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getLineChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    intent.putExtra("chart", new LineChart(xymultipleseriesdataset, xymultipleseriesrenderer));
    intent.putExtra("title", s);
    return intent;
}
 
Example 13
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getRangeBarChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, org.achartengine.chart.BarChart.Type type, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    intent.putExtra("chart", new RangeBarChart(xymultipleseriesdataset, xymultipleseriesrenderer, type));
    intent.putExtra("title", s);
    return intent;
}
 
Example 14
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getScatterChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    intent.putExtra("chart", new ScatterChart(xymultipleseriesdataset, xymultipleseriesrenderer));
    intent.putExtra("title", s);
    return intent;
}
 
Example 15
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final Intent getTimeChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String s, String s1)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    Intent intent = new Intent(context, org/achartengine/GraphicalActivity);
    TimeChart timechart = new TimeChart(xymultipleseriesdataset, xymultipleseriesrenderer);
    timechart.setDateFormat(s);
    intent.putExtra("chart", timechart);
    intent.putExtra("title", s1);
    return intent;
}
 
Example 16
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 5 votes vote down vote up
public static final GraphicalView getTimeChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, String s)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    TimeChart timechart = new TimeChart(xymultipleseriesdataset, xymultipleseriesrenderer);
    timechart.setDateFormat(s);
    return new GraphicalView(context, timechart);
}
 
Example 17
Source Project: MiBandDecompiled   Source File: XYChart.java    License: Apache License 2.0 5 votes vote down vote up
public XYChart(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    e = new HashMap();
    f = new HashMap();
    mDataset = xymultipleseriesdataset;
    mRenderer = xymultipleseriesrenderer;
}
 
Example 18
Source Project: MiBandDecompiled   Source File: CubicLineChart.java    License: Apache License 2.0 5 votes vote down vote up
public CubicLineChart(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, float f)
{
    super(xymultipleseriesdataset, xymultipleseriesrenderer);
    c = new Point();
    d = new Point();
    e = new Point();
    a = f;
    b = 1.0F - a;
}
 
Example 19
Source Project: gsn   Source File: AbstractChart.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void addXYSeries(XYMultipleSeriesDataset dataset, String[] titles, List<double[]> xValues,
    List<double[]> yValues, int scale) {
  int length = titles.length;
  for (int i = 0; i < length; i++) {
    XYSeries series = new XYSeries(titles[i], scale);
    double[] xV = xValues.get(i);
    double[] yV = yValues.get(i);
    int seriesLength = xV.length;
    for (int k = 0; k < seriesLength; k++) {
      series.add(xV[k], yV[k]);
    }
    dataset.addSeries(series);
  }
}
 
Example 20
Source Project: gsn   Source File: AbstractChart.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Builds a bar multiple series dataset using the provided values.
 * 
 * @param titles the series titles
 * @param values the values
 * @return the XY multiple bar dataset
 */
protected XYMultipleSeriesDataset buildBarDataset(String[] titles, List<double[]> values) {
  XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
  int length = titles.length;
  for (int i = 0; i < length; i++) {
    CategorySeries series = new CategorySeries(titles[i]);
    double[] v = values.get(i);
    int seriesLength = v.length;
    for (int k = 0; k < seriesLength; k++) {
      series.add(v[k]);
    }
    dataset.addSeries(series.toXYSeries());
  }
  return dataset;
}
 
Example 21
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final Intent getBarChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, org.achartengine.chart.BarChart.Type type)
{
    return getBarChartIntent(context, xymultipleseriesdataset, xymultipleseriesrenderer, type, "");
}
 
Example 22
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final GraphicalView getBarChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, org.achartengine.chart.BarChart.Type type)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    return new GraphicalView(context, new BarChart(xymultipleseriesdataset, xymultipleseriesrenderer, type));
}
 
Example 23
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final Intent getBubbleChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    return getBubbleChartIntent(context, xymultipleseriesdataset, xymultipleseriesrenderer, "");
}
 
Example 24
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final GraphicalView getBubbleChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    return new GraphicalView(context, new BubbleChart(xymultipleseriesdataset, xymultipleseriesrenderer));
}
 
Example 25
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final GraphicalView getCubeLineChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, float f)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    return new GraphicalView(context, new CubicLineChart(xymultipleseriesdataset, xymultipleseriesrenderer, f));
}
 
Example 26
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final Intent getCubicLineChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, float f)
{
    return getCubicLineChartIntent(context, xymultipleseriesdataset, xymultipleseriesrenderer, f, "");
}
 
Example 27
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final Intent getLineChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    return getLineChartIntent(context, xymultipleseriesdataset, xymultipleseriesrenderer, "");
}
 
Example 28
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final GraphicalView getLineChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    return new GraphicalView(context, new LineChart(xymultipleseriesdataset, xymultipleseriesrenderer));
}
 
Example 29
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final GraphicalView getRangeBarChartView(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer, org.achartengine.chart.BarChart.Type type)
{
    a(xymultipleseriesdataset, xymultipleseriesrenderer);
    return new GraphicalView(context, new RangeBarChart(xymultipleseriesdataset, xymultipleseriesrenderer, type));
}
 
Example 30
Source Project: MiBandDecompiled   Source File: ChartFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static final Intent getScatterChartIntent(Context context, XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
{
    return getScatterChartIntent(context, xymultipleseriesdataset, xymultipleseriesrenderer, "");
}