MindFusion.Charting Programmer's Guide

Chart.AreaClickHandler Delegate

See Also
 





Represents the method that will handle the Click event of the Chart control.

Namespace: MindFusion.Charting.WebForms
Assembly: MindFusion.Charting.WebForms

 Syntax

C#  Copy Code

public delegate void Chart.AreaClickHandler (
    Object sender,
    Chart.AreaEventArgs e
)

Visual Basic  Copy Code

Public Delegate Sub Chart.AreaClickHandler ( _
    sender As Object, _
    e As Chart.AreaEventArgs _
)

 Parameters

sender
The source of the event.
e
An AreaEventArgs object that contains the event data.

 Example

The following code example demonstrates how to handle the Click event to recognize which bar in a chart is clicked: 

C#  Copy Code

 protected void BarChart1_Click(object sender, MindFusion.Charting.WebForms.Chart.AreaEventArgs e)
    {
        //check the selected index
        if (e.AreaIndex == 0)
        {
            //write the clicked index in the session object
            Page.Session["index"] = "0";
         }
         //if second bar is clicked
        else if (e.AreaIndex == 1)
        {
            //write the clicked index in the session object
            Page.Session["index"] = "1";
         }
      .......

        //redirect
        Response.Redirect("PieChart.aspx");
    }

Visual Basic  Copy Code

 Protected Sub BarChart1_Click(ByVal sender As Object, ByVal e As MindFusion.Charting.WebForms.Chart.AreaEventArgs)
        'check the selected index
        If (e.AreaIndex = 0) Then
            'write the clicked index in the session object
            Page.Session("index") = "0"
        End If
        'if second bar is clicked
        If (e.AreaIndex = 1) Then
            'write the clicked index in the session object
            Page.Session("index") = "1"
        End If
        'redirect
        Response.Redirect("PieChart.aspx")
    End Sub

 See Also