Free Support Forum - aspose.com

Where is the class com.aspose.cells.DataLabel?

com.aspose.cells.DataLabels' doc states:
Encapsulates a collection of all the DataLabel objects for the specified ASeries.

The developer guide says:
DataLabels, represents a collection of all the DataLabel objects for the specified ASeries

But I can't find a method to get each label, also there's no class DataLabel at all.

Overall I have difficulties to set properties for data labels, such as color, label elements shown a.o., which simply do not work.
But firstly I want to debug the settings of each and every single label.
How is the connection between a chart's legend entry's formatting properties the similarly named for a Labels-object?

Jens

Hi Jens,

Well, DataLabels is a class and not the collection, we will fix its description in the JavaDoc soon.
Commonly you may use DataLabels to specify the whole series options e.g
DataLabels dataLabels = series.getDataLabels();
dataLabels.setCategoryNameShown(true);
dataLabels.setValueShown(true);
dataLabels.setSeriesShown(true);
dataLabels.setNumber(14);

If you need to set format a specific datalabel, you got to get the particular chart point of the data label.
And, if you want to set datalabels for all the points of a series, you can get the DataLabels of the series and set it straight away.

For a particular data point in the series to be formatted, see the code:
//Set the second point in a series to red colored
series.getChartPoints().getChartPoint(1).getArea().setForeGroundColor(Color.RED);

and don’t forget to make the area visible first:

series.getChartPoints().getChartPoint(1).getArea().setVisible(true);


Thank you.

Hi,

thanks for the quick answer.
What I’m basically doing is to replicate formattings of given ASeries objects.
Now I get the areas shown appropriately, unless I replicate FillFormat objects.
In this case, the areas get blank.
First of all I noticed, that there is a aSeries.getFillType() but no setFillType() method. Why?
One can set it as property in Aspose for .Net.
What’s the difference between setting a foreground color in an Area and the colors in the related FillFormat?
Jens

Hi,

Please see the document on how to set FillFormat for your reference:
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/manipulating-designer-charts.html

Using fill format options you may set Texture, Pattern or Gradient effects where as foreground color only sets simple colors.

Thank you.