I am creating a line chart programmatically.
The chart has a datetime value for the xaxis and a numerical count for the yaxis.
If the yaxis values are +ve it all works fine but if there is a -ve value in the data, the chart does not plot and i get the error message 'There is no or empty series'
Here is the code used to create the chart:
Any help is much appreciated.
The chart has a datetime value for the xaxis and a numerical count for the yaxis.
If the yaxis values are +ve it all works fine but if there is a -ve value in the data, the chart does not plot and i get the error message 'There is no or empty series'
Here is the code used to create the chart:
int gridItem = (int)dataItem.GetDataKeyValue("PlayerCode");RadChart1.Series.Clear();RadChart1.Clear();RadChart1.PlotArea.XAxis.Clear();string scoreQuery = "SELECT [ScoreDate], [ScoreValue] FROM [Scores] WHERE ([PlayerCode] = @PlayerCode) AND ([ScoreValue] > 0) ORDER BY [ScoreDate] ASC";Connections scCon = new Connections(scoreQuery);scCon.AddParam("PlayerCode", gridItem);DataTable resTable = new DataTable();resTable = scCon.ReturnTable();ChartSeries chSeries = new ChartSeries();chSeries.Type = ChartSeriesType.Line;ChartAxisItem xAxis = new ChartAxisItem();RadChart1.PlotArea.XAxis.IsZeroBased = false;RadChart1.PlotArea.XAxis.AutoScale = false;RadChart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;foreach (DataRow dr in resTable.Rows){ chSeries.AddItem(Convert.ToDouble(dr["ScoreValue"])); DateTime scDate = new DateTime(); scDate = Convert.ToDateTime(dr["ScoreDate"]); ChartAxisItem item = new ChartAxisItem(); item.Value = (decimal)scDate.ToOADate(); RadChart1.PlotArea.XAxis.AddItem(item);}RadChart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Gradient;RadChart1.PlotArea.Appearance.FillStyle.MainColor = Color.FromArgb(78, 198, 19);RadChart1.PlotArea.Appearance.FillStyle.SecondColor = Color.FromArgb(123, 230, 108);RadChart1.Series.Add(chSeries);