Reputation: 167
I'm creating a Line chart which includes more than 30 lines. Since it is difficult to identify the series by color I want to display a tooltip when the mouse pointer is on a series that displaying only series title. Is there any way to do that without using custom tooltip approach?
I followed https://lvcharts.net/App/examples/v1/wpf/Tooltips%20and%20Legends article. Without going to custom tooltip implementation, I would like to try its 3rd example :
<lvc:CartesianChart>
<lvc:CartesianChart.Resources>
<Style TargetType="lvc:DefaultTooltip">
<Setter Property="Background" Value="DarkOrange"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="ShowTitle" Value="True"></Setter><!--new property-->
<Setter Property="ShowSeries" Value="False"></Setter><!--new property-->
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="FontWeight" Value="Bold"></Setter>
<Setter Property="CornerRadius" Value="20"></Setter>
<Setter Property="Width" Value="40"></Setter>
<Setter Property="Height" Value="40"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
</Style>
</lvc:CartesianChart.Resources>
<lvc:CartesianChart.Series>
<lvc:LineSeries Values="4,2,6,4"></lvc:LineSeries>
</lvc:CartesianChart.Series>
</lvc:CartesianChart>
The SeiesCollection is like below:
SeriesCollection = new SeriesCollection
{
new LineSeries
{
Title = "Series 1",
Values = new ChartValues<double> { 4, 6, 5, 2 ,4 }
PointGeometry = null
},
new LineSeries
{
Title = "Series 2",
Values = new ChartValues<double> { 6, 7, 3, 4 ,6 },
PointGeometry = null
},
};
In my code, <Setter Property="ShowTitle" Value="True"></Setter>
is not working.
I want to see Series 1, Series 2 ... etc on the tooltip when the mouse pointer is on a line series.
Upvotes: 2
Views: 1242
Reputation: 376
With the LiveChart tooltip i've learned that, some way or another, one day you'll have to show something unavailable in the original implementation of the tooltip, and you'll have to implement the custom tooltip. So, even if there may be a clunky workaround to get what you need right now, better start implementing the custom tooltip and be ready for any future change.
Upvotes: 1