[]
An ILegendEntry identifies a single entry displayed in a chart legend. Use this interface to access the entry's font and chart formatting, or to remove the entry from the legend. Legend entries are available from the ILegendEntries collection returned by ILegend.getLegendEntries().
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Region", "Sales"},
{"North", 100},
{"South", 200}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 200, 20, 300, 200);
shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
ILegendEntry legendEntry = shape.getChart().getLegend().getLegendEntries().get(0);
legendEntry.getFont().setItalic(true);
voiddelete()getFont()IFontFormat object that represents the font settings of the legend entry.IFontFormat object that represents the font settings of the legend entry.Use the returned IFontFormat object to read or modify the font applied to the legend entry text.
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.setSourceData(worksheet.getRange("A1:B3"));
ILegendEntry legendEntry = chart.getLegend().getLegendEntries().get(0);
IFontFormat font = legendEntry.getFont();
font.setBold(true);
IFontFormat object for the legend entry font.Use the returned IChartFormat object to access and modify the fill, line, and other formatting settings of the legend entry.
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.setSourceData(worksheet.getRange("A1:B3"));
ILegendEntry legendEntry = chart.getLegend().getLegendEntries().get(0);
IChartFormat format = legendEntry.getFormat();
format.getFill().getColor().setRGB(Color.GetRed());
IChartFormat object that represents the formatting of the legend entry.
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"));
ILegendEntry legendEntry = chart.getLegend().getLegendEntries().get(0);
ILegend legend = legendEntry.getParent();
ILegend object that contains this legend entry.Use this method to mark the current legend entry as deleted.
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.setSourceData(worksheet.getRange("A1:B3"));
ILegendEntry legendEntry = chart.getLegend().getLegendEntries().get(0);
legendEntry.delete();