ChartClickEventArgs
Namespace: Wisej.Web.Ext.ChartJS3
Assembly: Wisej.Web.Ext.ChartJS3 (4.1.0.0)
Provides data for the ChartClick event of the ChartJS3 control.
- C#
- VB.NET
public class ChartClickEventArgs : EventArgs
Public Class ChartClickEventArgs
Inherits EventArgs
The arrays DataSets, DataPoints and Values have the same length: the element at the same index in each array describes one chart element under the click point.
Example:
private void chartJS31_ChartClick(object sender, ChartClickEventArgs e)
{
for (int i = 0; i < e.DataSets.Length; i++)
{
string label = this.chartJS31.Labels[e.DataPoints[i]];
this.listBox1.Items.Add($"{e.DataSets[i].Label} / {label} = {e.Values[i]}");
}
}
Properties
DataPoints
Int32[]: Returns the indexes of the data points in the click radius.
Value: An array of zero-based indexes into the Data array of the corresponding data set, which is also the index of the matching label in Labels.
Example:
private void chartJS31_ChartClick(object sender, ChartClickEventArgs e)
{
int index = e.DataPoints[0];
this.labelMonth.Text = this.chartJS31.Labels[index];
}
DataSets
DataSet[]: Returns the data sets in the click radius.
Value: An array of DataSet objects from DataSets, one for each chart element under the click point. The same data set appears more than once when more than one of its data points is under the click point.
Example:
private void chartJS31_ChartClick(object sender, ChartClickEventArgs e)
{
// toggle the clicked data set.
var dataSet = e.DataSets[0];
dataSet.Hidden = !dataSet.Hidden;
this.chartJS31.Update();
}
Values
Object[]: Returns the values of the data points in the click radius.
Value: An array of objects. Each element is the value taken from the Data array of the data set at the same index in DataSets, at the position at the same index in DataPoints.
Example:
private void chartJS31_ChartClick(object sender, ChartClickEventArgs e)
{
var total = e.Values.Sum(v => Convert.ToDouble(v));
AlertBox.Show("Total: " + total);
}
Used By
| Name | Description |
|---|---|
| ChartClickEventHandler | Represents the method that will handle the ChartClick event in a ChartJS3. |