|
addCustomAggregateLabel for Stacked Barchart |
Posted by baldur on Apr-15-2016 23:23 |
|
Hello Supportteam,
i have a little Problem with a stacked barchart:
I add a aggregat label with "addCustomAggregateLabel".
Normally the aggregatlabel apears above the stacked bar.
If i have positive and negative values the aggregatlabel apears twice.
One label above and the other below the bar.
i really add the textbox only one time for each bargroup.
I tried three methods:
addCustomGroupLabel DataGroup, xCol, xFormatString
addCustomAggregateLabel xCol, xFormatString
and i found a "hidden" function in the forum:
addCustomDataLabel -DataGroup - 2, xCol, xFormatString
xCol contains the x-columnindex
xFormatString contains "T {totalvalue|.1}"
All three methods produce the same result.
The textbox apears twice.
How can i solve this problem?
My customer wonts only 1 textbox. |
Re: addCustomAggregateLabel for Stacked Barchart |
Posted by Peter Kwan on Apr-16-2016 12:59 |
|
Hi baldur,
Normally, the aggregate value of a stacked bar refers to the sum of all data values. For example, if the data values of the bar segments are 1, 2, 3, then the aggregate value is 6, and the entire stacked bar will be 6 units in length.
There is no well-accepted way to create a stacked bar if there are both positive and negative values. In ChartDirector, the stacked bar will be split into 2 stacked bars, one built using the positive values, and the other using the negative values. There will then be two aggregate values for the positive stacked bar and the negative stacked bar. So there will be two aggregate labels showing the two aggregate values for the two stacked bars.
If you using custom aggregate labels, ChartDirector will just replace the default label with the custom label, and there will still be two labels.
To display only one label, one method is to use a yZoneColor to make one of the labels transparent. It is like (in C#):
layer.addCustomAggregateLabel(i, "My Label", "arialbd.ttf", 8, layer.yZoneColor(0, Chart.Transparent, 0x000000));
Hope this can help.
Regards
Peter Kwan |
Re: addCustomAggregateLabel for Stacked Barchart |
Posted by baldur on Apr-17-2016 20:33 |
|
Sorry, but i don't understand this.
Even if you create automaticly 2 labels, 1 for positive, 1 for negativ, why are the values than the same?
For examle: the sum for positiive values is 103, for negativ is -3, ths chown totalvalue of both labels is 100.
And i don't understand your solution.
I'm sorry. |
Re: addCustomAggregateLabel for Stacked Barchart |
Posted by baldur on Apr-17-2016 21:05 |
|
So i tried this with the same result:
Set xTextBox = pSerie.Layer.setAggregateLabelStyle(fMarkFont.Filename, fMarkFont.Size * pFontfaktor, ToChartColor(fMarkFont.TextColor))
pSerie.Layer.setAggregateLabelFormat xFormatString
The Result is as follow (the same once more).
|
Re: addCustomAggregateLabel for Stacked Barchart |
Posted by Peter Kwan on Apr-19-2016 00:05 |
|
Hi baldur,
I have tried:
pSerie.Layer.setAggregateLabelFormat "{value}"
In my case, the labels at the positive and negative side are different, and reflects the aggregate value on each side respectively.
As there is only one aggregate label formatting specification for each bar position, if you use a text string specified by your code (like "ABC"), then the same text will be used on both sides. The method mentioned in my last message can be used to hide one of the labels.
Regards
Peter Kwan |
Re: addCustomAggregateLabel for Stacked Barchart |
Posted by baldur on Apr-19-2016 01:14 |
|
OK, thank you very much.
I think, the two labels now with each sum separated seams ok.
I will wait for our customer response. |
|