Partilhar via


Evento Chart.SeriesChange (sistema de 2007)

Ocorre quando o valor de um Chart ponto de dados do controle é alterado.

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

Sintaxe

Public Event SeriesChange As ChartEvents_SeriesChangeEventHandler

Dim instance As Chart
Dim handler As ChartEvents_SeriesChangeEventHandler

AddHandler instance.SeriesChange, handler
public event ChartEvents_SeriesChangeEventHandler SeriesChange

Exemplos

O exemplo de código a seguir cria um Chart com um manipulador para o SeriesChange evento que define a cor da borda do ponto como verde quando um ponto de dados do gráfico é alterado.

WithEvents SeriesChart As Microsoft.Office.Tools.Excel.Chart

PrivateSub ChangePointColorWhenSeriesChange()
    Me.Range("A1", "A5").Value2 = 22
    Me.Range("B1", "B5").Value2 = 55

    SeriesChart = Me.Controls.AddChart(Me.Range("D2", "H12"), _
        "SeriesChart")
    SeriesChart.SetSourceData(Me.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    SeriesChart.ChartType = Excel.XlChartType.xl3DColumn
EndSubSub SeriesChart_SeriesChange(ByVal SeriesIndex AsInteger, _
    ByVal PointIndex AsInteger) Handles SeriesChart.SeriesChange

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

    point1.Border.Color = _
            ColorTranslator.ToOle(Color.Green)
EndSub
Microsoft.Office.Tools.Excel.Chart seriesChart;

privatevoid 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);
}

Permissões

Consulte também

Referência

Chart Classe

Membros Chart

Namespace Microsoft.Office.Tools.Excel