- Home
- Forum
- Xamarin.Forms
- shared trackball tooltip with chart templates
shared trackball tooltip with chart templates
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; } |
The class ValueDatas:
public class ValueDatas |
A snippet of my XAML DataTemplate:
<DataTemplate x:Key="ChartDoubleTemplate" > (...) |
And finally, a snnipet of my trackballTemplate:
<DataTemplate x:Key="trackballTemplate"> |
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:
Any idea or solution?
Thanks in advance!
SIGN IN To post a reply.
1 Reply
DD
Devakumar Dhanapoosanam
Syncfusion Team
September 23, 2021 01:24 PM UTC
Hi Saray Arce,
Greetings from Syncfusion.
We have analyzed your query and we would like to share the following suggestion which will be helpful for achieving your requirement.
Solution 1:
We can show the values as shared tooltip using the ChartTrackballBehavior LabelDisplayMode property value as GroupAllPoints. It will display label for all the data points as grouped and positioned at the top of the chart area. Please refer the code snippet below.
XAML:
|
<chart:SfChart.ChartBehaviors>
<chart:ChartTrackballBehavior LabelDisplayMode="GroupAllPoints" ShowLine="True"/>
</chart:SfChart.ChartBehaviors> |
Solution 2:
If you would like to use the custom template option, as you have mentioned we would like to suggest applying the same data collection for series ItemsSource with different attributes values in DataModel as in below example.
|
public class ValueDatas
{
public double Value1 { get; set; }
public double Value2 { get; set; }
public DateTime Date { get; set; }
}
… |
…<DataTemplate x:Key="trackballTemplate"><StackLayout><Label Text="{Binding Value1}"/><Label Text="{Binding Value2}"/></StackLayout></DataTemplate>…<chart:ColumnSeries ItemsSource="{Binding ChartValueDatas }" XBindingPath="Date"YBindingPath="Value1" ShowTrackballInfo="False"/><chart:LineSeries ItemsSource="{Binding ChartValueDatas }" XBindingPath="Date"YBindingPath="Value2" ShowTrackballInfo="True"TrackballLabelTemplate="{StaticResource trackballTemplate}" /> |
Please let us know if you need any further assistance on this.
Regards,
Devakumar D
Devakumar D
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
SA Saray Arce
- Sep 22, 2021 09:52 AM UTC
- Sep 23, 2021 01:24 PM UTC