Hi,
We are using XamDataGrid with UnboundField. This UnboundField column contains XamDataChart with StackedBarSeries.
We have to show count/number in center of stacked bar series chart. We are able to do it using MarkerTemplate.
But if count is less eg. 2 the how to show it in center with tooltip for count? Is there any way to give LabelsPosition as "BestFit" available for RingSeries.
Please find attached POC and screenshot for reference
Hi Avinash,
I added a converter to your project that is used to adjust the Label's Margin if there is not enough space to display the marker text. If the area is too small then I adjust the Label Margin so that it displays on the right side of the divide making it visible.
Let me know if you have any questions.
Thank you for your reply.
Alignment for label is not consistent if we load new data. Please find attached poc. for reference
The markers for the StackedBarSeries are by default positioned at the right most edge of each bar fragment (the green and red bars are bar fragments), so positioning them is tricky because all you have to work with is the Margin. There might be an algorithm that can be used that will adjust the Margin accordingly but I don't currently have one for you. You can use a MultiBinding with an IMultiValueConverter on the Label Margin property and pass the converter your pass / fail counts and then the converter will figure out how to position the margins. There is a MultiBinding example in my previous sample.
It would be easier, though, if you just adjust the layout of the chart. Instead of trying to display the labels directly on top of the chart you can place them on either side. The Pass number on the left side of the whole XamDataChart and the Fail number on the right side. This way, regardless of what the size of the bars are you will see the pass fail numbers in a consistent way.