[]
        
(Showing Draft Content)

IDataLabel

Interface IDataLabel


public interface IDataLabel
Represents the data label on a chart point or trendline.

Use this interface to configure the text content, position, number format, and visual formatting of a chart data label. An IDataLabel can be obtained from a chart point or from a trendline equation label. The parent returned by getParent() can therefore be an IPoint or an ITrendline.


 worksheet.getRange("A1:B4").setValue(new Object[][] {
     {null, "Sales"}, {"Q1", 12}, {"Q2", 18}, {"Q3", 15}
 });
 IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 230);
 shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
 ISeries series = shape.getChart().getSeriesCollection().get(0);
 series.setHasDataLabels(true);
 IDataLabel dataLabel = series.getPoints().get(1).getDataLabel();
 dataLabel.setShowValue(true);
 
  • Method Details

    • getAutoText

      boolean getAutoText()
      Gets whether the object automatically generates text based on its current context.

      When this property is true, the data label text is generated from the chart data and label settings. When it is false, the label uses explicitly assigned text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       boolean autoText = dataLabel.getAutoText();
       
      Returns:
      true if the object automatically generates text based on context; otherwise, false.
    • setAutoText

      void setAutoText(boolean value)
      Sets whether the object automatically generates text based on its current context.

      When this property is true, the data label text is generated from the chart data and label settings. When it is false, the label uses explicitly assigned text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setAutoText(true);
       
      Parameters:
      value - true if the object automatically generates text based on context; otherwise, false.
    • getFont

      IFontFormat getFont()
      Gets the IFontFormat object that represents the font settings of the data label.

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

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       IFontFormat font = dataLabel.getFont();
       font.setBold(true);
       
      Returns:
      The IFontFormat object for the data label font.
    • getFormat

      IChartFormat getFormat()
      Gets the IChartFormat object for the data label.

      Use the returned IChartFormat object to access or modify the fill and line formatting applied to the data label.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       IChartFormat format = dataLabel.getFormat();
       format.getFill().getColor().setRGB(Color.GetRed());
       
      Returns:
      The IChartFormat object for the data label.
    • getNumberFormat

      String getNumberFormat()
      Gets the number format code used by the data label.

      This method returns the format code currently applied to the label value. If the label does not define its own number format, it can use the inherited format from its parent data labels. When no custom format is available, this method returns "General".

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setNumberFormat("$#,##0.00");
       String numberFormat = dataLabel.getNumberFormat();
       
      Returns:
      The number format code of the data label. Returns "General" if no custom number format is applied.
    • setNumberFormat

      void setNumberFormat(String value)
      Sets the number format code used by the data label.

      This method Sets the format code currently applied to the label value. If the label does not define its own number format, it can use the inherited format from its parent data labels. When no custom format is available, this method Sets "General".

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setNumberFormat("$#,##0.00");
       
      Parameters:
      value - The number format code of the data label. Sets "General" if no custom number format is applied.
    • getNumberFormatLinked

      boolean getNumberFormatLinked()
      Gets whether the data label number format is linked to the source cells.

      If this property is true, changes to the number format in the source cells are reflected in the data label.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 1500},
           {"Mar", 1100}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("B2:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setNumberFormatLinked(false);
       boolean linked = dataLabel.getNumberFormatLinked();
       
      Returns:
      true if the data label number format is linked to the source cells; otherwise, false.
    • setNumberFormatLinked

      void setNumberFormatLinked(boolean value)
      Sets whether the data label number format is linked to the source cells.

      If this property is true, changes to the number format in the source cells are reflected in the data label.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 1500},
           {"Mar", 1100}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("B2:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setNumberFormatLinked(false);
       
      Parameters:
      value - true if the data label number format is linked to the source cells; otherwise, false.
    • getParent

      Object getParent()
      Gets the parent object of the data label.

      The returned object can be a IPoint or an ITrendline, depending on whether the data label belongs to a chart point or a trendline. Starting with version 7.0.0, this method returns Object instead of IPoint.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns);
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       Object parent = dataLabel.getParent();
       
      Returns:
      The parent object of the data label. The returned value can be an IPoint or an ITrendline.
    • getPosition

      DataLabelPosition getPosition()
      Gets the position of the data label.

      Use this method to determine how the current data label is positioned relative to its chart point or series element.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setPosition(DataLabelPosition.OutsideEnd);
       DataLabelPosition position = dataLabel.getPosition();
       
      Returns:
      The current DataLabelPosition of the data label.
    • setPosition

      void setPosition(DataLabelPosition value)
      Sets the position of the data label.

      Use a DataLabelPosition value to control where the data label is displayed relative to the chart point.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Quarter", "Sales"},
           {"Q1", 10},
           {"Q2", 18},
           {"Q3", 14}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
       ISeries series = chart.getSeriesCollection().get(0);
       series.getDataLabels().setPosition(DataLabelPosition.Center);
       series.getPoints().get(0).setHasDataLabel(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setPosition(DataLabelPosition.OutsideEnd);
       
      Parameters:
      value - The data label position.
    • getSeparator

      String getSeparator()
      Gets the separator used between parts of the data label text on a chart.

      This separator is used when the data label displays multiple elements, such as the series name, category name, value, or percentage.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Month", "Sales"}, {"Jan", 12}, {"Feb", 18}, {"Mar", 15}});
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setSeparator(" - ");
       String separator = dataLabel.getSeparator();
       
      Returns:
      The separator string used by the data label. Returns null if no separator has been specified.
    • setSeparator

      void setSeparator(String value)
      Sets the separator used between parts of the data label text on a chart.

      This separator is used when the data label displays multiple elements, such as the series name, category name, value, or percentage.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Month", "Sales"}, {"Jan", 12}, {"Feb", 18}, {"Mar", 15}});
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setSeparator(" - ");
       
      Parameters:
      value - The separator string used by the data label. Sets null if no separator has been specified.
    • getShowBubbleSize

      boolean getShowBubbleSize()
      Gets whether the data label displays the bubble size.

      This property applies to data labels on bubble charts.

      
       worksheet.getRange("A1:C3").setValue(new Object[][] {
           {1, 10, 5},
           {2, 20, 8},
           {3, 15, 6}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Bubble, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getDataLabels().get(0);
       dataLabel.setShowBubbleSize(true);
       boolean showBubbleSize = dataLabel.getShowBubbleSize();
       
      Returns:
      true if the data label displays the bubble size; otherwise, false.
    • setShowBubbleSize

      void setShowBubbleSize(boolean value)
      Sets whether the data label displays the bubble size.

      This property applies to data labels on bubble charts.

      
       worksheet.getRange("A1:C3").setValue(new Object[][] {
           {1, 10, 5},
           {2, 20, 8},
           {3, 15, 6}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Bubble, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getDataLabels().get(0);
       dataLabel.setShowBubbleSize(true);
       
      Parameters:
      value - true if the data label displays the bubble size; otherwise, false.
    • getShowCategoryName

      boolean getShowCategoryName()
      Gets whether the category name is displayed in the data label.

      If this method returns true, the data label shows the category name for the associated chart point. If it returns false, the category name is hidden.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       boolean showCategoryName = dataLabel.getShowCategoryName();
       
      Returns:
      true if the category name is displayed in the data label; otherwise, false.
    • setShowCategoryName

      void setShowCategoryName(boolean value)
      Sets whether the category name is displayed in the data label.

      If value is true, the data label shows the category name for the associated chart point. If value is false, the category name is hidden.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setShowCategoryName(true);
       
      Parameters:
      value - true if the category name is displayed in the data label; otherwise, false.
    • getShowLegendKey

      boolean getShowLegendKey()
      Gets whether the data label legend key is visible.

      If this setting is not defined directly on the data label, the value can be inherited from its parent label settings.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 12},
           {"Feb", 18},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowLegendKey(true);
       boolean showLegendKey = dataLabel.getShowLegendKey();
       
      Returns:
      true if the data label legend key is visible; otherwise, false.
    • setShowLegendKey

      void setShowLegendKey(boolean value)
      Sets whether the data label legend key is visible.

      If this setting is not defined directly on the data label, the value can be inherited from its parent label settings.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 12},
           {"Feb", 18},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowLegendKey(true);
       
      Parameters:
      value - true if the data label legend key is visible; otherwise, false.
    • getShowPercentage

      boolean getShowPercentage()
      Gets whether the percentage value is displayed in the data label.

      If this setting is not defined directly on the data label, the value can be inherited from its parent label settings.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Value"},
           {"A", 10},
           {"B", 20},
           {"C", 30}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       boolean showPercentage = dataLabel.getShowPercentage();
       
      Returns:
      true if the percentage value is displayed in the data label; otherwise, false.
    • setShowPercentage

      void setShowPercentage(boolean value)
      Sets whether the percentage value is displayed in the data label.

      If this setting is not defined directly on the data label, the value can be inherited from its parent label settings.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Value"},
           {"A", 10},
           {"B", 20},
           {"C", 30}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowPercentage(true);
       
      Parameters:
      value - true if the percentage value is displayed in the data label; otherwise, false.
    • getShowSeriesName

      boolean getShowSeriesName()
      Gets whether the series name is displayed in the data label.

      Use this property to determine whether the data label shows the name of the associated series.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 12},
           {"Feb", 18},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowSeriesName(true);
       boolean showSeriesName = dataLabel.getShowSeriesName();
       
      Returns:
      true if the series name is displayed in the data label; otherwise, false.
    • setShowSeriesName

      void setShowSeriesName(boolean value)
      Sets whether the series name is displayed in the data label.

      Set this property to true to show the name of the associated series in the data label, or false to hide it.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 12},
           {"Feb", 18},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowSeriesName(true);
       
      Parameters:
      value - true if the series name is displayed in the data label; otherwise, false.
    • getShowValue

      boolean getShowValue()
      Gets whether the data label displays the value of its associated chart point or trendline.

      When this property is true, the data label shows the value. When it is false, the value is hidden.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 12},
           {"Feb", 18},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowValue(true);
       boolean showValue = dataLabel.getShowValue();
       
      Returns:
      true if the data label displays the value; otherwise, false.
    • setShowValue

      void setShowValue(boolean value)
      Sets whether the data label displays the value of its associated chart point or trendline.

      When this property is true, the data label shows the value. When it is false, the value is hidden.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 12},
           {"Feb", 18},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getPoints().get(0).getDataLabel();
       dataLabel.setShowValue(true);
       
      Parameters:
      value - true if the data label displays the value; otherwise, false.
    • getText

      String getText()
      Gets the text of the data label.

      Returns the current text displayed by the data label. If the data label uses automatic text, this method returns the generated label text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 10},
           {"B", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getDataLabels().get(0);
       String text = dataLabel.getText();
       
      Returns:
      The text of the data label.
    • setText

      void setText(String value)
      Sets the text of the data label.

      Sets the current text displayed by the data label. If the data label uses automatic text, this method Sets the generated label text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 10},
           {"B", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       IDataLabel dataLabel = chart.getSeriesCollection().get(0).getDataLabels().get(0);
       dataLabel.setText("Sample");
       
      Parameters:
      value - The text of the data label.
    • getOrientation

      int getOrientation()
      Gets the text orientation of the data label.

      The returned value is the rotation angle of the data label text, in degrees.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 10},
           {"B", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IPoint point = series.getPoints().get(0);
       point.setHasDataLabel(true);
       IDataLabel dataLabel = point.getDataLabel();
       dataLabel.setText("Q1");
       dataLabel.setOrientation(45);
       int orientation = dataLabel.getOrientation();
       
      Returns:
      The text orientation of the data label, in degrees.
    • setOrientation

      void setOrientation(int value)
      Sets the text orientation of the data label.

      Set this property to specify the rotation angle of the data label text, in degrees.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IPoint point = series.getPoints().get(0);
       point.setHasDataLabel(true);
       IDataLabel dataLabel = point.getDataLabel();
       dataLabel.setText("Q1");
       dataLabel.setOrientation(45);
       
      Parameters:
      value - The text orientation of the data label, in degrees.
    • getDirection

      TextDirection getDirection()
      Gets the text direction of the data label.

      Use this method to determine how the data label text is oriented, such as horizontal, vertical, or rotated layout.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setDirection(TextDirection.Vertical);
       TextDirection direction = dataLabel.getDirection();
       
      Returns:
      The TextDirection value that specifies the text direction of the data label.
    • setDirection

      void setDirection(TextDirection value)
      Sets the text direction of the data label.

      Use this method to control how the data label text is displayed, such as horizontal or vertical layout.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       dataLabel.setDirection(TextDirection.Vertical);
       
      Parameters:
      value - The TextDirection value to apply to the data label text.
    • getTextFrame

      ITextFrame getTextFrame()
      Gets the ITextFrame object that contains the text and font style properties of the data label.

      Use the returned ITextFrame object to access or modify the text content and text formatting of the data label.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(0).getDataLabel();
       ITextFrame textFrame = dataLabel.getTextFrame();
       textFrame.getTextRange().setText("Jan: 10");
       
      Returns:
      The ITextFrame object for the data label text.
    • delete

      void delete()
      Deletes this data label.

      Removes the data label from its parent chart point or trendline.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20},
           {"Mar", 15}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 230);
       shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
       ISeries series = shape.getChart().getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getPoints().get(1).getDataLabel();
       dataLabel.delete();