Page 1 of 1

Formatting bug with a strange fix

Posted: Thu Dec 17, 2020 11:17 pm
by 16587426
We were getting a formatting bug with a series in our application. We are using the .LeftAxis.LabelsFormat.TextFormat := ttfHtml setting and the left axis appeared correctly until the mouse hovered over it--then it appeared with the html formatting. Here are two images, showing what was happening:

Image

I tried creating a demo of it and could not, evening copying the exact objects and code.

I gave it to another programmer and he found a fix: a design-time there is a chart bar series in the chart that he removed and re-rand the program and it now displays correctly. The Chart.FreeAllSeries method is called in code before creating a new series--so I don't understand what is happening.

I only put this here as a bookmark--there is no action needed. Just as an FYI, and in case someone else sees something like this.

Ed Dressel

Re: Formatting bug with a strange fix

Posted: Mon Dec 21, 2020 11:52 am
by yeray
Hello,

I've been trying to reproduce the problem in a simple project but I had the same luck than you.
Anyway I'm posting here the code in case it needs to be revised in the future:

Code: Select all

var i: Integer;
begin
  AddSeries(THorizBarSeries);
  Chart1[0].Visible:=False;
  AddSeries(THorizBarSeries);

  with Chart1[1] do
  begin
    Marks.Hide;
    for i:=0 to Count-1 do
      Labels[i]:='<b>Point ' + IntToStr(i)+'</b>' + sLineBreak + ValueMarkText[i];
  end;

  Chart1.Axes.Left.LabelsFormat.TextFormat:=ttfHtml;