SameerKhan Posted July 17, 2009 Report Share Posted July 17, 2009 I am trying to create a Marker Attribute DataTemplate, such that when the mouse is over a specific point of the series, the template would show a clickable button. I tried to use the sample template and modify it for my needs, but w/o any luck. Is there a detailed sample on how to use a DataTemplate for Markers? Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 17, 2009 Report Share Posted July 17, 2009 Can you post a screenshot of what you are trying to accomplish? Will you have multiple series? Do you expect to have a lot of points (hundreds, thousands) in your chart? If so, there might be better alternatives using tooltips. JuanC Quote Link to comment Share on other sites More sharing options...
SameerKhan Posted July 17, 2009 Author Report Share Posted July 17, 2009 I have multiple series, with thousands of points per series. I am already using a tooltip to show data for a specific point, but as you would be aware, the tooltip does not accept focus, and is not clickable. The use case is, that the user should be able to click on the marker, and I would perform other actions based on the point data which was clicked. I already have the code which handle clicks etc, I just need a visual cue for the selected point [ Adding markers to all the points is not feasible, since I have thousands of points] Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 17, 2009 Report Share Posted July 17, 2009 >> but as you would be aware, the tooltip does not accept focus, and is not clickable We do have an internal implementation of ToolTip that allows interaction but we do not expose a public property to switch to it, for example we have a DataTrasform called OtherTransform useful for pie charts that will "group" all small elements into a "Other" bucket, the tooltip for this fake element will show a listbox with all the elements that were grouped so we needed interaction to scroll the listbox contents. We also use this implementation in XBAP because of trust limitations related to Popup. If this would be useful in this or other situations we can make a public property to switch to this implementation. If you just need a visual cue and you are already handling the click events (and not a full blown button), this might help chart1.Highlight.Mode = ChartFX.WPF.HighlightMode.SeriesPoint; JuanC Quote Link to comment Share on other sites More sharing options...
skhan Posted July 17, 2009 Report Share Posted July 17, 2009 The public property to access your specialized tooltip would be very helpful, I know we are collating our series to show meaningful data, so showing a list box with the set's data could prove useful. Let me know when you make the update to the build, also, Please supply some code sample with the tool tip. I will try the SeriesPoint highlight mode, looks like something I could use. Thanks. Quote Link to comment Share on other sites More sharing options...
SameerKhan Posted July 20, 2009 Author Report Share Posted July 20, 2009 Is there some setup required before I setup the hIghlight mode, with the current setup, Setting the HighlightMode on the chart doesn't seem to be doing anything, Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 20, 2009 Report Share Posted July 20, 2009 This is what it should look like when you hover over a line chart with multiple series and Highlight.Mode set to SeriesPoint JuanC Quote Link to comment Share on other sites More sharing options...
SameerKhan Posted July 20, 2009 Author Report Share Posted July 20, 2009 Would I need to use a Marker for this? The problem is, I have thousands of points and I do not want to use a marker, I just want one the point which is under the mouse cursor to be highlighted. Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 20, 2009 Report Share Posted July 20, 2009 When Marker.Visibility is not visible we do not even render the markers so instead of hidding the markers you could do this chart1.Highlight.Mode = ChartFX.WPF.HighlightMode.SeriesPoint; chart1.AllSeries.Marker.Opacity = 0; chart1.Highlight.PointAttributes.Marker.Opacity = 1; chart1.AllSeries.Marker.Size = 12; Note that we are setting the marker opacity instead of visibility which means the visuals for the markers will be generated. Also note that you have to set the marker size because we have code that will auto-calculate the marker size and if you have thousands of points it will decide not to show the markers. JuanC Quote Link to comment Share on other sites More sharing options...
SameerKhan Posted July 24, 2009 Author Report Share Posted July 24, 2009 While moving the mouse over the series, at times we get the following exception followed by an application crash: I am following the exact sequence of assignments as mentioned in your post. I get the exception on a background thread, so I cannot really track down the exact cause of the problem System.IndexOutOfRangeException: Index was outside the bounds of the array. at ChartFX.WPF.Internal.AttributesResolver.a(Int32 A_0, Int32 A_1) at ChartFX.WPF.Internal.Highlight.SeriesPointResolver.a(Chart A_0, Boolean A_1) at ChartFX.WPF.HighlightAttributes.a(Boolean A_0, Boolean A_1) at ChartFX.WPF.HighlightAttributes.a(IHighlightResolver A_0, LogicalHighlightableItem A_1, Boolean A_2) at ChartFX.WPF.HighlightAttributes.a(Point A_0, LogicalHighlightableItem A_1) at ChartFX.WPF.Chart.a(LogicalHighlightableItem A_0, Point A_1, Boolean A_2) at ChartFX.WPF.Chart.a(Point A_0, Boolean A_1) at ChartFX.WPF.Chart.b(MouseEventArgs A_0) at ChartFX.WPF.Chart.OnMouseMove(MouseEventArgs e) at System.Windows.UIElement.OnMouseMoveThunk(Object sender, MouseEventArgs e) at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) VhayuDataExplorer.vshost.exe Error: 0 : System.IndexOutOfRangeException: Index was outside the bounds of the array. at ChartFX.WPF.Internal.AttributesResolver.a(Int32 A_0, Int32 A_1) at ChartFX.WPF.Internal.Highlight.SeriesPointResolver.a(Chart A_0, Boolean A_1) at ChartFX.WPF.HighlightAttributes.a(Boolean A_0, Boolean A_1) at ChartFX.WPF.HighlightAttributes.a(IHighlightResolver A_0, LogicalHighlightableItem A_1, Boolean A_2) at ChartFX.WPF.HighlightAttributes.a(Point A_0, LogicalHighlightableItem A_1) at ChartFX.WPF.Chart.a(LogicalHighlightableItem A_0, Point A_1, Boolean A_2) at ChartFX.WPF.Chart.a(Point A_0, Boolean A_1) at ChartFX.WPF.Chart.b(MouseEventArgs A_0) at ChartFX.WPF.Chart.OnMouseMove(MouseEventArgs e) at System.Windows.UIElement.OnMouseMoveThunk(Object sender, MouseEventArgs e) at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at VhayuDataExplorer.App.Main() in C:\dev\vhayu trunk\VhayuDataExplorer\obj\Debug\App.g.cs:line 48 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.