Exemplo n.º 1
0
        /// <summary>
        /// Method used to select bitmap series in mouse down
        /// </summary>
        /// <param name="element"></param>
        /// <param name="e"></param>
        private void OnBitmapSeriesMouseDownSelection(FrameworkElement element, PointerRoutedEventArgs e)
        {
            Point canvasPoint = e.GetCurrentPoint(ChartArea.GetAdorningCanvas()).Position;

            if (seriesCollection.Count > 0)
            {
                ChartArea.CurrentSelectedSeries = seriesCollection[seriesCollection.Count - 1];

                if (ChartArea.CurrentSelectedSeries is ISegmentSelectable)
                {
                    ChartDataPointInfo data = ChartArea.CurrentSelectedSeries.GetDataPoint(canvasPoint);
                    OnMouseDownSelection(ChartArea.CurrentSelectedSeries, data);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method used to select bitmap series in mouse move
        /// </summary>
        /// <param name="element"></param>
        /// <param name="e"></param>
        private void OnBitmapSeriesMouseMoveSelection(FrameworkElement element, PointerRoutedEventArgs e)
        {
            Point canvasPoint = e.GetCurrentPoint(ChartArea.GetAdorningCanvas()).Position;

            if (seriesCollection.Count > 0)
            {
                ChartArea.CurrentSelectedSeries = seriesCollection[seriesCollection.Count - 1];
                if (IsDraggableSeries(ChartArea.CurrentSelectedSeries))
                {
                    return;
                }

                if (ChartArea.CurrentSelectedSeries is ISegmentSelectable)
                {
                    ChartDataPointInfo data = ChartArea.CurrentSelectedSeries.GetDataPoint(canvasPoint);
                    OnMouseMoveSelection(ChartArea.CurrentSelectedSeries, data);
                }
            }
            else if (ChartArea.PreviousSelectedSeries != null && ChartArea.VisibleSeries.Contains(ChartArea.PreviousSelectedSeries))
            {
                bool isCancel;
                if (EnableSeriesSelection)
                {
                    isCancel = ChartArea.CurrentSelectedSeries.RaiseSelectionChanging(-1, ChartArea.SeriesSelectedIndex);
                }
                else
                {
                    isCancel = ChartArea.CurrentSelectedSeries.RaiseSelectionChanging(
                        -1,
                        (ChartArea.CurrentSelectedSeries as ISegmentSelectable).SelectedIndex);
                }

                if (!isCancel)
                {
                    Deselect();
                }
            }
        }