Page 1 of 1

Change style of hover series on legend

Posted: Thu Nov 03, 2016 1:47 pm
by 16478065
Hello,

I want to put the series bold flew into legend, but the Legend->Selected->Hover->Font->Style property is ignored.

Code: Select all

void __fastcall TscrTestGraphe::Button3Click(TObject *Sender)
{
	TChart * Chart1 = new TChart(this);
	Chart1->Parent = this;
	Chart1->Align = alClient;
	Chart1->Legend->Selected->Hover->Font->Style = Chart1->Legend->Selected->Hover->Font->Style << fsBold; //This code has no effect

	Chart1->AddSeries(new TPointSeries(Chart1))->FillSampleValues();
}
How to do ?

Thank you

Re: Change style of hover series on legend

Posted: Fri Nov 04, 2016 12:42 pm
by yeray
Hello,

I've reproduced it so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1674

Re: Change style of hover series on legend

Posted: Mon Nov 07, 2016 7:36 am
by 16478065
Hello,

Thank you for your reply.

Pending publication of the correction, what alternative do you propose to bold the name of the hover series ?

Re: Change style of hover series on legend

Posted: Tue Nov 08, 2016 9:31 am
by yeray
Hello,

You could do this trick at OnBeforeDraw event:

Code: Select all

procedure TForm1.ChartBeforeDraw(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.Legend.Items.Count-1 do
    Chart1.Legend.Item[i].Font.Style:=Chart1.Legend.Item[i].Font.Style-[fsBold];

  if Chart1.Legend.Selected.HoverIndex>-1 then
  begin
    Chart1.Legend.Items.Custom:=true;
    Chart1.Legend.FontSeriesColor:=true;
    Chart1.Legend.Item[Chart1.Legend.Selected.HoverIndex].Font.Style:=[fsBold];
  end;
end;