Found a possible bug in LightningChart? Report it here.
Moderator: Queue Moderators
-
frank
- Posts: 51
- Joined: Tue Mar 25, 2014 9:04 am
Post
by frank » Mon Apr 13, 2015 6:57 am
Up to a new release shortly I colud use the following code, having RightToLeft Zoomout enabled:
Code: Select all
private void BeforeZooming(List<RangeChangeInfo> xRanges, List<RangeChangeInfo> yRanges, bool byWheel, ref bool cancel)
{
...
IsZooming = !(Equals(xRanges[0].NewMin, RangeXMin) && Equals(xRanges[0].NewMax, RangeXMaximum));
...
}
But now it crashes when the chart is zoomed out and the user performs another RightToLeft-Event because xRanges is empty. I'm catching this case already, but this behaviour was new to me.
-
ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
-
Contact:
Post
by ArctionPasi » Tue Apr 14, 2015 12:48 pm
Hi Frank,
I'm not able to reproduce the problem.
Code: Select all
using Arction.WPF.LightningChartUltimate;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
LightningChartUltimate m_chart;
public MainWindow()
{
InitializeComponent();
m_chart = new LightningChartUltimate();
gridMain.Children.Add(m_chart);
m_chart.BeginUpdate();
m_chart.ViewXY.ZoomPanOptions.RightToLeftZoomAction = RightToLeftZoomAction.ZoomOut;
m_chart.ViewXY.BeforeZooming += ViewXY_BeforeZooming;
m_chart.EndUpdate();
}
void ViewXY_BeforeZooming(List<RangeChangeInfo> xRanges, List<RangeChangeInfo> yRanges, bool byWheel, ref bool cancel)
{
if (xRanges == null || xRanges.Count == 0 || yRanges == null || yRanges.Count == 0)
{
System.Diagnostics.Debug.WriteLine("Something missing");
}
bool bZooming = !(Equals(xRanges[0].NewMin, m_chart.ViewXY.XAxes[0].Minimum) && Equals(xRanges[0].NewMax, m_chart.ViewXY.XAxes[0].Maximum));
if (bZooming)
System.Diagnostics.Debug.WriteLine("Zooming");
else
System.Diagnostics.Debug.WriteLine("NOT Zooming");
}
}
}
Output window shows "Zooming" message only. If params are null or empty, it should say "Something missing" instead.
Can you modify the project until the error appears?
LightningChart Support Team, PT
-
frank
- Posts: 51
- Joined: Tue Mar 25, 2014 9:04 am
Post
by frank » Wed Apr 15, 2015 6:22 am
Sure. Please have a look at the attached sample.
Best regards,
Frank
-
Attachments
-
- WpfApplication3_2.zip
- (38.83 KiB) Downloaded 1002 times
-
ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
-
Contact:
Post
by ArctionPasi » Wed Apr 15, 2015 8:17 am
Thanks.
Only the Y axes that are set to zoom, are enlisted in List<RangeChangeInfo> yRanges.
In the code you sent, Y axes zooming is disabled:
_chart.ViewXY.ZoomPanOptions.RectangleZoomDirection = RectangleZoomDirection.Horizontal
X axes are zoomed only.
If _chart.ViewXY.ZoomPanOptions.RectangleZoomDirection = RectangleZoomDirection.Vertical, xRanges list is empty.
If _chart.ViewXY.ZoomPanOptions.RectangleZoomDirection = RectangleZoomDirection.Both, xRanges and yRanges list are both filled. Provided that each axis.ZoomingEnabled = true.
We have lately modified zooming features a lot and some changes are inevitable. I'm sorry this has caused confusion for you.
LightningChart Support Team, PT
-
frank
- Posts: 51
- Joined: Tue Mar 25, 2014 9:04 am
Post
by frank » Wed Apr 15, 2015 8:36 am
Hi Pasi,
Only the Y axes that are set to zoom, are enlisted in List<RangeChangeInfo> yRanges.
As you can see in my first post, I'm talking about the xRanges
doesn't work any more.
Regards,
Frank
-
ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
-
Contact:
Post
by ArctionPasi » Wed Apr 15, 2015 9:23 am
If new range is same than the old range, it seems to RangeChangeInfo item with a null axis object and NewMin and NewMax = 0 in the xRanges list.
You have set
_chart.ViewXY.ZoomPanOptions.RightToLeftZoomAction = RightToLeftZoomAction.RevertAxisRanges
And by applying right-to-left action twice in row will cause the problem to appear, because the revert values are not changed in your code.
For now, please just check if the RangeChangeInfo's Axis is 'null' and if it is, don't do anything with it.
I'll issue a fix process so that not-changed axes don't add empty items in the lists.
LightningChart Support Team, PT