Profile Picture

NDataZoomTool set inflates to zero

Posted By Ereona 12 Years Ago
Author
Message
Ereona
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 43, Visits: 1
Hello.
I configure the chart axis so it has autoscale with absolute inflate:

NLinearScaleConfigurator linearConfigurator = new NLinearScaleConfigurator();
linearConfigurator.MajorTickMode = MajorTickMode.AutoMinDistance;
linearConfigurator.AutoMinorTicks = true;
linearConfigurator.ViewRangeInflateMode = ScaleViewRangeInflateMode.Absolute;
linearConfigurator.AbsoluteInflate = new NRange1DL(10, 10);
axis.ScaleConfigurator = linearConfigurator;

And I have the tools for data zooming:

_chartControl.Controller.Tools.Add(new NSelectorTool());
_chartControl.Controller.Tools.Add(new NAxisScrollTool());
_chartControl.Controller.Tools.Add(new NDataPanTool());
_chartControl.Controller.Tools.Add(new NDataZoomTool());

I met the problem that when the scrollbars are visible, absolute inflates seems to be zero (data points display close to chart bounds).

I have this problem only with Nevron version 2012. If I run the same code with the 2010 year version everything is correct (inflates persist).

Here is the full code that demonstrates the problem:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

InitChartControl();
}

private void InitChartControl()
{
_chartControl = new NChartControl();
this._chartControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.Controls.Add(_chartControl);

_cartesianChart = (NCartesianChart)_chartControl.Charts[0];

NRangeSelection rangeSelection = new NRangeSelection();
rangeSelection.VerticalValueSnapper = new NAxisRulerClampSnapper();
rangeSelection.HorizontalValueSnapper = new NAxisRulerClampSnapper();
_cartesianChart.RangeSelections.Add(rangeSelection);

InitAxis(_cartesianChart.Axis(StandardAxis.PrimaryX));
InitAxis(_cartesianChart.Axis(StandardAxis.PrimaryY));

_chartControl.Controller.Tools.Add(new NSelectorTool());
_chartControl.Controller.Tools.Add(new NAxisScrollTool());
_chartControl.Controller.Tools.Add(new NDataPanTool());
_chartControl.Controller.Tools.Add(new NDataZoomTool());

generateData();

_chartControl.Refresh();
}

private void InitAxis(NAxis axis)
{
axis.ScrollBar.Visible = true;
axis.ScrollBar.ShowSliders = true;
axis.ScrollBar.ViewRangeChanged += new EventHandler(OnScrollBarViewRangeChanged);

axis.PagingView = new NNumericAxisPagingView();
axis.PagingView.ResetMode = PagingViewResetMode.View;

NLinearScaleConfigurator linearConfigurator = new NLinearScaleConfigurator();
linearConfigurator.MajorTickMode = MajorTickMode.AutoMinDistance;
linearConfigurator.AutoMinorTicks = true;
linearConfigurator.ViewRangeInflateMode = ScaleViewRangeInflateMode.Absolute;
linearConfigurator.AbsoluteInflate = new NRange1DL(10, 10);
axis.ScaleConfigurator = linearConfigurator;
}

private void OnScrollBarViewRangeChanged(object sender, EventArgs e)
{
_chartControl.Refresh();
}

private void generateData()
{
NLineSeries line = (NLineSeries)_cartesianChart.Series.Add(SeriesType.Line);
line.Name = "Line Series";
line.DataLabelStyle.Visible = false;
line.UseXValues = true;
line.FillStyle = new NColorFillStyle(Color.Black);

double measureXValue = 1;
double measureValue = 82;
int pointsNumber = 20;
for (int i = 0; i < pointsNumber; i++)
{
line.AddDataPoint(new NDataPoint(measureXValue, measureValue));
measureValue -= 4;
measureXValue += 3;
}
}

private NChartControl _chartControl;

private NCartesianChart _cartesianChart;
}




Similar Topics


Reading This Topic