Hover and TLineSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
arekay
Newbie
Newbie
Posts: 3
Joined: Mon Jul 17, 2017 12:00 am

Hover and TLineSeries

Post by arekay » Thu Oct 26, 2017 5:47 pm

I get strange hovering behavior with a simple TLineSeries in VCL. In this example, my cursor is over the third point in the line, which is highlighted correctly, but only the first segment (connection between two points) is highlighted. The highlighted segment is always one behind the point being hovered on; if I highlight the fourth (rightmost) point, the second segment is highlighted. Is this supposed to happen? I would like to turn off the segment highlighting while keeping the point highlighting, but I cannot find a way to do it.
hover.png
hover.png (14.91 KiB) Viewed 13720 times

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Fri Oct 27, 2017 8:32 am

Hello,
arekay wrote:I get strange hovering behavior with a simple TLineSeries in VCL. In this example, my cursor is over the third point in the line, which is highlighted correctly, but only the first segment (connection between two points) is highlighted. The highlighted segment is always one behind the point being hovered on; if I highlight the fourth (rightmost) point, the second segment is highlighted. Is this supposed to happen?
It seems to work fine for me with TeeChart Pro v2017.22. What version are you using?
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
arekay wrote: I would like to turn off the segment highlighting while keeping the point highlighting, but I cannot find a way to do it.
I'm afraid this shoudl be done manually. Ie:

Code: Select all

var ClickedIndex: Integer;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Selected.Hover.Visible:=False;

  Series1.OnGetPointerStyle:=Series1GetPointerStyle;
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var i, ValueIndex : Integer;
    tmpP          : TPoint;
begin
  ClickedIndex:=Series1.Clicked(X, Y);

  tmpP:=Point(Series1.CalcXPos(ClickedIndex), Series1.CalcYPos(ClickedIndex));
  if Series1.Pointer.Clicked(Series1.Pointer.Style, tmpP, Chart1.GetCursorPos.X, Chart1.GetCursorPos.Y) then
     Chart1.Draw
  else
     ClickedIndex:=-1;
end;

function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  with (Sender as TLineSeries).Pointer do
  begin
    result:=Style;
    Brush.Color:=Sender.Color;
    Pen.Color:=clBlack;

    if (ValueIndex<>-1) and (ClickedIndex=ValueIndex) then
       Pen.Color:=clRed;
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

arekay
Newbie
Newbie
Posts: 3
Joined: Mon Jul 17, 2017 12:00 am

Re: Hover and TLineSeries

Post by arekay » Fri Oct 27, 2017 3:31 pm

Thank you for your reply. I am using v2017.22.170619, in C++ Builder 10.2.1.

It looks like the problem arises because the bottom axis is inverted. The code below shows this in 2D; 3D behavior is even more bizarre-looking. It appears that nobody implemented counting backwards for hovering.

Code: Select all

TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
	Chart1->BottomAxis->Inverted = true;
	Chart1->View3D = false;

	Series1->AddXY(0.,0.,"",clTeeColor);
	Series1->AddXY(1.,1.,"",clTeeColor);
	Series1->AddXY(3.,2.,"",clTeeColor);
	Series1->AddXY(4.,1.,"",clTeeColor);
	Series1->AddXY(6.,4.,"",clTeeColor);
}

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Mon Oct 30, 2017 3:06 pm

Hello,

I've added it to the public tracker, and I've already fixed it for the next maintenance release:
http://bugs.teechart.net/show_bug.cgi?id=1935
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

arekay
Newbie
Newbie
Posts: 3
Joined: Mon Jul 17, 2017 12:00 am

Re: Hover and TLineSeries

Post by arekay » Tue Oct 31, 2017 1:50 am

Thanks!

Another slightly odd thing that this test showed me is that in 3D mode the line segment between two points can be hovered over, but in 2D mode only the points can be hovered over. Is this intentional? Can line hovering be added for 2D, or made optional?

Actually, an idea that would make hovering better for my application, and maybe some others', would be to give the option of highlighting the line segments on both sides of the point being hovered over, rather than only the forward one (because clicking on and dragging that point will alter both line segments). If it would be possible to include an option like that in the future, it would be nice.

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Tue Oct 31, 2017 8:22 am

