Limiting axis range to limits
Posted: Thu Jun 06, 2013 1:34 pm
I want to limit the range of X axis between 0 and 20, preventing the user to pan or zoom to beyond those limits. How to achieve that?
A place for LightningChart Ultimate related Q&A's.
https://lightningchart.com/forum/
Code: Select all
void ExamplePointLineSeriesXY_RangeChanged(double newMin, double newMax, AxisBase axis, ref bool cancelRendering)
{
double LimitMin = 0;
double LimitMax = 20;
double dMin = newMin;
double dMax = newMax;
bool bLimited = false;
if (newMin < LimitMin)
{
dMin = LimitMin;
bLimited = true;
}
if (newMax > LimitMax)
{
dMax = LimitMax;
bLimited = true;
}
if (bLimited)
{
cancelRendering = true; //Cancel the ongoing rendering phase
axis.SetRange(dMin, dMax); //Render manually here
}
}
Code: Select all
lightingChartUltimate1.ViewXY.XAxes[0].here