Unplanned
Last Updated: 29 Mar 2016 10:59 by ADMIN
ADMIN
Dimitar
Created on: 01 Sep 2015 10:57
Category: ChartView
Type: Bug Report
1
FIX. RadChartView - the chart is panned when a dialog is shown in the SelectedPointChanged event.
To reproduce:
- Subscribe to the SelectedPointChanged event and show a dialog in it.
- Start the chart and zoom in. Select a point, close the dialog and select a point again.

Workaround:
class MyChartSelectionController : ChartSelectionController
{
    protected override ActionResult OnMouseDown(MouseEventArgs e)
    {
        //return base.OnMouseDown(e);
        return Controller.Empty;
    }
    protected override ActionResult OnMouseUp(MouseEventArgs e)
    {
        if (!this.AllowSelect || this.SelectionMode == ChartSelectionMode.None)
        {
            return base.OnMouseUp(e);
        }

        DataPoint oldDataPoint = SelectedPoint;
        DataPoint newDataPoint = null;
        ChartSeries oldSeries = SelectedSeries;
        ChartSeries newSeries = null;
        DataPoint point = null;

        foreach (ChartSeries series in this.Area.Series)
        {
            point = series.HitTest(e.X, e.Y);
            if (point != null)
            {
                newDataPoint = point;
                newSeries = series;
                break;
            }
        }

        if (point == null)
        {
            return base.OnMouseUp(e);
        }

        ChartViewSelectedPointChangingEventArgs cancelArgs = new ChartViewSelectedPointChangingEventArgs(oldDataPoint, newDataPoint, oldSeries, newSeries, this.SelectionMode);
        OnSelectedPointChanging(cancelArgs);

        if (cancelArgs.Cancel == true)
        {
            return base.OnMouseUp(e);
        }

        if (oldDataPoint == newDataPoint)
        {
            oldDataPoint.IsSelected = !oldDataPoint.IsSelected;
            newDataPoint = null;
            SelectedPoint = null;
        }
        else
        {
            if (this.SelectionMode == ChartSelectionMode.SingleDataPoint && oldDataPoint != null)
            {
                oldDataPoint.IsSelected = false;
            }

            this.SelectedPoint = newDataPoint;
            this.SelectedPoint.IsSelected = !SelectedPoint.IsSelected;
        }

        ChartViewSelectedPointChangedEventArgs changedArgs = new ChartViewSelectedPointChangedEventArgs(oldDataPoint, newDataPoint, oldSeries, newSeries, this.SelectionMode);
        OnSelectedPointChanged(changedArgs);
    
        return base.OnMouseUp(e);
    }

   
}


0 comments