SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
Hi,
How can i create context menu for FastLineRenderableSeries ?
i tested ContextMenu property of FastLineRenderableSeries and it didn’t work.
As i understand – it is because FastLineRenderableSeries is not a control that visualized.
Hi there,
You are right, the FastLineRenderableSeries is not in the visual tree, as these are rendered using bitmaps only. If you want to create a context menu that shows only when right-clicking on a chart, I suggest you handle the SciChartSurface MouseRightButtonUp event and decide whether to show a context menu based on a hit-test result.
You can find a demonstration of the hit-test API here:
http://http://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/InspectDatapoints/HitTestDatapoints.xaml
and code to enact a hit test here:
private void SciChartSurfaceMouseRightButtonUp(object sender, MouseButtonEventArgs e) { // Hit tests are done per renderable series, so get a renderable series // or iterate over all RenderableSeries var renderableSeries = this.sciChartSurface.RenderableSeries[0]; // Perform the hit test relative to the GridLinesPanel Point mousePoint = e.GetPosition(sciChartSurface.GridLinesPanel as UIElement); var hitTest = renderableSeries.HitTest(mousePoint); // Output results string formattedString = string.Format("Mouse Coord: {0:0}, {1:0}\t\tNearest Datapoint Coord: {2}, {3}\tData Value: {4}, {5}\t\tIsHit? {6}", mousePoint.X, mousePoint.Y, hitTest.HitTestPoint.X, hitTest.HitTestPoint.Y, hitTest.XValue, hitTest.YValue, hitTest.IsHit); Debug.WriteLine(formattedString); }
Hope this helps!
Please login first to submit.