Hi,
I want to get series name and value on the clicked element in the column graph.
For it I handle MouseDown event and call HitTest function. But it returns null reference in his SelectedObject property
It only works properly in the 3d Mode .
What is wrong?
The SelectedObject property from HitTestArgs is null if mouse is not above a DataPoint (Series). Only when data points are selected the SelectedObject will return a reference to a data point. This example shows how selection works:
C#:
using System;using System.IO;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Navigation;using Infragistics.Windows.Chart;
namespace UntitledProject8{ public partial class Window1 { public Window1() { this.InitializeComponent(); // Insert code required on object creation below this point. }
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) { HitTestArgs args = this.Chart1.HitTest(e); base.OnMouseDown(e); } }}
XAML:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igCA="http://infragistics.com/Chart" x:Class="UntitledProject8.Window1" x:Name="Window" Title="Window1" Width="640" Height="480">
<Grid x:Name="LayoutRoot"> <igCA:XamChart Name="Chart1" Margin="8,8,8,8"> <igCA:XamChart.Series> <igCA:Series> <igCA:Series.DataPoints> <igCA:DataPoint Value="2"/> <igCA:DataPoint Value="8"/> <igCA:DataPoint Value="6"/> <igCA:DataPoint Value="7"/> </igCA:Series.DataPoints> </igCA:Series> </igCA:XamChart.Series> </igCA:XamChart> </Grid></Window>
as per above, I cannot get the hittest to return a selected object or pointindex >0 for a 2D chart
The hittest works fine on 3D Charts, but when clicking directly on a 2D datapoint, the selectedobject in hittestargs is always null.
I would assume because the samples only have a 3D selection example, then its a known issue for 2D Charts.
Is this a known issue and is there any workaround ?