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

Hello,

This is my aspx code :

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

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 ?

Thanks

Posted on Jul 27, 2014 03:34 AM

Check the points count

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

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html