Profile Picture

Axis Range Change Event

Posted By Lou Laskey 14 Years Ago
Author
Message
Lou Laskey
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 24, Visits: 2
I am displaying waveforms with a SmoothLine Series and the charts X and Y axis uses custom tick values.

The axes can be set to a fixed range or an auto range per user settings.

To keep the grid looking the way I want I need to know, preferably via an event, when an axis range changes so I can set the custom ticks to look right.

Is there any event that is generated when an axis range changes or one that I can discern that an axis range has changed?

I have tried ValidationChanged, Paint and several others to no avail.

Any help would be appreciated.

TIA,
Lou


Nevron Support
Posted 14 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: Last Week
Posts: 3,054, Visits: 4,009

Hi Lou,

There is no axis range changed event - we can easliy add one however it will be fired at paint time, as the chart gets calculated. You can work around this by recalculating the chart and simulating this event. For example:

using System;
using System.Windows.Forms;
using Nevron.Chart;
using Nevron.GraphicsCore;

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

  private void Form1_Load(object sender, EventArgs e)
  {
  }

  private void button1_Click(object sender, EventArgs e)
  {
   NChart chart = nChartControl1.Charts[0];
   NAxis axis = chart.Axis(StandardAxis.PrimaryY);

   // get old axis range
   NRange1DD range = axis.Scale.RulerRange;

   NBarSeries bar = new NBarSeries();
   Random rand = new Random();

   bar.Values.Add(rand.Next(100));
   bar.Values.Add(rand.Next(100));
   chart.Series.Add(bar);

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

   if (!axis.Scale.RulerRange.Equals(range))
   {
    // range has changed
    MessageBox.Show("Range Changed");
   }

   nChartControl1.Refresh();
  }
 }
}

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



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic