ChartDataLabelCollectionNumberFormat Property

Gets an ChartNumberFormat instance allowing to set number format for the data labels of the entire series.

Namespace:  Aspose.Words.Drawing.Charts
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public ChartNumberFormat NumberFormat { get; }

Property Value

Type: ChartNumberFormat
Examples
Shows how to set number format for the data labels of the entire series.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Add chart with default data
Shape shape = builder.InsertChart(ChartType.Line, 432, 252);
// Delete default generated series
shape.Chart.Series.Clear();

ChartSeries series =
    shape.Chart.Series.Add("Aspose Test Series", new[] { "Word", "PDF", "Excel" }, new[] { 2.5, 1.5, 3.5 });

ChartDataLabelCollection dataLabels = series.DataLabels;
// Display chart values in the data labels, by default it is false
dataLabels.ShowValue = true;
// Set currency format for the data labels of the entire series
dataLabels.NumberFormat.FormatCode = "\"$\"#,##0.00";

doc.Save(ArtifactsDir + "Charts.DefineNumberFormatForDataLabels.docx");
See Also