Profile Picture

NDataCursorTool not working in build version 18.12.10.12

Posted By James Richason 5 Years Ago

NDataCursorTool not working in build version 18.12.10.12

Author
Message
James Richason
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 10, Visits: 63
This is the code being used:

   ClearAndResetAppliedToolSettings();
    UpdateCursorFromControls();
    var dateTimePagingView = _chartPrimaryXAxis.PagingView as NDateTimeAxisPagingView;
    if (dateTimePagingView != null)
    {
      _chartPrimaryXAxis.ScrollBar.Visible = false;
      dateTimePagingView.ResetMode = PagingViewResetMode.View;
      dateTimePagingView.Reset();
      dateTimePagingView.ResetMode = PagingViewResetMode.LastZoom;
    }
    _chartControl.Controller.Selection.Clear();
    _chartControl.Controller.Selection.Add(_chartControl.Charts[0]);
    _chartControl.Controller.Tools.Add(_chartDataCursorTool);
    _chartControl.Refresh();
    UpdateResultsViewReloadState();



Nevron Support
Posted 5 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi James,
We just tested the data cursor example shipped with the control and it was working properly with this version. Can you post the complete code that automates the control for review?

Best Regards,
Nevron Support Team



James Richason
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 10, Visits: 63
I was able to get it to work by rearranging the order of some code.

Thanks

Jim

James Richason
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 10, Visits: 63
Sorry I didn't get back earlier.  I'm new to this tool and taking over some existing code.  In this code we zoom in using NDataZoomTool. We then try to turn on the NDataCursorTool.  This turns off the data zoom.  Is it possible to do this separately?

Some sample code of how to use these two tools together would be very helpful.

Thanks

Jim

James Richason
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 10, Visits: 63
My question is can NDataZoomTool and NDataCursorTool be used at the same time in NChartControl?  If so . . . what does this code look like?  

In our application it use of one appears to override the other control.

Nevron Support
Posted 5 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi James,
The following code shows how you can mix the data cursor tool with other tools:
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
    chart.RangeSelections.Add(new NRangeSelection());

    NAxisCursor xAxisCursor = new NAxisCursor();
    xAxisCursor.SynchronizeOnMouseAction = MouseAction.Move;
    xAxisCursor.BeginEndAxis = (int)StandardAxis.PrimaryY;
    chart.Axis(StandardAxis.PrimaryX).Cursors.Add(xAxisCursor);

    NAxisCursor yAxisCursor = new NAxisCursor();
    yAxisCursor.SynchronizeOnMouseAction = MouseAction.Move;
    yAxisCursor.BeginEndAxis = (int)StandardAxis.PrimaryX;
    chart.Axis(StandardAxis.PrimaryY).Cursors.Add(yAxisCursor);

    chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
    chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true;

    NPointSeries pointSeries = new NPointSeries();
    pointSeries.Values.Add(10);
    pointSeries.Values.Add(20);
    pointSeries.Values.Add(30);
    chart.Series.Add(pointSeries);

    nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
    nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
    nChartControl1.Controller.Tools.Add(new NDataZoomTool());
    nChartControl1.Controller.Tools.Add(new NDataCursorTool());

Note that when a drag tool begins an operation (NDataZoomTool or NAxisScrollTool) it will capture all events until the operation is complete as it becomes an active tool. Do you want to have data cursors synchronized during a drag operation - for example data zoom?

Best Regards,
Nevron Support Team



James Richason
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 10, Visits: 63
I am able to get the NDataCursorTool on the zoom screen.  The one issue I'm having is that it now interferes with access to the scrolling tools at the bottom of the zoom screen.

