Share via


ChartSheet.SeriesChange Event (2007 System)

Occurs when the value of a Microsoft.Office.Tools.Excel.ChartSheet data point is changed.

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

Syntax

'Declaration
Public Event SeriesChange As ChartEvents_SeriesChangeEventHandler
'Usage
Dim instance As ChartSheet 
Dim handler As ChartEvents_SeriesChangeEventHandler 

AddHandler instance.SeriesChange, handler
public event ChartEvents_SeriesChangeEventHandler SeriesChange
public:
 event ChartEvents_SeriesChangeEventHandler^ SeriesChange {
    void add (ChartEvents_SeriesChangeEventHandler^ value);
    void remove (ChartEvents_SeriesChangeEventHandler^ value);
}
JScript does not support events.

Examples

The following code example demonstrates a handler for the SeriesChange event that sets a point's border color to green when a data point of the current Microsoft.Office.Tools.Excel.ChartSheet is changed.

Private Sub ChangePointColorWhenSeriesChange()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ChartType = Excel.XlChartType.xl3DColumn
End Sub 

Sub ChartSheet1_SeriesChange(ByVal SeriesIndex As Integer, _
    ByVal PointIndex As Integer) Handles Me.SeriesChange

    Dim series1 As Excel.Series = _
        CType(Me.SeriesCollection(SeriesIndex), Excel.Series)
    Dim point1 As Excel.Point = _
        CType(series1.Points(PointIndex), Excel.Point)

    point1.Border.Color = _
            ColorTranslator.ToOle(Color.Green)
End Sub
private void ChangePointColorWhenSeriesChange()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ChartType = Excel.XlChartType.xl3DColumn;

    this.SeriesChange +=
        new Excel.ChartEvents_SeriesChangeEventHandler(
        ChartSheet1_SeriesChange);
}

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

    point1.Border.Color =
        ColorTranslator.ToOle(Color.Green);
}

.NET Framework Security

See Also

Reference

ChartSheet Class

ChartSheet Members

Microsoft.Office.Tools.Excel Namespace