Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / android-libraries / achartengine / src / org / achartengine / ChartFactory.java
diff --git a/android-libraries/achartengine/src/org/achartengine/ChartFactory.java b/android-libraries/achartengine/src/org/achartengine/ChartFactory.java
new file mode 100644 (file)
index 0000000..301f1a8
--- /dev/null
@@ -0,0 +1,708 @@
+/**\r
+ * Copyright (C) 2009 - 2012 SC 4ViewSoft SRL\r
+ *  \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *  \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *  \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.achartengine;\r
+\r
+import org.achartengine.chart.BarChart;\r
+import org.achartengine.chart.BarChart.Type;\r
+import org.achartengine.chart.BubbleChart;\r
+import org.achartengine.chart.CombinedXYChart;\r
+import org.achartengine.chart.CubicLineChart;\r
+import org.achartengine.chart.DialChart;\r
+import org.achartengine.chart.DoughnutChart;\r
+import org.achartengine.chart.LineChart;\r
+import org.achartengine.chart.PieChart;\r
+import org.achartengine.chart.RangeBarChart;\r
+import org.achartengine.chart.ScatterChart;\r
+import org.achartengine.chart.TimeChart;\r
+import org.achartengine.chart.XYChart;\r
+import org.achartengine.model.CategorySeries;\r
+import org.achartengine.model.MultipleCategorySeries;\r
+import org.achartengine.model.XYMultipleSeriesDataset;\r
+import org.achartengine.renderer.DefaultRenderer;\r
+import org.achartengine.renderer.DialRenderer;\r
+import org.achartengine.renderer.XYMultipleSeriesRenderer;\r
+\r
+import android.content.Context;\r
+import android.content.Intent;\r
+\r
+/**\r
+ * Utility methods for creating chart views or intents.\r
+ */\r
+public class ChartFactory {\r
+  /** The key for the chart data. */\r
+  public static final String CHART = "chart";\r
+\r
+  /** The key for the chart graphical activity title. */\r
+  public static final String TITLE = "title";\r
+\r
+  private ChartFactory() {\r
+    // empty for now\r
+  }\r
+\r
+  /**\r
+   * Creates a line chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a line chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getLineChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) {\r
+    checkParameters(dataset, renderer);\r
+    XYChart chart = new LineChart(dataset, renderer);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a cubic line chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a line chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getCubeLineChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness) {\r
+    checkParameters(dataset, renderer);\r
+    XYChart chart = new CubicLineChart(dataset, renderer, smoothness);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a scatter chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a scatter chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getScatterChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) {\r
+    checkParameters(dataset, renderer);\r
+    XYChart chart = new ScatterChart(dataset, renderer);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a bubble chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a scatter chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getBubbleChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) {\r
+    checkParameters(dataset, renderer);\r
+    XYChart chart = new BubbleChart(dataset, renderer);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a time chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param format the date format pattern to be used for displaying the X axis\r
+   *          date labels. If null, a default appropriate format will be used.\r
+   * @return a time chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getTimeChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String format) {\r
+    checkParameters(dataset, renderer);\r
+    TimeChart chart = new TimeChart(dataset, renderer);\r
+    chart.setDateFormat(format);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a bar chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param type the bar chart type\r
+   * @return a bar chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getBarChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, Type type) {\r
+    checkParameters(dataset, renderer);\r
+    XYChart chart = new BarChart(dataset, renderer, type);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a range bar chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param type the range bar chart type\r
+   * @return a bar chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final GraphicalView getRangeBarChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, Type type) {\r
+    checkParameters(dataset, renderer);\r
+    XYChart chart = new RangeBarChart(dataset, renderer, type);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a combined XY chart view.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param types the chart types (cannot be null)\r
+   * @return a combined XY chart graphical view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if a dataset number of items is different than the number of\r
+   *           series renderers or number of chart types\r
+   */\r
+  public static final GraphicalView getCombinedXYChartView(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String[] types) {\r
+    if (dataset == null || renderer == null || types == null\r
+        || dataset.getSeriesCount() != types.length) {\r
+      throw new IllegalArgumentException(\r
+          "Dataset, renderer and types should be not null and the datasets series count should be equal to the types length");\r
+    }\r
+    checkParameters(dataset, renderer);\r
+    CombinedXYChart chart = new CombinedXYChart(dataset, renderer, types);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a pie chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the category series dataset (cannot be null)\r
+   * @param renderer the series renderer (cannot be null)\r
+   * @return a pie chart view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  public static final GraphicalView getPieChartView(Context context, CategorySeries dataset,\r
+      DefaultRenderer renderer) {\r
+    checkParameters(dataset, renderer);\r
+    PieChart chart = new PieChart(dataset, renderer);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a dial chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the category series dataset (cannot be null)\r
+   * @param renderer the dial renderer (cannot be null)\r
+   * @return a pie chart view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  public static final GraphicalView getDialChartView(Context context, CategorySeries dataset,\r
+      DialRenderer renderer) {\r
+    checkParameters(dataset, renderer);\r
+    DialChart chart = new DialChart(dataset, renderer);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * Creates a doughnut chart intent that can be used to start the graphical\r
+   * view activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple category series dataset (cannot be null)\r
+   * @param renderer the series renderer (cannot be null)\r
+   * @return a pie chart view\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  public static final GraphicalView getDoughnutChartView(Context context,\r
+      MultipleCategorySeries dataset, DefaultRenderer renderer) {\r
+    checkParameters(dataset, renderer);\r
+    DoughnutChart chart = new DoughnutChart(dataset, renderer);\r
+    return new GraphicalView(context, chart);\r
+  }\r
+\r
+  /**\r
+   * \r
+   * Creates a line chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a line chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getLineChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer) {\r
+    return getLineChartIntent(context, dataset, renderer, "");\r
+  }\r
+\r
+  /**\r
+   * \r
+   * Creates a cubic line chart intent that can be used to start the graphical\r
+   * view activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a line chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getCubicLineChartIntent(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness) {\r
+    return getCubicLineChartIntent(context, dataset, renderer, smoothness, "");\r
+  }\r
+\r
+  /**\r
+   * Creates a scatter chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a scatter chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getScatterChartIntent(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) {\r
+    return getScatterChartIntent(context, dataset, renderer, "");\r
+  }\r
+\r
+  /**\r
+   * Creates a bubble chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @return a scatter chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getBubbleChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer) {\r
+    return getBubbleChartIntent(context, dataset, renderer, "");\r
+  }\r
+\r
+  /**\r
+   * Creates a time chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param format the date format pattern to be used for displaying the X axis\r
+   *          date labels. If null, a default appropriate format will be used.\r
+   * @return a time chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getTimeChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer, String format) {\r
+    return getTimeChartIntent(context, dataset, renderer, format, "");\r
+  }\r
+\r
+  /**\r
+   * Creates a bar chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param type the bar chart type\r
+   * @return a bar chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getBarChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer, Type type) {\r
+    return getBarChartIntent(context, dataset, renderer, type, "");\r
+  }\r
+\r
+  /**\r
+   * Creates a line chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title. If this is null,\r
+   *          then the title bar will be hidden. If a blank title is passed in,\r
+   *          then the title bar will be the default. Pass in any other string\r
+   *          to set a custom title.\r
+   * @return a line chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getLineChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    XYChart chart = new LineChart(dataset, renderer);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a line chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title. If this is null,\r
+   *          then the title bar will be hidden. If a blank title is passed in,\r
+   *          then the title bar will be the default. Pass in any other string\r
+   *          to set a custom title.\r
+   * @return a line chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getCubicLineChartIntent(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness,\r
+      String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    XYChart chart = new CubicLineChart(dataset, renderer, smoothness);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a scatter chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a scatter chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getScatterChartIntent(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    XYChart chart = new ScatterChart(dataset, renderer);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a bubble chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a scatter chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getBubbleChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    XYChart chart = new BubbleChart(dataset, renderer);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a time chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param format the date format pattern to be used for displaying the X axis\r
+   *          date labels. If null, a default appropriate format will be used\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a time chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getTimeChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer, String format, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    TimeChart chart = new TimeChart(dataset, renderer);\r
+    chart.setDateFormat(format);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a bar chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param type the bar chart type\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a bar chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getBarChartIntent(Context context, XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer, Type type, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    BarChart chart = new BarChart(dataset, renderer, type);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a range bar chart intent that can be used to start the graphical\r
+   * view activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param type the range bar chart type\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a range bar chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  public static final Intent getRangeBarChartIntent(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, Type type,\r
+      String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    RangeBarChart chart = new RangeBarChart(dataset, renderer, type);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a combined XY chart intent that can be used to start the graphical\r
+   * view activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @param types the chart types (cannot be null)\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a combined XY chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if a dataset number of items is different than the number of\r
+   *           series renderers or number of chart types\r
+   */\r
+  public static final Intent getCombinedXYChartIntent(Context context,\r
+      XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, String[] types,\r
+      String activityTitle) {\r
+    if (dataset == null || renderer == null || types == null\r
+        || dataset.getSeriesCount() != types.length) {\r
+      throw new IllegalArgumentException(\r
+          "Datasets, renderers and types should be not null and the datasets series count should be equal to the types length");\r
+    }\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    CombinedXYChart chart = new CombinedXYChart(dataset, renderer, types);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a pie chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the category series dataset (cannot be null)\r
+   * @param renderer the series renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a pie chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  public static final Intent getPieChartIntent(Context context, CategorySeries dataset,\r
+      DefaultRenderer renderer, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    PieChart chart = new PieChart(dataset, renderer);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a doughnut chart intent that can be used to start the graphical\r
+   * view activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the multiple category series dataset (cannot be null)\r
+   * @param renderer the series renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a pie chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  public static final Intent getDoughnutChartIntent(Context context,\r
+      MultipleCategorySeries dataset, DefaultRenderer renderer, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    DoughnutChart chart = new DoughnutChart(dataset, renderer);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Creates a dial chart intent that can be used to start the graphical view\r
+   * activity.\r
+   * \r
+   * @param context the context\r
+   * @param dataset the category series dataset (cannot be null)\r
+   * @param renderer the dial renderer (cannot be null)\r
+   * @param activityTitle the graphical chart activity title\r
+   * @return a dial chart intent\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  public static final Intent getDialChartIntent(Context context, CategorySeries dataset,\r
+      DialRenderer renderer, String activityTitle) {\r
+    checkParameters(dataset, renderer);\r
+    Intent intent = new Intent(context, GraphicalActivity.class);\r
+    DialChart chart = new DialChart(dataset, renderer);\r
+    intent.putExtra(CHART, chart);\r
+    intent.putExtra(TITLE, activityTitle);\r
+    return intent;\r
+  }\r
+\r
+  /**\r
+   * Checks the validity of the dataset and renderer parameters.\r
+   * \r
+   * @param dataset the multiple series dataset (cannot be null)\r
+   * @param renderer the multiple series renderer (cannot be null)\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset and the renderer don't include the same number of\r
+   *           series\r
+   */\r
+  private static void checkParameters(XYMultipleSeriesDataset dataset,\r
+      XYMultipleSeriesRenderer renderer) {\r
+    if (dataset == null || renderer == null\r
+        || dataset.getSeriesCount() != renderer.getSeriesRendererCount()) {\r
+      throw new IllegalArgumentException(\r
+          "Dataset and renderer should be not null and should have the same number of series");\r
+    }\r
+  }\r
+\r
+  /**\r
+   * Checks the validity of the dataset and renderer parameters.\r
+   * \r
+   * @param dataset the category series dataset (cannot be null)\r
+   * @param renderer the series renderer (cannot be null)\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  private static void checkParameters(CategorySeries dataset, DefaultRenderer renderer) {\r
+    if (dataset == null || renderer == null\r
+        || dataset.getItemCount() != renderer.getSeriesRendererCount()) {\r
+      throw new IllegalArgumentException(\r
+          "Dataset and renderer should be not null and the dataset number of items should be equal to the number of series renderers");\r
+    }\r
+  }\r
+\r
+  /**\r
+   * Checks the validity of the dataset and renderer parameters.\r
+   * \r
+   * @param dataset the category series dataset (cannot be null)\r
+   * @param renderer the series renderer (cannot be null)\r
+   * @throws IllegalArgumentException if dataset is null or renderer is null or\r
+   *           if the dataset number of items is different than the number of\r
+   *           series renderers\r
+   */\r
+  private static void checkParameters(MultipleCategorySeries dataset, DefaultRenderer renderer) {\r
+    if (dataset == null || renderer == null\r
+        || !checkMultipleSeriesItems(dataset, renderer.getSeriesRendererCount())) {\r
+      throw new IllegalArgumentException(\r
+          "Titles and values should be not null and the dataset number of items should be equal to the number of series renderers");\r
+    }\r
+  }\r
+\r
+  private static boolean checkMultipleSeriesItems(MultipleCategorySeries dataset, int value) {\r
+    int count = dataset.getCategoriesCount();\r
+    boolean equal = true;\r
+    for (int k = 0; k < count && equal; k++) {\r
+      equal = dataset.getValues(k).length == dataset.getTitles(k).length;\r
+    }\r
+    return equal;\r
+  }\r
+\r
+}\r