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!
- Azrin Sani asked 9 years ago
- You must login to post comments
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?
- Andrew Burnett-Thompson answered 9 years ago
- You must login to post comments
Please login first to submit.