Hi!
I would like to implement a shared tooltip for multiple series in my chart. I try to reproduce the solutions I found in old threads, but anything works...I guess cause I'm binding lists of values instead of attributes.
I'm using a carousel view which is filled dynamically with differents charts (I manage the DataTemplate using a control).
A snippet of my VM bindable lists (I get the values throught api requests):
public Datas ChartDatas { get; set; } public List ChartValueDatas { get; set; }
public Datas ChartDatas2 { get; set; } public List ChartValueDatas2 { get; set; } |
The class ValueDatas:
public class ValueDatas { public double Value { get; set; } public DateTime Date { get; set; } } |
A snippet of my XAML DataTemplate:
<DataTemplate x:Key="ChartDoubleTemplate" > (...) <chart:SfChart.Series> <chart:ColumnSeries ItemsSource="{Binding ChartValueDatas}" x:Name="Xline" Label="{Binding Label}" XBindingPath="Date" YBindingPath="Value" EnableTooltip="False" ShowTrackballInfo="False" Color="#e95afc" LegendIcon="Circle"> </chart:ColumnSeries> <chart:LineSeries x:Name="serie2" ItemsSource="{Binding ChartValueDatas2}" Label="{Binding Label2}" XBindingPath="Date" YBindingPath="Value" XAxis="{Binding XAxis, Source=Xline}" EnableTooltip="False" ShowTrackballInfo="True" Color="#3366cc" LegendIcon="Diamond" TrackballLabelTemplate="{StaticResource trackballTemplate}" > </chart:LineSeries> |
And finally, a snnipet of my trackballTemplate:
<DataTemplate x:Key="trackballTemplate"> <Frame BackgroundColor="White"> <StackLayout Orientation="Vertical" BackgroundColor="White"> <Label TextColor="#e95afc" > <Label.FormattedText> <FormattedString> <Span Text="{ext:Translate Energy}"/> <!-- here i have the problem, I'd try to access using "x:Reference" but doesn't work --> <!-- If I use "{Binding Value} in both, the trackball label shows the same Value --> <Span Text="{Binding Source={x:Reference Xline}, Path=YBindingPath}" FontAttributes="Bold" TextColor="{StaticResource TSKBlack}"/> </FormattedString> </Label.FormattedText> </Label> <LabelTextColor="#3366cc" > <Label.FormattedText> <FormattedString> <Span Text="{ext:Translate Power}"/> <Span Text="{Binding Value, StringFormat='{0:N2}'}" FontAttributes="Bold" TextColor="Black"/> </FormattedString> </Label.FormattedText> </Label> </StackLayout> </Frame> </DataTemplate>
|
And this is that I want to achieve it but I'm still not able to do it,but I don't know if it's possible:
https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/shared-x-crosshair/

Any idea or solution?
Thanks in advance!