Profile Picture

Which event for Zooming

Posted By Frank Thiesing 13 Years Ago
Author
Message
Frank Thiesing
questionmark Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 5, Visits: 1
Hello,

i use a Nevron-Chart, their i use zoom. Now i need the range from my X-Axis after zoom. I tried it with HorizontalAxisRangeChanged-Event. But this event is fired the hole time i am select the part in my chart.


void rangeSelection_HorizontalAxisRangeChanged(object sender, EventArgs e)
{
NRangeSelection nrs = (NRangeSelection)sender;
Console.WriteLine(nrs.HorizontalAxisRange.Begin + " " + nrs.HorizontalAxisRange.End);
Console.WriteLine(cartesianChart.Axis(StandardAxis.PrimaryX).PageRange.Begin + " | " + cartesianChart.Axis(StandardAxis.PrimaryX).PageRange.End);
}
After zoom i will call a method, but it would be hard to call this method more than once.
Can you help please.

best regards

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 Frank,

You can intercept the data zoom end drag event and get the axis ruler range from there - for example:

  private void Form1_Load(object sender, EventArgs e)
  {
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

   NBarSeries bar = new NBarSeries();

   bar.Values.Add(10);
   bar.Values.Add(20);
   bar.Values.Add(30);

   chart.Series.Add(bar);

   chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

   NRangeSelection rs = new NRangeSelection();
   chart.RangeSelections.Add(rs);

   nChartControl1.Controller.Tools.Add(new NSelectorTool());
   NDataZoomTool dzt = new NDataZoomTool();
   dzt.EndDrag += new EventHandler(dzt_EndDrag);
   nChartControl1.Controller.Tools.Add(dzt);
  }

  void dzt_EndDrag(object sender, EventArgs e)
  {
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

   nChartControl1.Document.Calculate();
   nChartControl1.Document.RecalcLayout(nChartControl1.View.Context);

   NRange1DD xAxisRange = chart.Axis(StandardAxis.PrimaryX).Scale.RulerRange;
   textBox1.Text = "X: " + xAxisRange.Begin.ToString() + " Y: " + xAxisRange.End.ToString();
  }

Hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team



Frank Thiesing
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 5, Visits: 1
Hello,

thanks for your help, it works.
Now i get the begin and the end of my range selection. I configure my xaxis in a datetime format.
Is there a way to convert the double value i get from selection to a DateTime-Value?

best regards

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 Frank,

Yes - you should use FromOADate:

DateTime dt = DateTime.FromOADate(someDoubleValue);



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic