Hi,
I have a SciChartSurfacewith one xaxis an four yaxis and a dynamic number of series which are added at runtime.
Also I have some modifiers especially the ZoomExtentsModifier( ExecuteOn=”MouseDoubleClick” XyDirection=”XDirection”) and for each yaxis a yaxisdragmodifier.
Is it possible to double click on a single yaxis and ZoomExtends only this yaxis?
Regards Markus
- You must login to post comments
Hi Markus,
I think you’ll need to create a custom modifier to do this, but it shouldn’t be too hard. Head over to our KnowledgeBase to see articles on Custom Chart Modifiers.
- You’ll need to create a class which inherits ChartModifierBase
- You’ll need to override OnModifierDoubleClick()
- You’ll need to use this code to detect whether the double-click occurred on an Axis or not
- You’ll need to use this code to ZoomExtents on one axis
If you come up with a good solution, feel free to post it here as a code sample!
Best regards,
Andrew
- Andrew Burnett-Thompson answered 10 years ago
- Perfect, that's a good starting point. Thank You!
- You must login to post comments
So here is my CustomZoomExtendsModifier:
Depending on where you make a double click (Chart, XAxis, YAxis) it zooms to its maximum range.
public class CustomZoomExtendsModifier : ChartModifierBase
{
public override void OnModifierDoubleClick(ModifierMouseArgs e)
{
bool isOnChart = IsPointWithinBounds(e.MousePoint, ModifierSurface);
foreach(var yAxis in YAxes)
{
if(IsPointWithinBounds(e.MousePoint, yAxis))
{
var range = yAxis.GetMaximumRange();
yAxis.AnimateVisibleRangeTo(range, TimeSpan.FromMilliseconds(500));
}
}
foreach(var xAxis in XAxes)
{
if(IsPointWithinBounds(e.MousePoint, xAxis))
{
var range = xAxis.GetMaximumRange();
xAxis.AnimateVisibleRangeTo(range, TimeSpan.FromMilliseconds(500));
}
}
if(isOnChart)
{
this.ParentSurface.AnimateZoomExtents(TimeSpan.FromMilliseconds(500));
}
e.Handled = true;
base.OnModifierDoubleClick(e);
}
}
Regards Markus
- Rupertsberger Markus answered 10 years ago
- You must login to post comments
Please login first to submit.