This is a migrated thread and some comments may be shown as answers.

Problem plotting negative values on line chart

1 Answer 40 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Antony asked on 27 Aug 2010, 07:07 PM
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:

int gridItem = (int)dataItem.GetDataKeyValue("PlayerCode");
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)
    DateTime scDate = new DateTime();
    scDate = Convert.ToDateTime(dr["ScoreDate"]);
    ChartAxisItem item = new ChartAxisItem();
    item.Value = (decimal)scDate.ToOADate();
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);
Any help is much appreciated.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 01 Sep 2010, 02:31 PM
Hello Antony,

I am afraid I was not able to reproduce the issue. I have attached my test page -- basically I have copied your code and placed a sample DataTable inside. The chart appears as expected. You can find this page attached. Please, give it a try and let me know what changes I need to apply in order to reproduce the issue on my end. Thank you.

Best regards,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Chart (Obsolete)
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question