Android: Dataset and renderer should be not null and should have the same number of series
<p>`*//I am implementing a linechartgraph. I am getting an error like below:<br>
//Error: Dataset and renderer should be not null and should have the same number of series<br>
//I am not able to understand this? Can anyone help me?  </p>

<pre><code>Intent intent = ChartFactory.getLineChartIntent(context, buildDateDataset
(titles, x, values),renderer, ""); 
return intent;

protected XYMultipleSeriesDataset buildDateDataset(String[] titles, List&lt;Date[]&gt; xValues,
List&lt;double[]&gt; yValues) {
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
int length = titles.length;
for (int i = 0; i &lt; length; i++) {
TimeSeries series = new TimeSeries(titles[i]);
Date[] xV = xValues.get(i);
double[] yV = yValues.get(i);
int seriesLength = xV.length;
for (int k = 0; k &lt; seriesLength; k++) {
series.add(xV[k], yV[k]);
}
  dataset.addSeries(series);
}
return dataset;
}

In the linechart line i am sending the param values. On that my app is crashing.   
I also added XYMultipleSeriesDataset code.

My execute function. In this function i am getting x and y values.

List&lt;Date[]&gt; x = new ArrayList&lt;Date[]&gt;();
List&lt;double[]&gt; values = new ArrayList&lt;double[]&gt;(); 

double price[] = new double[PriceData.size()];
System.out.println("Print :" + price);
Date priceDt[] = new Date[PriceData.size()];
System.out.println("Print :" + priceDt);

for(int i = 0; i &lt;titles.length; i++ )
{
for (int j = 0; j &lt; PriceData.size(); j++) 
{
date = PriceData.get(j).PriceDt;
System.out.println(date);
Date d = new Date(date); //check it  
System.out.println(d); 
priceDt[j] = d; 
x.add(priceDt);    
}
}
for (int i = 0; i &lt; PriceData.size(); i++) 
{
//date = date.replace("/", "");
System.out.println(PriceData.get(i).Price);
System.out.println(PriceData.get(i).PriceDt); 
price[i] = Double.valueOf(PriceData.get(i).Price);
values.add(price);
}
int[] colors = new int[] { Color.CYAN,Color.GREEN};
// PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE};
PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE,PointStyle.POINT};
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); 
int length = renderer.getSeriesRendererCount(); 
for (int i = 0; i &lt; length; i++) 
{  
((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true); 
}
setChartSettings(renderer, "", "Month", "price", 0, 12, 0, 190,
Color.GREEN, Color.GREEN);
renderer.setXLabels(PriceData.size());
renderer.setYLabels(PriceData.size());     
renderer.setShowGrid(false);
renderer.setXLabelsAlign(Align.RIGHT);
renderer.setYLabelsAlign(Align.RIGHT);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.WHITE);
renderer.setMarginsColor(Color.WHITE);
//renderer.setAxisTitleTextSize(15);
renderer.setMargins(new int[] {10, 40, 10, 10});
renderer.setZoomButtonsVisible(true);
renderer.setPanLimits(new double[] { -10, 20, -10, 40 });
renderer.setZoomLimits(new double[] { -10, 20, -10, 40 });
Intent intent = ChartFactory.getLineChartIntent(context, 
buildDateDataset(titles, x, values), renderer, ""); 
return intent;
}
}
</code></pre>
