<chart:ChartDataMarker LabelContent="Percentage" ShowLabel="True">
<chart:ChartDataMarker.LabelStyle>
<chart:DataMarkerLabelStyle
BackgroundColor="Transparent"
LabelPosition="Auto"
TextColor = "White"
BorderColor="White"
BorderThickness="1">
chart:DataMarkerLabelStyle>
chart:ChartDataMarker.LabelStyle>
chart:ChartDataMarker>
chart:ColumnSeries.DataMarker>
Using the property LabelPosition="Auto" SyncFusion automatically will move the text of the BarLabel in or out the box.
I need to change the color of the text depending by if it is moved inside or outside the bar. How I can do it?
Could you please give to me a sample starting from XAML page, explaining how access/change the text label properties = TextColor based on where SyncFusion is moving the text (based on LabelPosition)?
Just an example to better explain:
if Value = 5% the text will be moved out and being the background color = white I need color to be black
if Value is 70% in this case text will be inside and color need to be white cause background color of the bar is blue.
GC
Hello
thanks for your reply.
My need was more to recognize how the LabelPosition=Auto was locating the text of the label and depending if inside or outside changing the color of the text.
You gave an example based on the yvalue that is not exactly what I asked. Sure that could be a sort of workaround so if not other solutions are possible it is fine.
I have another question:
Always for the chart:BarSeries I need to have e legend that will be aligned on the right to the Bars of the chart. How can I achieve this goal?
I see that for this type of Chart is not possible to define a fix widht of the bars so how would be possible to build a custom layout structure on the right of the chart to have aligned to the bar more complex elements (like buttons, link, image...)? This for more complex layout.
BR
GC
<chart:SfChart.Legend>
<chart:ChartLegend DockPosition="Right"/>
</chart:SfChart.Legend>
|
<chart:BarSeries x:Name="series" ItemsSource ="{Binding Items}"
XBindingPath="XValue" YBindingPath="YValue" Label="ColumnSeries" Width ="0.5" /> |
Hello and thanks for your reply.
I think my point is not yet clear, sorry probably I have been not abel to explain it clearly, I will try to be as much simplest as possible.
on XAML file I setup the property LabelPosition="Auto".
This means that sync chart automatically locate the label writing in or out the bar.
What I would like to know is:
is it possible at runtime to know if the label writings is inside or outside the label? if you want: how sync is resolving the "Auto" feature? as Inner or as Outer?
Please let me know if this clarify my doubt.
BR
Gabriele
Hi Gabriele,
We have checked your scenario at maximum possibilities. Still we are unable to achieve your requirement, due to certain limitations in application level. So, we have logged this as a feature (Need to provide new APIs for customize the label position for each data marker) and it will be available in any of our upcoming release.
Regards,
Parthiban S.