java.lang.Objectcom.aspose.words.ChartNumberFormat
public class ChartNumberFormat
Example:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert chart.
Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
Chart chart = shape.getChart();
// Clear demo data.
chart.getSeries().clear();
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{1900000.0, 850000.0, 2100000.0, 600000.0, 1500000.0});
// Set number format.
chart.getAxisY().getNumberFormat().setFormatCode("#,##0");
// Set this to override the above value and draw the number format from the source cell
Assert.assertFalse(chart.getAxisY().getNumberFormat().isLinkedToSource());
Property Getters/Setters Summary | ||
---|---|---|
java.lang.String | getFormatCode() | |
void | setFormatCode(java.lang.String value) | |
Gets or sets the format code applied to a data label. | ||
boolean | isLinkedToSource() | |
void | isLinkedToSource(boolean value) | |
Specifies whether the format code is linked to a source cell. Default is true. |
Property Getters/Setters Detail |
---|
getFormatCode/setFormatCode | |
public java.lang.String getFormatCode() / public void setFormatCode(java.lang.String value) |
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"
Text - "@"
Accounting - "_-\"$\"* #,##0.00_-;-\"$\"* #,##0.00_-;_-\"$\"* \"-\"??_-;_-@_-"
Custom with color - "[Red]-#,##0.0"
Example:
Shows how to set formatting for chart values.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert chart. Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0); Chart chart = shape.getChart(); // Clear demo data. chart.getSeries().clear(); chart.getSeries().add("Aspose Test Series", new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"}, new double[]{1900000.0, 850000.0, 2100000.0, 600000.0, 1500000.0}); // Set number format. chart.getAxisY().getNumberFormat().setFormatCode("#,##0"); // Set this to override the above value and draw the number format from the source cell Assert.assertFalse(chart.getAxisY().getNumberFormat().isLinkedToSource());
isLinkedToSource/isLinkedToSource | |
public boolean isLinkedToSource() / public void isLinkedToSource(boolean value) |
Example:
Shows how to set formatting for chart values.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert chart. Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0); Chart chart = shape.getChart(); // Clear demo data. chart.getSeries().clear(); chart.getSeries().add("Aspose Test Series", new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"}, new double[]{1900000.0, 850000.0, 2100000.0, 600000.0, 1500000.0}); // Set number format. chart.getAxisY().getNumberFormat().setFormatCode("#,##0"); // Set this to override the above value and draw the number format from the source cell Assert.assertFalse(chart.getAxisY().getNumberFormat().isLinkedToSource());