Hi Lance,
You cannot modify the major tick mode in response to ruler range change event. This is because at the time when it is fired the axis is already configured and there is no way to skip a paint that has already commenced.
We just released a SP that allows you to install a custom step provider to the axis - the following code shows how to use the MajorTickMode.CustomStepProvider feature:
using System;
using System.Windows.Forms;
using Nevron.Chart;
using Nevron.Chart.Windows;
using Nevron.Collections;
using Nevron.Reflection;
namespace WindowsFormsApplication9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class CustomStepProvider : NNumericStepProvider
{
#region Constructors
public CustomStepProvider(NAxis axis)
{
m_Axis = axis;
NDoubleList steps = new NDoubleList();
steps.Add(5);
m_CustomStepProvider.Steps = steps;
}
#endregion
#region Overrides
public override void CalculateSteps(Nevron.GraphicsCore.NLengthConverter lengthConverter, Nevron.GraphicsCore.NRange1DD range, float length)
{
if (m_Axis.PagingView.Enabled)
{
m_CustomStepProvider.CalculateSteps(lengthConverter, range, length);
}
else
{
m_AutoStepProvider.CalculateSteps(lengthConverter, range, length);
}
}
public override Nevron.Collections.NDoubleList ProvideSteps()
{
if (m_Axis.PagingView.Enabled)
{
return m_CustomStepProvider.ProvideSteps();
}
else
{
return m_AutoStepProvider.ProvideSteps();
}
}
public override object Clone()
{
CustomStepProvider newStepProvider = new CustomStepProvider(m_Axis);
newStepProvider.m_AutoStepProvider = (NAutoNumericStepProvider)m_AutoStepProvider.Clone();
newStepProvider.m_CustomStepProvider = (NCustomNumericStepProvider)m_CustomStepProvider.Clone();
return newStepProvider;
}
#endregion
#region Fields
[NReferenceField]
NAxis m_Axis;
NAutoNumericStepProvider m_AutoStepProvider = new NAutoNumericStepProvider();
NCustomNumericStepProvider m_CustomStepProvider = new NCustomNumericStepProvider();
#endregion
}
private void Form1_Load(object sender, EventArgs e)
{
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
NRangeSelection rs = new NRangeSelection();
chart.RangeSelections.Add(rs);
NBarSeries bar = new NBarSeries();
chart.Series.Add(bar);
for (int i = 0; i < 100; i++)
{
bar.Values.Add(i);
}
NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
scaleY.MajorTickMode = MajorTickMode.CustomStepProvider;
scaleY.CustomStepProvider = new CustomStepProvider(chart.Axis(StandardAxis.PrimaryY));
nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
nChartControl1.Controller.Tools.Add(new NDataZoomTool());
}
}
}
Hope this helps - let us know if you meet any problems or have any questions.
Best Regards,
Nevron Support Team