Here's what my code looks like:

  void resultVisualizationHeader1_MouseZoom(object sender, EventArgs e)
   {
    zoomToolOn = !zoomToolOn;
    if (_resultsViewInfo.ProcessedTimeStep == ViewReportingFrequency.Monthly || _resultsViewInfo.ProcessedTimeStep == ViewReportingFrequency.Run_Period)
    {
      MessageBox.Show(MessageAndPrompts.INFORM_DATAZOOM_TOOL_FREQUENCY_COMPATIBITLIY);
      return;
    }
    ClearAndResetAppliedToolSettings();
    _chartControl.Controller.Tools.RemoveAllChildren();
    _chartControl.Controller.Selection.Clear();
    _chartControl.Controller.Selection.Add(_chartControl.Charts[0]);

    if (cursorToolOn)
    {
      //_chart.RangeSelections.Add(new NRangeSelection());

      NAxisCursor xAxisCursor = new NAxisCursor();
      xAxisCursor.SynchronizeOnMouseAction = MouseAction.Move;
      xAxisCursor.BeginEndAxis = (int)StandardAxis.PrimaryY;
      _chart.Axis(StandardAxis.PrimaryX).Cursors.Add(xAxisCursor);

      NAxisCursor yAxisCursor = new NAxisCursor();
      yAxisCursor.SynchronizeOnMouseAction = MouseAction.Move;
      yAxisCursor.BeginEndAxis = (int)StandardAxis.PrimaryX;
      _chart.Axis(StandardAxis.PrimaryY).Cursors.Add(yAxisCursor);
    }

    _chartPrimaryXAxis.ScrollBar.Visible = true;
    _chartPrimaryYAxis.ScrollBar.Visible = true;
    var dateTimePagingView = _chartPrimaryXAxis.PagingView as NDateTimeAxisPagingView;
    if (dateTimePagingView != null)
    {
      _chartPrimaryXAxis.ScrollBar.Visible = true;
      dateTimePagingView.ResetMode = PagingViewResetMode.View;
      dateTimePagingView.Reset();
      dateTimePagingView.ResetMode = PagingViewResetMode.LastZoom;
    }

    _chartPrimaryYAxis.PagingView = new NNumericAxisPagingView();
    UpdateDataZoomTool();
    UpdateDateTimeScale();
    _dateTimeScale.EnableUnitSensitiveFormatting = true;

    // configure interactivity    
    _chartControl.Controller.Tools.Add(new NSelectorTool());
    _chartControl.Controller.Tools.Add(_chartDataZoomTool);
    _chartControl.Controller.Tools.Add(_chartDataCursorTool);
    _chartControl.Controller.Tools.Add(new NAxisScrollTool());
    _chartControl.Refresh();
    UpdateResultsViewReloadState();
   }


  private void ClearAndResetAppliedToolSettings()
   {
    if (_chartDataCursorTool != null)
    {
      if (_chartControl.Controller.Tools.Contains(_chartDataCursorTool))
      {
       NChart chart = _chartControl.Charts[0];
       NAxis primaryXAxis = chart.Axis(StandardAxis.PrimaryX);
       NAxis primaryYAxis = chart.Axis(StandardAxis.PrimaryY);
       NAxis depthAxis = chart.Axis(StandardAxis.Depth);

       primaryXAxis.Cursors.Clear();
       primaryYAxis.Cursors.Clear();
       toolTip1.SetToolTip(_chartControl, "");
      }
    }
    //Reset all Chart interaction controls
    _chartControl.Controller.Tools.RemoveAllChildren();
    if (_resultsViewInfo.ChartType == ChartOrTableType.Bar3d)
    {
      _chartControl.Controller.Tools.Add(new NSelectorTool());
      _chartControl.Controller.Tools.Add(new NTrackballTool());
    }
    _chartPrimaryXAxis.ScrollBar.Visible = false;
    _chartPrimaryYAxis.ScrollBar.Visible = false;
    this.Cursor = Cursors.Default;
    ChartCategory chartCategory = GetChartCategory(_resultsViewInfo.ChartType);
    if (chartCategory == ChartCategory.Column || chartCategory == ChartCategory.Range)
    {
      _chartPrimaryXAxis.PagingView = null;
      _chartPrimaryXAxis.Visible = _resultsViewInfo.ResultsViewVariables.Count != 0;
    }
    else
    {
      if (_resultsViewInfo.ResultsViewVariables.Count == 0)
      {
       _chartPrimaryXAxis.PagingView = new NDateTimeAxisPagingView();
      }
    }
    _chartPrimaryYAxis.PagingView = new NNumericAxisPagingView();
    ;
   }

  private void UpdateResultsViewReloadState()
   {
    _chartControl.document.Calculate();
    _chartControl.document.RecalcLayout(_chartControl.View.Context);
    //dateTimeScale
    NRange1DD xAxisRange = _chart.Axis(StandardAxis.PrimaryX).Scale.RulerRange;
    DateTime startdate = DateTime.FromOADate(xAxisRange.Begin);
    DateTime enddate = DateTime.FromOADate(xAxisRange.End);
    _resultsViewInfo.StartDate = startdate;
    _resultsViewInfo.EndDate = enddate;
    Debug.WriteLine("StartDate:" + startdate.ToString() + " - EndDate:" + enddate.ToString());
   }

