MindFusion.Charting Programmer's Guide

Chart.Click Event

See Also
 





Occurs when the chart is clicked.

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

 Syntax

C#  Copy Code

public event Chart.AreaClickHandler Click

Visual Basic  Copy Code

Public Event Click As Chart.AreaClickHandler

 Event Data

The AreaEventArgs class specifies the data for the event.

 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