public class DisplayUnitLabel extends ChartTextFrame
Example
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.getWorksheets().get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150);
//Adding a sample value to "A4" cell
worksheet.getCells().get("A4").putValue(200);
//Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50);
//Adding a sample value to "B4" cell
worksheet.getCells().get("B4").putValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.getCells().get("C1").putValue("Q1");
//Adding a sample value to "C2" cell as category data
worksheet.getCells().get("C2").putValue("Q2");
//Adding a sample value to "C3" cell as category data
worksheet.getCells().get("C3").putValue("Y1");
//Adding a sample value to "C4" cell as category data
worksheet.getCells().get("C4").putValue("Y2");
//Adding a chart to the worksheet
int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.getCharts().get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.getNSeries().add("A1:B4", true);
//Setting the data source for the category data of NSeries
chart.getNSeries().setCategoryData("C1:C4");
//Setting the display unit of value(Y) axis.
chart.getValueAxis().setDisplayUnit(DisplayUnitType.HUNDREDS);
DisplayUnitLabel displayUnitLabel = chart.getValueAxis().getDisplayUnitLabel();
//Setting the custom display unit label
displayUnitLabel.setText("100");
//Saving the Excel file
workbook.save("book1.xls");
| Modifier and Type | Method and Description |
|---|---|
boolean |
getAutoScaleFont()
True if the text in the object changes font size when the object size changes.
|
Font |
getFont()
Gets a
ChartArea.getFont() object of the specified ChartFrame object. |
java.lang.String |
getText()
Gets the text of display unit label.
|
void |
setAutoScaleFont(boolean value)
True if the text in the object changes font size when the object size changes.
|
void |
setText(java.lang.String value)
Sets the text of display unit label.
|
characters, getDirectionType, getLinkedSource, getReadingOrder, getRotationAngle, getTextDirection, getTextHorizontalAlignment, getTextVerticalAlignment, isAutomaticRotation, isAutoText, isDeleted, isResizeShapeToFitText, isTextWrapped, setAutoText, setDeleted, setDirectionType, setLinkedSource, setReadingOrder, setResizeShapeToFitText, setRotationAngle, setTextDirection, setTextHorizontalAlignment, setTextVerticalAlignment, setTextWrappedgetArea, getBackground, getBackgroundMode, getBorder, getChart, getDefaultHeight, getDefaultHeightRatioToChart, getDefaultWidth, getDefaultWidthRatioToChart, getDefaultX, getDefaultXRatioToChart, getDefaultY, getDefaultYRatioToChart, getHeight, getHeightPixel, getHeightRatioToChart, getShadow, getShapeProperties, getTextFont, getTextOptions, getWidth, getWidthPixel, getWidthRatioToChart, getX, getXPixel, getXRatioToChart, getY, getYPixel, getYRatioToChart, isAutomaticSize, isDefaultPosBeSet, isInnerMode, setAutomaticSize, setBackground, setBackgroundMode, setHeight, setHeightPixel, setHeightRatioToChart, setInnerMode, setPositionAuto, setShadow, setWidth, setWidthPixel, setWidthRatioToChart, setX, setXPixel, setXRatioToChart, setY, setYPixel, setYRatioToChartpublic java.lang.String getText()
getText in class ChartTextFramepublic void setText(java.lang.String value)
setText in class ChartTextFramepublic Font getFont()
ChartArea.getFont() object of the specified ChartFrame object.getFont in class ChartFramepublic boolean getAutoScaleFont()
getAutoScaleFont in class ChartFramepublic void setAutoScaleFont(boolean value)
setAutoScaleFont in class ChartFrameSee Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.