Limiting axis range to limits
Moderator: Queue Moderators
-
- Posts: 16
- Joined: Tue Mar 26, 2013 11:01 pm
Limiting axis range to limits
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?
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Limiting axis range to limits
Set RangeChanged event handler for the X Axis:
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
}
}
LightningChart Support Team, PT
Re: Limiting axis range to limits
I would like to try this on tomorrow. But I do not have Visual Studio to hands on now. So, I would like to ask a real quick question: Where can I find the RangeChange event handler?
Is it find it here?
Is it find it here?
Code: Select all
lightingChartUltimate1.ViewXY.XAxes[0].here
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact: