I try to implements in java with Aspose.Cell this:
ActiveSheet.ChartObjects("Grafico 2").Activate
axisTop = ActiveChart.Axes(2).Top
axisH = ActiveChart.Axes(2).Height
maxY = ActiveChart.Axes(2).MaximumScale
For j = 1 To ActiveChart.SeriesCollection.Count
For i = 1 To ActiveChart.SeriesCollection(j).Points.Count
ActiveChart.SeriesCollection(j).Points(i).DataLabel.Select
labelTop = ActiveChart.SeriesCollection(j).Points(i).DataLabel.Top + 10
value = ActiveChart.SeriesCollection(j).Points(i).DataLabel.Caption
fatt = axisH * value / maxY
Selection.Top = fatt / 2 + labelTop
Next i
Next j
In excel vba macro this code does what I need.
I have to move the value-label of histogram column from top to center of histogram,
It is possible in Aspose.Cell with java? Thanks and excuse me for my english.
Hi,
thanks for answer, but I have try to use what you suggest me but I retrieve always 0 values, ex:
int left = chart.getNSeries().get(0).getDataLabels().getX();
int top = chart.getNSeries().get(0).getDataLabels().getY();
int width = chart.getNSeries().get(0).getDataLabels().getWidth();
int height = chart.getNSeries().get(0).getDataLabels().getHeight();
the result is:
left = top = width =height = 0.
Instead if I use my macro in excel it work fine.
Then I need also to acces graphic-axis object to obtain height property to calculate the factor to use for this formula (axisH):
axisTop = ActiveChart.Axes(2).Top (not have)
axisH = ActiveChart.Axes(2).Height (not have)
MaxY = ActiveChart.Axes(2).MaximumScale (this I have)
For j = 1 To ActiveChart.SeriesCollection.Count
For i = 1 To ActiveChart.SeriesCollection(j).Points.Count
ActiveChart.SeriesCollection(j).Points(i).DataLabel.Select
tmpTop = ActiveChart.SeriesCollection(j).Points(i).DataLabel.Top + 10 (not have)
value = ActiveChart.SeriesCollection(j).Points(i).DataLabel.Caption (I have)
fatt = axisH * value / MaxY
Selection.Top = fatt / 2 + tmpTop
Next i
Next j
Please help me, I Have a finicky customer that wants a histogram with value column labels in the middle of 3d bar chart. Sigh! I can project my chart in excel and then set data from java-aspose code, but this is ok for graph with fixed x-axis value, I have some other with dynamic x-axis value. For now I can try to use vba-macro in excel but I must resolve problem to excute macro when user open the excel document, however I will prefer to do all in java-aspose code.
Thank.
Hi,
Please provide us your sample output xls/xlsx file which you can create manually and attach here. We will look into it and provide you a sample code. Please also help us with screenshots.
Also, some chart series do not let you position the labels so you have to use different type of chart in your series.
For help, please see this post: 335816 and see the red highlighted code. The code is in .NET but it will give you an idea how to place your labels at the desired position.
Report.xlsx is start file, I 'll wish to obtain ReportOut.xlsx through java-aspose.cell code.
I tried to use :
chart.getNSeries().get(0).getDataLabels().getX();
chart.getNSeries().get(0).getDataLabels().getY();
chart.getNSeries().get(0).getDataLabels().getWidth();
chart.getNSeries().get(0).getDataLabels().getHeight();
and.....
chart.getNSeries().get(0).getPoints().get(0).getDataLabels().getX();
chart.getNSeries().get(0).getPoints().get(0).getDataLabels().getY();
chart.getNSeries().get(0).getPoints().get(0).getDataLabels().getWidth();
chart.getNSeries().get(0).getPoints().get(0).getDataLabels().getHeight();
but I alway get zero as result
It seem that these methods are to be implemented, it is true?
I got my goal with an excel-vba-macro, but I seemed to understand that you can not execute a macro from java-aspose.cell code. However I would not use macros.
Thanks.
Hi,
I am afraid, Aspose.Cells does not support getting the position of the datalabels or axis at the moment. We will look into and try to provide you the supported version in 2 weeks time.
We have logged a ticket for your feature request with an id: CELLSJAVA-40019. Once we have any update, we will let you know.
Keep in touch.
Thanks for your quick reply.
I look forward to news...
Hi,
To update you further, I’m afraid the feature cannot be supported in the near future. The reason is to support setting customized position, we need to do a lot of adjustments accordingly and it might take some time to do it.
Thank you.
Hi,
We have now released our next official version Aspose.Cells for Java v7.2.0, so you should try it:
Thank you.