[]
        
(Showing Draft Content)

IDisplayUnitLabel

Interface IDisplayUnitLabel


public interface IDisplayUnitLabel
Represents a unit label on a chart axis.

Use this interface to access and customize the label shown for an axis display unit, including its text, font, text frame, and chart formatting. An instance is typically obtained from IAxis.getDisplayUnitLabel() for a value axis.


 worksheet.getRange("A1:B3").setValue(new Object[][] {
     {"Month", "Sales"},
     {"Jan", 1200},
     {"Feb", 1800}
 });
 IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 220);
 shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
 IAxis valueAxis = shape.getChart().getAxes().item(AxisType.Value);
 valueAxis.setDisplayUnit(DisplayUnit.Hundreds);
 IDisplayUnitLabel displayUnitLabel = valueAxis.getDisplayUnitLabel();
 displayUnitLabel.setText("Hundreds");
 
  • Method Details

    • getParent

      IAxis getParent()
      Gets the parent axis of this display unit label.

      The returned IAxis object represents the axis that owns this display unit label.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IDisplayUnitLabel displayUnitLabel = axis.getDisplayUnitLabel();
       IAxis parentAxis = displayUnitLabel.getParent();
       
      Returns:
      The parent IAxis object that contains this display unit label.
    • getFont

      IFontFormat getFont()
      Gets the IFontFormat object that represents the font settings of this display unit label.

      Use the returned IFontFormat object to read or modify the font applied to the display unit label text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IFontFormat font = axis.getDisplayUnitLabel().getFont();
       font.setBold(true);
       
      Returns:
      The IFontFormat object for the display unit label font.
    • getFormat

      IChartFormat getFormat()
      Gets the IChartFormat object for this display unit label.

      Use the returned format object to access and modify the appearance of the display unit label, such as its fill and line formatting.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IDisplayUnitLabel displayUnitLabel = axis.getDisplayUnitLabel();
       IChartFormat format = displayUnitLabel.getFormat();
       format.getFill().getColor().setRGB(Color.GetBlue());
       
      Returns:
      The IChartFormat object for this display unit label.
    • getText

      String getText()
      Gets the text of this display unit label.

      Use this method to retrieve the current caption shown for the display unit label on an axis.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IDisplayUnitLabel displayUnitLabel = axis.getDisplayUnitLabel();
       displayUnitLabel.setText("Thousands");
       String text = displayUnitLabel.getText();
       
      Returns:
      The current text of this display unit label.
    • setText

      void setText(String value)
      Sets the text of this display unit label.

      Use this method to set or replace the caption shown for the display unit label on an axis.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IDisplayUnitLabel displayUnitLabel = axis.getDisplayUnitLabel();
       displayUnitLabel.setText("Thousands");
       
      Parameters:
      value - The current text of this display unit label.
    • getTextFrame

      ITextFrame getTextFrame()
      Gets the ITextFrame object for the display unit label.

      Use the returned ITextFrame object to access and modify the text content and font-related formatting of the display unit label.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IDisplayUnitLabel displayUnitLabel = axis.getDisplayUnitLabel();
       ITextFrame textFrame = displayUnitLabel.getTextFrame();
       textFrame.getTextRange().setText("Thousands");
       
      Returns:
      The ITextFrame object that contains the text and font style properties for the display unit label.
    • delete

      void delete()
      Deletes this display unit label from its parent axis.

      After this method is called, the display unit label is no longer shown on the axis.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 2400}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3")).getChart();
       IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
       axis.setDisplayUnit(DisplayUnit.Thousands);
       IDisplayUnitLabel displayUnitLabel = axis.getDisplayUnitLabel();
       displayUnitLabel.delete();