TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
TLC
- Newbie
- Posts: 77
- Joined: Mon Apr 08, 2019 12:00 am
Post
by TLC » Tue Oct 29, 2024 6:59 pm
Steema.TeeChart.Tools.NearestPoint Change event doesn't trigger because the
kind parameter is never
MouseEventKinds.Move. I clicked and dragged on the chart but it never triggered. Only the down and up events fired.
Code: Select all
protected internal override void MouseEvent( MouseEventKinds kind, MouseEventArgs e, ref Cursor c)
{
if (kind != MouseEventKinds.Move || this._iSeries == null)
return;
Also please change the Change event signature from
Code: Select all
public event EventHandler Change;
to
Code: Select all
public event EventHandler<int> Change;
or
where the int parameter is the current point index.
-
Marc
- Site Admin
- Posts: 1274
- Joined: Thu Oct 16, 2003 4:00 am
- Location: Girona
-
Contact:
Post
by Marc » Mon Nov 04, 2024 8:52 am
Hello,
Apologies for the delay with this reply, we are investigating and will apply a fix for the next update and are checking if any temporary workaround is possible.
Regards,
Marc Meumann
Steema Support
-
Marc
- Site Admin
- Posts: 1274
- Joined: Thu Oct 16, 2003 4:00 am
- Location: Girona
-
Contact:
Post
by Marc » Mon Nov 04, 2024 9:22 am
...this has been checked for desktop versions (no problems found) but now notice from other posts you have made, that this issue may be related to Xamarin. Is that correct? ..or MAUI? I see your attached file includes Xamarin installation to the IDE.
With thanks.
Regards,
Marc
Steema Support
-
TLC
- Newbie
- Posts: 77
- Joined: Mon Apr 08, 2019 12:00 am
Post
by TLC » Tue Nov 05, 2024 3:19 pm
Yes its on MAUI. THe workaround if found was to do the following:
Code: Select all
protected override void MouseEvent( MouseEventKinds kind, MouseEventArgs e, ref Cursor c )
{
if ( _iSeries is null ) { return; }
Point point = new(e.X, e.Y);
int index = GetNearestPoint( point );
_viewModel.SetCurrentPointIndex( index );
base.MouseEvent( kind, e, ref c );
}
-
TLC
- Newbie
- Posts: 77
- Joined: Mon Apr 08, 2019 12:00 am
Post
by TLC » Wed Nov 13, 2024 9:24 pm
the work around doesn't really work afterall-- it's always at the first point. doesn't change no matter where i click or drag.
-
TLC
- Newbie
- Posts: 77
- Joined: Mon Apr 08, 2019 12:00 am
Post
by TLC » Thu Nov 14, 2024 10:27 pm
So i found the cause... and it's a few issues from the source code:
Most of it is instead of leaving the value as a double, you are converting it to an int. This is a loss of precision and can greatly affect the developer when trying to figure out which point the end users has pressed. This happens ALOT in the MAUI library and was not the case in Xamarin.Forms. so i consider this a
major regression.
- The when calling DoMouseMove the parameters passed to it are (int) e.TotalX, (int) e.TotalY. After some research and troubleshooting, the TotalX and TotalY are an offset from the start, not the current point, which means that the (x, y) propagated is invalid, and is missing the precision due to the cast to int.
Code: Select all
private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
{
Cursor c = (Cursor) null;
MouseEventArgs mouseEventArgs1 = new MouseEventArgs(MouseButtons.Left, 1, (int) e.TotalX, (int) e.TotalY, 0);
if (e.StatusType == GestureStatus.Completed)
{
MouseEventArgs mouseEventArgs2 = new MouseEventArgs(MouseButtons.Left, 1, this.oldTotalX, this.oldTotalY, 0);
}
else if (e.StatusType == GestureStatus.Started)
{
Microsoft.Maui.Graphics.Point? nullable = new Microsoft.Maui.Graphics.Point?(new Microsoft.Maui.Graphics.Point(this.TranslationX, this.TranslationY));
Microsoft.Maui.Graphics.Point point = nullable.Value;
int x = (int) point.X;
point = nullable.Value;
int y = (int) point.Y;
MouseEventArgs mouseEventArgs3 = new MouseEventArgs(MouseButtons.Left, 1, x, y, 0);
}
else
{
this.oldTotalX = mouseEventArgs1.X;
this.oldTotalY = mouseEventArgs1.Y;
this.Chart.DoMouseMove((int) e.TotalX, (int) e.TotalY, ref c);
}
}
- When tapped, it works as expected. However i had to add my own TapGestureRecognizer in order for it to work, but I am not missing the precision due to not casting to int.
Code: Select all
protected virtual void TChart_Tap(object sender, TappedEventArgs e)
{
Microsoft.Maui.Graphics.Point? position = e.GetPosition((Element) sender);
Microsoft.Maui.Graphics.Point point = position.Value;
int x = (int) point.X;
point = position.Value;
int y = (int) point.Y;
this.Chart.DoMouseDown(false, new MouseEventArgs(MouseButtons.Left, 1, x, y, 0), Keys.None);
}
-
Pep
- Site Admin
- Posts: 3306
- Joined: Fri Nov 14, 2003 5:00 am
-
Contact:
Post
by Pep » Fri Nov 15, 2024 6:43 am
Hello,
many thanks for all your contributions and comments.
We're just working on this area (zoom and panning) in order to improve them, specially on mobile devices. We'll consider all and aill update a new maintenance release that includes this changes.
Thanks again, and if we can be help on something let us know.