This is the code that initially turns on the Data Cursor:

  void resultVisualizationHeader1_MouseTrackBallSelect(object sender, EventArgs e)
   {
    if (!zoomToolOn)
    {
      if (!cursorToolOn)
      {
       ClearAndResetAppliedToolSettings();
       UpdateCursorFromControls();
       var dateTimePagingView = _chartPrimaryXAxis.PagingView as NDateTimeAxisPagingView;
       if (dateTimePagingView != null)
       {
        _chartPrimaryXAxis.ScrollBar.Visible = false;
        dateTimePagingView.ResetMode = PagingViewResetMode.View;
        dateTimePagingView.Reset();
        dateTimePagingView.ResetMode = PagingViewResetMode.LastZoom;
       }
       _chartControl.Controller.Selection.Clear();
       _chartControl.Controller.Selection.Add(_chartControl.Charts[0]);
       _chartControl.Controller.Tools.Add(_chartDataCursorTool);
       _chartControl.Refresh();
       UpdateResultsViewReloadState();
       cursorToolOn = true;
      }
      else
      {
       ClearAndResetAppliedToolSettings();
       UpdateCursorFromControls();
       _chartControl.Controller.Selection.Clear();
       _chartControl.Controller.Selection.Add(_chartControl.Charts[0]);
       //_chartControl.Controller.Tools.Remove(_chartDataCursorTool);
       _chart.Axis(StandardAxis.PrimaryX).Cursors.Clear();
       _chart.Axis(StandardAxis.PrimaryY).Cursors.Clear();

       _chartControl.Refresh();
       cursorToolOn = false;

      }
    }
    else
    {
      MessageBox.Show(MessageAndPrompts.INFORM_DATATRACK_TOOL_BEFORE_ZOOM);
    }
   }

  private void UpdateCursorFromControls()
   {
    _chartHorizontalAxisCursor.ValueSnapper = null;
    _chartVerticalAxisCursor.ValueSnapper = null;
    NAxis depthAxis = _chart.Axis(StandardAxis.Depth);

    _chartPrimaryXAxis.Cursors.Clear();
    _chartPrimaryYAxis.Cursors.Clear();
    depthAxis.Cursors.Clear();

    _chartPrimaryXAxis.Cursors.Add(_chartHorizontalAxisCursor);
    _chartPrimaryYAxis.Cursors.Add(_chartVerticalAxisCursor);

    _chartHorizontalAxisCursor.SynchronizeOnMouseAction = MouseAction.None;
    _chartVerticalAxisCursor.SynchronizeOnMouseAction = MouseAction.None;

    _chartHorizontalAxisCursor.SynchronizeOnMouseAction |= MouseAction.Down;
    _chartVerticalAxisCursor.SynchronizeOnMouseAction |= MouseAction.Down;

    _chartHorizontalAxisCursor.SynchronizeOnMouseAction |= MouseAction.Up;
    _chartVerticalAxisCursor.SynchronizeOnMouseAction |= MouseAction.Up;

    _chartHorizontalAxisCursor.SynchronizeOnMouseAction |= MouseAction.Move;
    _chartVerticalAxisCursor.SynchronizeOnMouseAction |= MouseAction.Move;
   }

Note:  You will notice that I require that the user turns on the cursor before turning on zoom.

Thanks for your help.

Jim



James Richason
Posted 5 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 10, Visits: 63
I was able to get the NDataCursorTool to appear in my zoom screen

My issue is that the cursor now interferes with the tracking tool at the bottom of the zoom screen.

Nevron Support
Posted 5 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi James,
Let's schedule an online 15 minute meeting to discuss - we think it will be more productive than exchanging posts. If you're keen to do it this way please send an e-mail to support@nevron.com to schedule a meeting...

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic