Page 1 of 1

MAJOR XY Series Marks BUG!!

Posted: Thu Jul 11, 2013 11:08 pm
by 16556683
I've just updated to XE4 and the latest version of TChart (2013.08.130521 32 bit). I have a couple of applications which use x-y charts with labels for each point. These have stopped working correctly. The point labels are not longer displayed. Instead the Y values are displayed. This "breaks" my application.

I've uploaded a test project which demonstates the problem. It should deplay all the letters of the alphabet from A to Z at random point. IT doesn't. Some Y-values are show instead.

Image

You can download the Delphi XE4 app here:

https://dl.dropboxusercontent.com/u/112 ... roblem.zip

I hope this can be fixed ASAP!!

Thanks,

Steve

Re: MAJOR XY Series Marks BUG!!

Posted: Fri Jul 12, 2013 3:15 pm
by narcis
Hi Steve,

Thanks for reporting. We could reproduce the issue here in XE4. It works fine in other Delphi versions. Anyway, I have added it (TV52016639) to the defect list to be investigated and fixed for next releases.

Re: MAJOR XY Series Marks BUG!!

Posted: Fri Jul 12, 2013 5:33 pm
by 16556683
This is a major issue for me. Can you send the source code changes once the corrections have been made?

Thanks,

Steve

Re: MAJOR XY Series Marks BUG!!

Posted: Mon Jul 15, 2013 7:10 am
by narcis
Hi Steve,

Ok, I'll add a note on the bug description to send them when fixed.

Re: MAJOR XY Series Marks BUG!!

Posted: Mon Jul 15, 2013 12:19 pm
by 16556683
Thanks Narcis,

Note that I cannot go back to an earlier version. This is the only version for XE4 and it's a breaking change. So can I kindly ask it's fixed ASAP.

Thanks,

Steve

Re: MAJOR XY Series Marks BUG!!

Posted: Mon Jul 15, 2013 12:45 pm
by narcis
Hi Steve,

A workaround is using the OnGetMarkText creating the labels again:

Code: Select all

procedure TForm1.Series1GetMarkText(Sender: TChartSeries; ValueIndex: Integer;
  var MarkText: string);
begin
  MarkText:=Chr(Ord('A') + ValueIndex);
end;

Re: MAJOR XY Series Marks BUG!!

Posted: Mon Jul 15, 2013 1:06 pm
by 16556683
That works for the simple demo. However I need to access the Label text and this seems to get scrambled. If you add the following to the demo and associate it with Series1:

Code: Select all

procedure TForm1.Series1GetMarkText(Sender: TChartSeries; ValueIndex: Integer; var MarkText: string);
begin
  MarkText := Series1.Labels[ValueIndex];
end;
It unfortunately still doesn't work :(

So it is a serious error!!

Thanks,

Steve

Re: MAJOR XY Series Marks BUG!!

Posted: Wed Jul 17, 2013 10:10 am
by yeray
Hi Steve,
Steve Maughan wrote: However I need to access the Label text and this seems to get scrambled
Could you please tell us how are you exactly accessing the label text? Maybe we can suggest some workaround while the problem persists.

Re: MAJOR XY Series Marks BUG!!

Posted: Wed Jul 17, 2013 1:02 pm
by 16556683
Hi Yeray,

I've attached an updated demo of the error. I access the labels in the GetMarkText event and the error still persists.

Can this be sorted out soon? I can't believe I'm the only user with the problem as it's basic functionality which has been broken.

Thanks,

Steve

Re: MAJOR XY Series Marks BUG!!

Posted: Thu Jul 18, 2013 9:12 am
by yeray
Hi Steve,

Extending the workaround NarcĂ­s suggested above, you could store your labels in an array, and use it instead of Labels[ValueIndex]:

Code: Select all

var myLabels: array of String;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
  x, y: double;
  s: string;
begin

  Chart1.BottomAxis.LabelStyle := talValue;
  Chart1.BottomAxis.LabelsFont.Style := [];
  Chart1.BottomAxis.AutomaticMinimum := false;
  Chart1.BottomAxis.Minimum := 0;

  Series1.Clear;
  Series1.Marks.Visible := true;
  Series1.Marks.Style := smsLabel;
  Series1.OnGetMarkText := Series1GetMarkText;

  SetLength(myLabels, 26);
  for i := 0 to 25 do
  begin
    x := Random(100);
    y := Random(100);
    s := Chr(Ord('A') + i);  // <-- Each Point has the Label A to Z
    Series1.AddXY(x, y, s);
    myLabels[i]:=s;
  end;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries; ValueIndex: Integer; var MarkText: string);
begin
  MarkText := myLabels[ValueIndex];
end;

Re: MAJOR XY Series Marks BUG!!

Posted: Thu Jul 18, 2013 9:48 am
by narcis
Hi Steve,

We also have fixed the issue at TeEngine.pas. This only happens with XE4 due to series labels being Array of String instead of TList. The solution is implementing InternalInsert nested method in TLabelsList.InsertLabel method like this:

Code: Select all

  Procedure InternalInsert{$IFNDEF D18}(const P:PString){$ENDIF};
  {$IFDEF D18}
  var t : Integer;
  {$ENDIF}
  begin
    {$IFDEF D18}
    SetLength(List, Max(Count,ValueIndex)+1);

    while Count<ValueIndex-1 do
       List[Count-1]:='';

    for t:=Count-1 downto ValueIndex+1 do
        List[t]:=List[t-1];

    List[ValueIndex]:=ALabel;
    {$ELSE}

    while Count<ValueIndex do
          Add(nil);

    Insert(ValueIndex,P);
    {$ENDIF}
  end;

Re: MAJOR XY Series Marks BUG!!

Posted: Thu Jul 18, 2013 11:43 am
by 16556683
Great!

Can you send me the updated TeEngine.pas file?

Thanks,

Steve

Re: MAJOR XY Series Marks BUG!!

Posted: Thu Jul 18, 2013 11:48 am
by narcis
Hi Steve,

Sure. I just sent it to your forums contact email address.

Re: MAJOR XY Series Marks BUG!!

Posted: Thu Jul 18, 2013 12:10 pm
by 16556683
Hi Narcis,

Works!! Many thanks,

Steve