Profile Picture

How to use NZoomTool and NAxisScrollTool together, as my way of doing this causes problem with...

Posted By Atif Riaz 13 Years Ago

How to use NZoomTool and NAxisScrollTool together, as my way of doing...

Author
Message
Atif Riaz
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 4, Visits: 1
Below is the code used for creating chart with NZoomTool and NAxisScrollTool together. After zooming in or out, the scrollbars hovering functionality behave strangly (the scrollbar buttons highlight when mouse is slightly off the buttons). I am sure I am doing something silly or is there some other way to do this?



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.Chart.WinForm;

namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

nChartControl1.Legends.Clear();

NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

NAxis axisX = chart.Axis(StandardAxis.PrimaryX);
NNumericAxisPagingView xPagingView = new NNumericAxisPagingView(new NRange1DD(0, 100));
xPagingView.MinPageLength = 1.0;
axisX.PagingView = xPagingView;
axisX.ScrollBar.Visible = true;

NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
NNumericAxisPagingView yPagingView = new NNumericAxisPagingView(new NRange1DD(0, 100));
yPagingView.MinPageLength = 1.0;
axisY.PagingView = yPagingView;
axisY.ScrollBar.Visible = true;

Random rand = new Random();
NPointSeries lineSeries = (NPointSeries)chart.Series.Add(SeriesType.Point);
for (int i = 0; i < 100; i++)
{
lineSeries.UseXValues = true;
lineSeries.XValues.Add(rand.Next(100));
lineSeries.Values.Add(rand.Next(100));
}

nChartControl1.Controller.Tools.Add(new NSelectorTool());
nChartControl1.Controller.Tools.Add(new NZoomTool());
nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
}
}
}


Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 2 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Atif,

Generally we don't recommend using the Zoom tool with the axis scroll tool - the better combination is the data zoom zoom + scroll - for example:

   nChartControl1.Legends.Clear();

   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
   chart.RangeSelections.Add(new NRangeSelection());

   NAxis axisX = chart.Axis(StandardAxis.PrimaryX);
   NNumericAxisPagingView xPagingView = new NNumericAxisPagingView(new NRange1DD(0, 100));
   xPagingView.MinPageLength = 1.0;
   axisX.PagingView = xPagingView;
   axisX.ScrollBar.Visible = true;

   NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
   NNumericAxisPagingView yPagingView = new NNumericAxisPagingView(new NRange1DD(0, 100));
   yPagingView.MinPageLength = 1.0;
   axisY.PagingView = yPagingView;
   axisY.ScrollBar.Visible = true;

   Random rand = new Random();
   NPointSeries lineSeries = (NPointSeries)chart.Series.Add(SeriesType.Point);
   for (int i = 0; i < 100; i++)
   {
    lineSeries.UseXValues = true;
    lineSeries.XValues.Add(rand.Next(100));
    lineSeries.Values.Add(rand.Next(100));
   }

   nChartControl1.Controller.Tools.Add(new NSelectorTool());
   nChartControl1.Controller.Tools.Add(new NDataZoomTool());
   nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

Note that you'll need a range selection in the chart. Hope this helps - let us know if you meet any problems.

 



Best Regards,
Nevron Support Team



joern kunze
Posted 12 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 86, Visits: 221
... just a further remark:

the sequenze of the commands _NevronChart.Controller.Tools.Add when initializing the chart is very important:

//works perfect:
_NevronChart.Controller.Tools.Add(new NSelectorTool());

_DataZoomTool = new NDataZoomTool();
_NevronChart.Controller.Tools.Add(_DataZoomTool);

_AxisScrollTool = new NAxisScrollTool();
_NevronChart.Controller.Tools.Add(_AxisScrollTool);

//behaves strangly with "normal" data / application crash with larger data when chart is initialized again:
_DataZoomTool = new NDataZoomTool();
_NevronChart.Controller.Tools.Add(_DataZoomTool);

_AxisScrollTool = new NAxisScrollTool();
_NevronChart.Controller.Tools.Add(_AxisScrollTool);

_NevronChart.Controller.Tools.Add(new NSelectorTool());

Best regards,
Joern



Similar Topics


Reading This Topic