Verify if Points exists on AJAX Line Chart Control in ASP.Net

Last Reply on Jul 27, 2014 03:34 AM By Mudassar

Posted on Jul 27, 2014 03:34 AM


This is my aspx code :

<asp:Chart ID="ChartAlertes" runat="server" Width="500px">
                    <asp:Title Text="Nombre d'alertes et leurs status en fonction des filtres renseignés"
                        BorderColor="Black" Alignment="TopCenter">
                    <asp:ChartArea Name="MainChartArea">

I display 2 Points (2 columns) in the Chart Control and I change the color of the each Points with :

ChartAlertes.Series[0].Points[0].Color = System.Drawing.Color.Red;
ChartAlertes.Series[0].Points[1].Color = System.Drawing.Color.DarkOrange;

But sometimes, I have only 1 Point to display or nothing at all on the Chart. So I'd like to check If there are some Points before to put the color of each Point.

For example :

if (ChartAlertes.Series[0].Empty == false)





Do you have a solution ?


Posted on Jul 27, 2014 03:34 AM

Check the points count

if(ChartAlertes.Series[0].Points.Count > 0)