Page 1 of 1
Hover and TLineSeries
Posted: Thu Oct 26, 2017 5:47 pm
by 16481338
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 (14.91 KiB) Viewed 38034 times
Re: Hover and TLineSeries
Posted: Fri Oct 27, 2017 8:32 am
by yeray
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;
Re: Hover and TLineSeries
Posted: Fri Oct 27, 2017 3:31 pm
by 16481338
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);
}
Re: Hover and TLineSeries
Posted: Mon Oct 30, 2017 3:06 pm
by yeray
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
Re: Hover and TLineSeries
Posted: Tue Oct 31, 2017 1:50 am
by 16481338
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.
Re: Hover and TLineSeries
Posted: Tue Oct 31, 2017 8:22 am
by yeray
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
Re: Hover and TLineSeries
Posted: Tue Oct 31, 2017 12:16 pm
by yeray
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:
Your feedback will be very welcome.
Re: Hover and TLineSeries
Posted: Fri Nov 10, 2017 12:28 pm
by yeray
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
Re: Hover and TLineSeries
Posted: Sat Aug 18, 2018 10:52 pm
by 16484009
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?
Re: Hover and TLineSeries
Posted: Mon Aug 20, 2018 8:17 am
by yeray
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.
Re: Hover and TLineSeries
Posted: Tue Dec 10, 2019 10:19 am
by 16485376
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
Re: Hover and TLineSeries
Posted: Thu Dec 12, 2019 8:39 am
by yeray
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
Re: Hover and TLineSeries
Posted: Thu Dec 12, 2019 9:12 am
by yeray
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:
For this:
Code: Select all
PreparePointerHoverPen(ValueIndex);
Re: Hover and TLineSeries
Posted: Thu Dec 12, 2019 5:38 pm
by 16485376
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