CopyFormat

ChartDataPointCollection.CopyFormat method

Kopiert das Format vom Quelldatenpunkt zum Zieldatenpunkt.

public void CopyFormat(int sourceIndex, int destinationIndex)

Beispiele

Zeigt, wie das Datenpunktformat kopiert wird.

Document doc = new Document(MyDir + "DataPoint format.docx");

// Holen Sie sich das Diagramm und die Reihe, um das Format zu aktualisieren.
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
ChartSeries series = shape.Chart.Series[0];
ChartDataPointCollection dataPoints = series.DataPoints;

Assert.IsTrue(dataPoints.HasDefaultFormat(0));
Assert.IsFalse(dataPoints.HasDefaultFormat(1));

// Kopiere das Format des Datenpunkts mit Index 1 in den Datenpunkt mit Index 2
// sodass Datenpunkt 2 genauso aussieht wie Datenpunkt 1.
dataPoints.CopyFormat(0, 1);

Assert.IsTrue(dataPoints.HasDefaultFormat(0));
Assert.IsTrue(dataPoints.HasDefaultFormat(1));

// Kopiere das Format des Datenpunkts mit Index 0 in die Serienvorgaben, sodass alle Datenpunkte
// in der Reihe mit dem Standardformat sehen sie genauso aus wie der Datenpunkt 0.
series.CopyFormatFrom(1);

Assert.IsTrue(dataPoints.HasDefaultFormat(0));
Assert.IsTrue(dataPoints.HasDefaultFormat(1));

doc.Save(ArtifactsDir + "Charts.CopyDataPointFormat.docx");

Siehe auch