arekay wrote:Another slightly odd thing that this test showed me is that in 3D mode the line segment between two points can be hovered over, but in 2D mode only the points can be hovered over. Is this intentional? Can line hovering be added for 2D, or made optional?
I haven't been able to reproduce that. It worked fine for me both in 2D and in 3D.
arekay wrote:Actually, an idea that would make hovering better for my application, and maybe some others', would be to give the option of highlighting the line segments on both sides of the point being hovered over, rather than only the forward one (because clicking on and dragging that point will alter both line segments). If it would be possible to include an option like that in the future, it would be nice.
In the modifications I did for #1935 I removed the line segment highlighting when hovering a pointer.
However, the highlighting both line segments when hovering a pointer, as you request, is also an option to consider.
An idea would be to add a property (ie Pointer.HoverStyle) to select what line segments to show when hovering a pointer. I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1936
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Tue Oct 31, 2017 12:16 pm

Yeray wrote:However, the highlighting both line segments when hovering a pointer, as you request, is also an option to consider.
An idea would be to add a property (ie Pointer.HoverStyle) to select what line segments to show when hovering a pointer. I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1936
Please check the attached project to test the implementation of this new feature:
Project1.zip
(1.5 MiB) Downloaded 391 times
Your feedback will be very welcome.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Fri Nov 10, 2017 12:28 pm

As you can read in #1936 we:
Changed Pointer.HoverStyle property to HoverElement, a property for all the series, at TChartSeries. It's a set, with the possible values:

- hePrevious: Disabled by default. When active, highlights the element previous to the element below the mouse.

- heNext: Disabled by default. When active, highlight the element next to the element below the mouse.

- heCurrent: Enabled by default. When active, highlights the element below the mouse.

- heJoin: Disabled by default. When active, Pointer and Mark are treated as the same hover element.

Elements are: line segments, area segments, pointers, or pointer+mark.

See the project attached to test all the new properties
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

arekay
Newbie
Newbie
Posts: 2
Joined: Thu Jul 19, 2018 12:00 am

Re: Hover and TLineSeries

Post by arekay » Sat Aug 18, 2018 10:52 pm

Thank you for your help on this last year, and the enhancement. However, it appears that hovering is no longer enabled on TArrowSeries. It was working last year; can be it put back in?

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Mon Aug 20, 2018 8:17 am

Hello,

Indeed, it seems that the fix for #1936 broke the hover for the TArrowSeries. I've now fixed it at #2078.
Thanks for reporting it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

konzeptum_sd
Newbie
Newbie
Posts: 2
Joined: Mon Jan 14, 2019 12:00 am
Contact:

Re: Hover and TLineSeries

Post by konzeptum_sd » Tue Dec 10, 2019 10:19 am

Hello,

I'd like to revive this thread as it seems to me that TGanttSeries is also affected.
The hover/highlighting I'm used to from an earlier version is gone after the upgrade to TeeChart Pro v2019.27.190530 (32bit VCL).

I would appreciate you checking into it.
Thank you in advance.

All the best,
Stefan

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Thu Dec 12, 2019 8:39 am

Hello,

Indeed there seems to be some problem with the Hover feature in the TGanttSeries.
However, it doesn't look related to the fix for #1936. I've checked it didn't work either with v2018.25, the version previous to that fix.
I've added this as a new ticket in the public tracker here:
http://bugs.teechart.net/show_bug.cgi?id=2269
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hover and TLineSeries

Post by Yeray » Thu Dec 12, 2019 9:12 am

Hello again,

I've just found the fix for #2269.
If you own the sources you can apply the fix with a couple of modifications in GanttCh.pas:

- Add this at the end of TGanttSeries.ClickPointer function:

Code: Select all

Function TGanttSeries.ClickedPointer( ValueIndex,tmpX,tmpY:Integer;
                                      x,y:Integer):Boolean;
begin
//...

  if result then
     IClickedPart:=scpPointer;
end;
- At TGanttSeries.DrawValue procedure, change this:

Code: Select all

    PrepareHoverPen(ValueIndex);
For this:

Code: Select all

    PreparePointerHoverPen(ValueIndex);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

konzeptum_sd
Newbie
Newbie
Posts: 2
Joined: Mon Jan 14, 2019 12:00 am
Contact:

Re: Hover and TLineSeries

Post by konzeptum_sd » Thu Dec 12, 2019 5:38 pm

Hello,

thank you for the quick reaction and fix.
I'm using a license without source code, so I'll just wait for the next version.

All the best,
Stefan

Post Reply