[]
        
(Showing Draft Content)

IDataLabels

Interface IDataLabels

All Superinterfaces:
Iterable<IDataLabel>

public interface IDataLabels extends Iterable<IDataLabel>
Represents a collection of all IDataLabel objects for a series.

Each IDataLabel object represents the data label for a point or trendline. For a series without definable points, such as an area series, the collection contains a single data label.

You can use this collection to configure label display settings for the entire series and to access individual data labels.


 worksheet.getRange("A1:B3").setValue(new Object[][] {
     {"Name", "Value"},
     {"A", 10},
     {"B", 20}
 });
 IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("D1:H8")).getChart();
 chart.setSourceData(worksheet.getRange("A1:B3"));
 IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
 dataLabels.setShowValue(true);
 
  • Method Details

    • getAutoText

      boolean getAutoText()
      Gets whether the data labels automatically generate text based on their current context.

      When this property is true, the label text is generated from the chart data and data label settings. When it is false, the labels use 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);
       IDataLabels dataLabels = series.getDataLabels();
       boolean autoText = dataLabels.getAutoText();
       
      Returns:
      true if the data labels automatically generate text based on context; otherwise, false.
    • setAutoText

      void setAutoText(boolean value)
      Sets whether the data labels automatically generate text based on their current context.

      When this property is true, the label text is generated from the chart data and data label settings. When it is false, the labels use 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);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setAutoText(true);
       
      Parameters:
      value - true if the data labels automatically generate text based on context; otherwise, false.
    • getCount

      int getCount()
      Gets the number of IDataLabel objects in the collection.

      This method returns the number of data labels for the current series. For a series without definable points, the collection can contain a single data label.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20},
           {"Mar", 15}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200);
       shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
       ISeries series = shape.getChart().getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       int count = series.getDataLabels().getCount();
       
      Returns:
      The number of objects in the collection.
    • getFont

      IFontFormat getFont()
      Gets the IFontFormat object for the data labels.

      Use the returned IFontFormat object to read or modify the font applied to the data label text for the 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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IFontFormat font = series.getDataLabels().getFont();
       font.setBold(true);
       
      Returns:
      The IFontFormat object for the data labels font.
    • getFormat

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

      Use the returned object to access fill, line, and other formatting settings that apply to the data labels of the series.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 10},
           {"B", 20}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220);
       shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns);
       ISeries series = shape.getChart().getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IChartFormat format = series.getDataLabels().getFormat();
       format.getFill().getColor().setRGB(Color.GetRed());
       
      Returns:
      The IChartFormat object that represents the formatting of the data labels.
    • getNumberFormat

      String getNumberFormat()
      Gets the number format code for the data labels.

      When the number format is linked to the source cells, the returned format code reflects the linked cell format. If no custom format code is available, this method returns "General".

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 1500}
       });
       worksheet.getRange("B2:B3").setNumberFormat("$#,##0");
       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);
       String numberFormat = series.getDataLabels().getNumberFormat();
       
      Returns:
      The number format code for the data labels. Returns "General" if no custom format code is available.
    • setNumberFormat

      void setNumberFormat(String value)
      Sets the number format code for the data labels.

      When the number format is linked to the source cells, the returned format code reflects the linked cell format. If no custom format code is available, this method Sets "General".

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 1200},
           {"Feb", 1500}
       });
       worksheet.getRange("B2:B3").setNumberFormat("$#,##0");
       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);
       series.getDataLabels().setNumberFormat("Sample");
       
      Parameters:
      value - The number format code for the data labels. Sets "General" if no custom format code is available.
    • getNumberFormatLinked

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

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

      
       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("A1:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       boolean linked = series.getDataLabels().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.

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

      
       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("A1:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       series.getDataLabels().setNumberFormatLinked(true);
       
      Parameters:
      value - true if the data label number format is linked to the source cells; otherwise, false.
    • getParent

      ISeries getParent()
      Gets the parent ISeries that contains this data labels collection.

      Use this method to access the series that owns the current data labels.

      
       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, true, true);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       ISeries parentSeries = series.getDataLabels().getParent();
       
      Returns:
      The parent ISeries of the data labels.
    • getPosition

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

      Use this method to determine how the data labels in the series are positioned relative to their chart elements.

      
       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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setPosition(DataLabelPosition.OutsideEnd);
       DataLabelPosition position = dataLabels.getPosition();
       
      Returns:
      The current DataLabelPosition of the data labels.
    • setPosition

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

      This property controls how the labels in the data label collection are placed relative to their data points.

      
       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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.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 labels display multiple elements, such as the series name and value.

      
       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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setShowSeriesName(true);
       dataLabels.setShowValue(true);
       dataLabels.setSeparator(" - ");
       String separator = dataLabels.getSeparator();
       
      Returns:
      The separator string used by the data labels. Returns null if no separator has been set or inherited.
    • 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 labels display multiple elements, such as the series name and value.

      
       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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setShowSeriesName(true);
       dataLabels.setShowValue(true);
       dataLabels.setSeparator(" - ");
       
      Parameters:
      value - The separator string used by the data labels. Sets null if no separator has been set or inherited.
    • getShowBubbleSize

      boolean getShowBubbleSize()
      Gets whether the bubble size is displayed in the data labels for the series.

      This property is typically used with bubble charts to control whether each data label includes the bubble size value.

      
       worksheet.getRange("A2:C5").setValue(new Object[][] {
           {"Sales", null, null},
           {125, 750, 3},
           {75, 875, 5},
           {175, 625, 6}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.Bubble, 250, 20, 360, 230);
       shape.getChart().getSeriesCollection().add(worksheet.getRange("A2:C5"), RowCol.Columns, true, true);
       ISeries series = shape.getChart().getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       series.getDataLabels().setShowBubbleSize(true);
       boolean showBubbleSize = series.getDataLabels().getShowBubbleSize();
       
      Returns:
      true if the bubble size is displayed in the data labels; otherwise, false.
    • setShowBubbleSize

      void setShowBubbleSize(boolean value)
      Sets whether the bubble size is displayed in the data labels for the series.

      This property is typically used with bubble charts to control whether each data label includes the bubble size value.

      
       worksheet.getRange("A2:C5").setValue(new Object[][] {
           {"Sales", null, null},
           {125, 750, 3},
           {75, 875, 5},
           {175, 625, 6}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.Bubble, 250, 20, 360, 230);
       shape.getChart().getSeriesCollection().add(worksheet.getRange("A2:C5"), RowCol.Columns, true, true);
       ISeries series = shape.getChart().getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       series.getDataLabels().setShowBubbleSize(true);
       
      Parameters:
      value - true if the bubble size is displayed in the data labels; otherwise, false.
    • getShowCategoryName

      boolean getShowCategoryName()
      Gets whether the category name is displayed in the data labels for the series.

      When this property is true, each data label can display the category name from the associated chart data.

      
       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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowCategoryName(true);
       boolean showCategoryName = dataLabels.getShowCategoryName();
       
      Returns:
      true if the category name is displayed in the data labels; otherwise, false.
    • setShowCategoryName

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

      When this property is true, each data label can display the category name from the associated chart data.

      
       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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowCategoryName(true);
       
      Parameters:
      value - true if the category name is displayed in the data labels; otherwise, false.
    • getShowLegendKey

      boolean getShowLegendKey()
      Gets whether legend keys are displayed in the data labels.

      When this property is true, each data label can display the legend key for its 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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowLegendKey(true);
       boolean showLegendKey = dataLabels.getShowLegendKey();
       
      Returns:
      true if legend keys are displayed in the data labels; otherwise, false.
    • setShowLegendKey

      void setShowLegendKey(boolean value)
      Sets whether legend keys are displayed in the data labels.

      When this property is true, each data label can display the legend key for its 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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowLegendKey(true);
       
      Parameters:
      value - true if legend keys are displayed in the data labels; otherwise, false.
    • getShowPercentage

      boolean getShowPercentage()
      Gets whether percentage values are displayed in the data labels.

      Use this property to determine whether the data labels for the series are configured to show percentage values.

      
       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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       boolean showPercentage = dataLabels.getShowPercentage();
       
      Returns:
      true if percentage values are displayed in the data labels; otherwise, false.
    • setShowPercentage

      void setShowPercentage(boolean value)
      Sets whether percentage values are displayed in the data labels.

      Set this property to true to show percentage values in the data labels, or false to hide them.

      
       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"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowPercentage(true);
       
      Parameters:
      value - true if percentage values are displayed in the data labels; otherwise, false.
    • getShowSeriesName

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

      This property determines whether the name of the associated series is shown for the data labels on the chart 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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setShowSeriesName(true);
       boolean showSeriesName = dataLabels.getShowSeriesName();
       
      Returns:
      true if the series name is displayed in the data labels; otherwise, false.
    • setShowSeriesName

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

      This property determines whether the name of the associated series is shown for the data labels on the chart 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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setShowSeriesName(true);
       
      Parameters:
      value - true if the series name is displayed in the data labels; otherwise, false.
    • getShowValue

      boolean getShowValue()
      Gets whether the data labels display the values of their associated chart points.

      When this property is true, the data labels show the point values. When it is false, the values are 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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setShowValue(true);
       boolean showValue = dataLabels.getShowValue();
       
      Returns:
      true if the data labels display values; otherwise, false.
    • setShowValue

      void setShowValue(boolean value)
      Sets whether the data labels display the values of their associated chart points.

      When this property is true, the data labels show the point values. When it is false, the values are 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"));
       IDataLabels dataLabels = chart.getSeriesCollection().get(0).getDataLabels();
       dataLabels.setShowValue(true);
       
      Parameters:
      value - true if the data labels display values; otherwise, false.
    • getShowLeaderLines

      boolean getShowLeaderLines()
      Gets whether leader lines are displayed for the data labels.

      Leader lines connect data labels to their corresponding data points when the labels are positioned away from the series.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Value"},
           {"A", 30},
           {"B", 20},
           {"C", 50}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowLeaderLines(true);
       boolean showLeaderLines = dataLabels.getShowLeaderLines();
       
      Returns:
      true if leader lines are displayed for the data labels; otherwise, false.
    • setShowLeaderLines

      void setShowLeaderLines(boolean value)
      Sets whether leader lines are displayed for the data labels.

      Leader lines connect data labels to their corresponding data points when the labels are positioned away from the series.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Value"},
           {"A", 30},
           {"B", 20},
           {"C", 50}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowLeaderLines(true);
       
      Parameters:
      value - true if leader lines are displayed for the data labels; otherwise, false.
    • getLeaderLines

      IChartLines getLeaderLines()
      Gets the leader lines for the data labels.

      Use the returned IChartLines object to access or modify the formatting of the leader lines associated with the data labels.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Value"},
           {"A", 30},
           {"B", 20},
           {"C", 50}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setShowLeaderLines(true);
       IChartLines leaderLines = dataLabels.getLeaderLines();
       IChartFormat format = leaderLines.getFormat();
       
      Returns:
      The IChartLines object that represents the leader lines for the data labels.
    • get

      IDataLabel get(int index)
      Gets a single IDataLabel object from the collection by index.

      Use this method to access an individual data label in the data labels collection for a series.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 15},
           {"Mar", 12}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       IDataLabel dataLabel = series.getDataLabels().get(0);
       
      Parameters:
      index - The zero-based index of the data label in the collection.
      Returns:
      The IDataLabel object at the specified index.
    • getOrientation

      int getOrientation()
      Gets the text orientation.

      Use this method to retrieve the current rotation angle applied to the data label text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Item", "Sales"},
           {"Tea", 10},
           {"Coffee", 20}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 200, 100, 300, 300);
       IChart chart = shape.getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       series.getDataLabels().setOrientation(45);
       int orientation = series.getDataLabels().getOrientation();
       
      Returns:
      The current text orientation of the data labels, in degrees.
    • setOrientation

      void setOrientation(int value)
      Sets the text orientation.

      Use this method to set the rotation angle applied to the data label text.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Item", "Sales"},
           {"Tea", 10},
           {"Coffee", 20}
       });
       IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 200, 100, 300, 300);
       IChart chart = shape.getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       ISeries series = chart.getSeriesCollection().get(0);
       series.setHasDataLabels(true);
       series.getDataLabels().setOrientation(45);
       
      Parameters:
      value - The current text orientation of the data labels, in degrees.
    • getDirection

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

      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);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setDirection(TextDirection.Vertical);
       TextDirection direction = dataLabels.getDirection();
       
      Returns:
      The TextDirection value that specifies the text direction of the data labels.
    • setDirection

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

      Use this method to display the text in the data labels with a 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);
       IDataLabels dataLabels = series.getDataLabels();
       dataLabels.setDirection(TextDirection.Vertical);
       
      Parameters:
      value - The TextDirection value to apply to the data label text.