This documentation is archived and is not being maintained.

Chart.SeriesChange Event

 

Occurs when the value of a Chart control data point is changed.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

event ChartEvents_SeriesChangeEventHandler SeriesChange

The following code example creates a Chart with a handler for the SeriesChange event that sets a point's border color to green when a data point of the chart is changed.

Microsoft.Office.Tools.Excel.Chart seriesChart;

private void ChangePointColorWhenSeriesChange()
{
    this.Range["A1", "A5"].Value2 = 22;
    this.Range["B1", "B5"].Value2 = 55;

    seriesChart = this.Controls.AddChart(this.Range["D2", "H12"],
        "seriesChart");
    seriesChart.SetSourceData(this.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    seriesChart.ChartType = Excel.XlChartType.xl3DColumn;

    seriesChart.SeriesChange +=
        new Excel.ChartEvents_SeriesChangeEventHandler(
        seriesChart_SeriesChange);
}

void seriesChart_SeriesChange(int SeriesIndex, int PointIndex)
{
    Excel.Series series1 =
        (Excel.Series)seriesChart.SeriesCollection(SeriesIndex);
    Excel.Point point1 = (Excel.Point)series1.Points(PointIndex);

    point1.Border.Color =
        ColorTranslator.ToOle(Color.Green);
}
Return to top
Show: