|
Arealayer label alignment |
Posted by senji on May-22-2011 21:17 |
|
I have a problem with a stacked AreaLayer with variable bar width and variable bar distance beween the bars based on the "XY Charts"/ "Variable Width Bar Charts" example.
When i try to show the y-values in every part of the stacks, the values will be shown at the left and right borders instead of the middle. This effect i have with the setDataLabelStyle(DataSet) and setDataLabelStyle(Layer).
Is there a any way to group the bar values to show the labels in the middle ? or do i need to create a second bar above the first ? How does it work ?
Thanks in advance,
senji |
Re: Arealayer label alignment |
Posted by Peter Kwan on May-24-2011 00:41 |
|
Hi senji,
Thanks for the screenshot. It helps a lot for me to understand the issue.
For your case, I think the easiest method is to add extra layers to show the labels.
As I am not sure of your programming language, I will use Java/C# in the followings to help explain the code.
In the "for" loop in the original sample code, you may add the following lines to configure the label position, format and font style:
ScatterLayer labelLayer = c.addScatterLayer(new double[] { (currentX + nextX) / 2 }, new double[] { data[i] }, "", Chart.SquareSymbol, 1, Chart.Transparent, Chart.Transparent);
labelLayer.setDataLabelFormat("{value|~,} EUR");
ChartDirector.TextBox t = labelLayer.setDataLabelStyle("Arial", 8, 0x000000);
t.setAlignment(Chart.Top);
Hope this can help.
Regards
Peter Kwan |
|