Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding events on WPF LineSeries DataPoint
    primarykey
    data
    text
    <p>I am using WPF Toolkit to draw a line chart (a feature on our application). Given a Collection, I am able to plot the graph, however, when the user double clicks on the DataPoint on the graph, I am finding it difficult to get the X and Y data value (not the Co-Ordinate value in the line graph).</p> <p>I am able to set property using DataPointStyle, but unable to add event to it.</p> <p>If I use <code>MouseDoubleClick="lineChart_ShowResults_DoubleClick"</code> property on the LineSeries node, then it triggers an event when user clicks on any point. But, I need to trigger the event <strong>only</strong> if the user clicks on the DataPoint. The following is the XAML that I tried to implement. Please help.</p> <pre><code>&lt;Window x:Class="TeamXXX.YYYUI.GraphicalDisplay" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="GraphicalDisplay" Height="400" Width="600" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="439" d:DesignWidth="654" SizeToContent="WidthAndHeight"&gt; &lt;ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"&gt; &lt;Grid MinHeight="360" MinWidth="575" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt; &lt;chartingToolkit:Chart Name="lineChart" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt; &lt;chartingToolkit:Chart.LegendStyle&gt; &lt;Style TargetType="Control"&gt; &lt;Setter Property="Height" Value="0" /&gt; &lt;Setter Property="Width" Value="0" /&gt; &lt;/Style&gt; &lt;/chartingToolkit:Chart.LegendStyle&gt; &lt;chartingToolkit:LineSeries DependentValuePath="Value" Name="lineSeries" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True" MouseDoubleClick="lineChart_ShowResults_DoubleClick"&gt; &lt;!--&lt;chartingToolkit:LineSeries.DataPointStyle&gt; &lt;Style x:Uid="CommonLineSeriesDataPoint" TargetType="chartingToolkit:LineDataPoint"&gt; &lt;Setter Property="" Property="lineChart_ShowResults_DoubleClick"/&gt; &lt;/Style&gt; &lt;/chartingToolkit:LineSeries.DataPointStyle&gt;--&gt; &lt;chartingToolkit:LineSeries.DependentRangeAxis&gt; &lt;chartingToolkit:LinearAxis Orientation="Y" Title="Cost in minutes" FontSize="16" /&gt; &lt;/chartingToolkit:LineSeries.DependentRangeAxis&gt; &lt;chartingToolkit:LineSeries.IndependentAxis&gt; &lt;chartingToolkit:LinearAxis Orientation="X" Title="Fold" FontSize="16" /&gt; &lt;/chartingToolkit:LineSeries.IndependentAxis&gt; &lt;/chartingToolkit:LineSeries&gt; &lt;/chartingToolkit:Chart&gt; &lt;/Grid&gt; &lt;/ScrollViewer&gt; &lt;/Window&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload