FormatCode
Contents
[
Hide
]BubbleSizeCollection.FormatCode property
Gets or sets the format code applied to the bubble sizes.
public string FormatCode { get; set; }
Remarks
Number formatting is used to change the way values appears in the chart. The examples of number formats:
Number - “#,##0.00”
Currency - “"$"#,##0.00”
Time - “[$-x-systime]h:mm:ss AM/PM”
Date - “d/mm/yyyy”
Percentage - “0.00%”
Fraction - “# ?/?”
Scientific - “0.00E+00”
Accounting - “-"$"* #,##0.00-;-"$"* #,##0.00_-;-"$"* "-"??-;-@-”
Custom with color - “[Red]-#,##0.0”
Examples
Shows how to work with the format code of the chart data.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a Bubble chart.
Shape shape = builder.InsertChart(ChartType.Bubble, 432, 252);
Chart chart = shape.Chart;
// Delete default generated series.
chart.Series.Clear();
ChartSeries series = chart.Series.Add(
"Series1",
new double[] { 1, 1.9, 2.45, 3 },
new double[] { 1, -0.9, 1.82, 0 },
new double[] { 2, 1.1, 2.95, 2 });
// Show data labels.
series.HasDataLabels = true;
series.DataLabels.ShowCategoryName = true;
series.DataLabels.ShowValue = true;
series.DataLabels.ShowBubbleSize = true;
// Set data format codes.
series.XValues.FormatCode = "#,##0.0#";
series.YValues.FormatCode = "#,##0.0#;[Red]\\-#,##0.0#";
series.BubbleSizes.FormatCode = "#,##0.0#";
doc.Save(ArtifactsDir + "Charts.FormatCode.docx");
See Also
- class BubbleSizeCollection
- namespace Aspose.Words.Drawing.Charts
- assembly Aspose.Words