Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Tooltip for markers only
posted

Hi All,

I have a data chart in WPF. I am adding line series to it dynamically and also i am adding tool tip for series. This tool tip is displayed along the line series when user hovers on series or marker. Is there a way so that i can display the tool tip only when user hovers on marker.

StackPanel sp = new StackPanel()
{
Orientation = System.Windows.Controls.Orientation.Horizontal
};

var txtbl = new TextBlock();
txtbl = new TextBlock();
txtbl.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Item.ShuffleCount"));
sp.Children.Add(txtbl);

txtbl = new TextBlock();
txtbl.Text = " Cards drawn at ";
sp.Children.Add(txtbl);

txtbl = new TextBlock();
txtbl.SetBinding(TextBlock.TextProperty, new System.Windows.Data.Binding("Item.StrGameDateTime"));
sp.Children.Add(txtbl);

lineSeries.ToolTip = sp;

Parents
No Data
Reply
  • 34510
    Offline posted

    Hi Veeresh,

    The tooltips are designed to show when you hover over the line itself or the markers so currently there is no way to disable tooltips on just the line and leave it on markers.  Is there a reason you don't want tooltips to show up on the line itself?

    What you can do is create a LineSeries and then a PointSeries.  The LineSeries will not have a tooltip and it will not have markers.  The PointSeries will have the tooltip and it will have markers enabled.  And both series will have the same ItemsSource and ValueMemberPath.  This means you will be using the PointSeries for rendering the markers separately from the LineSeries so that tooltips do not show up when hovering over the line.

    <ig:XamDataChart.Series>
        <ig:LineSeries ItemsSource="{Binding}" x:Name="lineSeries1"
                        ValueMemberPath="Value"
                        MarkerType="None"
                        XAxis="{Binding ElementName=xAxis}"
                        YAxis="{Binding ElementName=yAxis}"/>

        <ig:PointSeries ItemsSource="{Binding}"
                        ValueMemberPath="Value"
                        XAxis="{Binding ElementName=xAxis}"
                        YAxis="{Binding ElementName=yAxis}" ToolTip="tooltip content goes here"
                        MarkerBrush="{Binding ElementName=lineSeries1, Path=ActualBrush}"/>
    </ig:XamDataChart.Series>

Children
No Data