SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

Hi,
I have done everything possible, but I can’t seem to get the vertical slice modifier to appear. I have wired the function just how the ‘InspectDataPoints => Create Verticle Slices’ SciCharts Example.

Unfortunately, it just doesn’t seem to work! Nothing is popping up when I press the ‘Add Slice’ button. The only difference with the example from SciCharts is that I am using a DateTime Axis.

private void OnCreateSliceClick(object sender, RoutedEventArgs e)
        {
            MouseButtonEventHandler mouseClick = null;
            mouseClick = (s, arg) =>
            {
                this.MouseLeftButtonUp -= mouseClick;
                hintText.Visibility = Visibility.Collapsed;
                var mousePoint = arg.GetPosition((UIElement)this.sciChart.GridLinesPanel).X;

                var slice = new VerticalLineAnnotation()
                {           
                    //X1 = new DateTime(2012, 1, 7, 8, 0, 0),
                    X1 = this.sciChart.XAxis.GetDataValue(mousePoint),
                    Style = (Style)Resources["sliceStyle"]
                };

                sliceModifier.VerticalLines.Add(slice);
            };

            hintText.Visibility = Visibility.Visible;
            this.MouseLeftButtonUp += mouseClick;
        }

And then I tried changing the Date Axis using the following code

var mousePoint = arg.GetPosition((UIElement)this.sciChart.GridLinesPanel).X;
var categoryCoordCalc = sciChart.XAxis.GetCurrentCoordinateCalculator() as ICategoryCoordinateCalculator;
var dataPointIndex = (int)categoryCoordCalc.GetDataValue(mousePoint);

unfortunately, the ‘categoryCoordCalc’ value returns a null!!!

I am so stuck!! Please help me!

  • You must to post comments
0
0

If you are using CategoryDateTimeAxis, then please set X1 values on vertical slices as indices to your data.

If you are using DateTImeAxis, then set X1 values to Dates.

The Axis.GetCurrentCoordinateCalculator() and Axis.GetCoordinate() / GetDataValue() depend on the axis having been drawn to the screen (as we need to know the axis size), so these functions are only available after the SciChartSurface has first drawn.

Does this help?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.