About DataLabels Area


#1

Hi !

I want to change the color and the font of my DataLabels but i can only setValueShown(true), the other functions do nothing… why ?

Here is the codes :
as=serieses.get(1);
as.setName(“Evolution A/A-1”);
DataLabels dl=as.getDataLabels();
dl.setValueShown(true);
dl.getBorder().setVisible(true);
dl.getArea().setAuto(true);
Font fo = new Font();
fo.setBold(true);
dl.setFont(fo);
as.getArea().setVisible(false);
as.getBorder().setVisible(false);

I let the result… it’s the down left chart. There are two ASeries and i want the second invisible (it’s ok for that) but i want to see boxes with the values …


#2

Hi,

Please try this fix.


#3

Hi,

Sorry but i have exactly the same result …!


#4

Hi,

In the old version. there is a bug when setting Datalabels of the series which index is not zero.

So you should dowload this version to fix this bug.


#5

Which version are you talking about ? I have 1.6.0.0 for Java and i replaced it by your fix and it doesn’t change anything… :frowning:


#6

Hi,

We upload the version 1.6.0.8,Release-Date: 2006.06.21.

In other version,the DataLabels of the second series can't be selected in the MS Excel and other settings for DataLabels will not effect.


#7

How to know if i have the version 1.6.0.8 ?


#8

Hi,

In the Aspose.Cells.jar/META-INF/MANIFEST.MF file,you can get the version id by searching the key word "version".


#9

Hi,

I have check my Version and i have the 1.6.0.8 release… but i still have the same problem …
Here is the code pour the first chart (down left) :

Charts charts = sheets.getCharts();
int index = charts.add(ChartType.COLUMN_CLUSTERED,ls+3,cols,ls+18,cols+3);
Chart chart = charts.getChart(index);

chart.getPlotArea().getArea().setForegroundColor(Color.WHITE);

ValueAxis valueAxis2 = chart.getSecondValueAxis();
valueAxis2.setMinValue(-5000);
valueAxis2.setMaxValue(5000);

chart.getValueAxis().getMajorGridLines().setVisible(false);


chart.getTextBoxes().addInChart(150,50,2500,350);
chart.getTextBoxes().get(0).setContent(“Parc roulant Renault VP+VU”);
chart.getTextBoxes().get(0).setHasLine(true);
Font f=new Font();
f.setBold(true);
f.setSize(12);
chart.getTextBoxes().get(0).setFont(f);

chart.setLegendShown(false);

PlotArea plotArea = chart.getPlotArea();
plotArea.setWidth(4000 - plotArea.getX() - 250);
plotArea.setY(700);
plotArea.setHeight(4000 - plotArea.getY() - 500);

NSeries serieses = chart.getNSeries();
serieses.add(“B5:B10”, true);
serieses.setCategoryData(“A5:A10”);
serieses.add(“C5:C10”, true);

ASeries as=serieses.get(0);
as.setName(b.getString(“Projection_2”));
excel.getPalette().setColor(50,new Color(255,152,153));
as.getArea().setForegroundColor(excel.getPalette().getColor(50));

as=serieses.get(1);
as.setName(b.getString(“Projection_3”));
DataLabels dl=as.getDataLabels();
dl.setValueShown(true);
dl.getBorder().setVisible(true);
dl.getArea().setForegroundColor(Color.WHITE);
dl.getArea().setBackgroundColor(Color.WHITE);
Font fo = new Font();
fo.setBold(true);
dl.setFont(fo);
as.getArea().setVisible(false);
as.getBorder().setVisible(false);


#10

Is it a bug ? I need to do that … it will be fix ?


#11

I will buy your API if i can do that… please i need a response … it’s hurry !


#12

Hi Steve,

Please try this fix.

The problem is caused by not assigning which series to the secondary value axis.

You should use series.setPlotOnSecondAxis method to assign a series to the secondary value axis.(See following code)

series.setPlotOnSecondAxis(true);

And if you don't assign, Aspose.Cells for Java will auto assign a series to the secondary value axis.


#13

Hi !

It’s ok !! Thanks !!