Page 1 of 1

The "group slice" color in legend is not same of the slice.

Posted: Sat Jan 28, 2017 1:10 pm
by 16579726
The color of the "group slice" is not the same of slice:

Image

I´m using Delphi XE7 and Teechart (sources) 2016.19.161025.

Does anyone know how to solve this problem?

I registered this issue in Steema's support (#1757).

See sample project and print screen.

Re: The "group slice" color in legend is not same of the slice.

Posted: Mon Jan 30, 2017 11:51 am
by yeray
Hello,

Reviewing this I found it looks related to #1749 you reported here.
I believe I found a fix for both issues at the same time. It consists on adding an override of CalcLegendIndex for the TPieSeries.

Code: Select all

  protected
  //...
    Function CalcLegendIndex(LegendIndex:Integer):Integer; override;
  //...
Function TPieSeries.CalcLegendIndex(LegendIndex:Integer):Integer;
begin
  result:=LegendToValueIndex(LegendIndex);
end;

Re: The "group slice" color in legend is not same of the slice.

Posted: Mon Jan 30, 2017 4:29 pm
by 16579726
Hi,

These are two different issues.

The #1749 is about the legend text is incorrect for slices of pie:

Image

The above problem has been resolved by modifying the CalcLegendIndex() code.

The issue #1757 is about the color of "other" in legend is not the same of "Other" pie slice:

Image

Re: The "group slice" color in legend is not same of the slice.

Posted: Tue Jan 31, 2017 8:17 am
by yeray
Hello,

Yes, #1749 and #1757 are different problems but they are related. Let me try to put some order here.

- "Other" item in legend not appearing. This is reported at #1749.
Both Marc's proposal and mine solve this issue.

- "Other" symbol item in legend drawn using a wrong color. This is reported at #1757.
Only my fix proposal solves this.

- Some items not present in the legend (you indicated as "Not in legend" in the screenshot above), and some items incorrectly present. This isn't reported in any ticket, but it's highly related to #1749.
Both Marc's proposal and mine solve the issue.

- Some marks not drawn (as you indicated as "Where is the label" in the screenshot above). This isn't reported in any ticket, and none of the suggestions is fixing this.
I've created a new ticket for this: #1760.

Re: The "group slice" color in legend is not same of the slice.

Posted: Tue Jan 31, 2017 2:04 pm
by 16579726
Hello,

I did some more testing and found something that might help solve this issue.

If I set the Y values in descending order, only the caption "Other" appears in the wrong color. If I do not order Y values (default), all captions in legend appears in the wrong color.

Image

Re: The "group slice" color in legend is not same of the slice.

Posted: Tue Jan 31, 2017 3:00 pm
by yeray
Hello,

Are you using my fix proposal? This is how it looks for me with it:
Project1_2017-01-31_15-58-44.png
Project1_2017-01-31_15-58-44.png (31.93 KiB) Viewed 14508 times

Re: The "group slice" color in legend is not same of the slice.

Posted: Tue Jan 31, 2017 5:17 pm
by 16579726
Hi,

Yes, I had used your fix proposal for correction but the problem persisted.

Now I removed the Teechart from Delphi and did a new installation and this time the caption was mounted correctly :D .

With the two modifications suggested, the TeeChart appears to be working properly.

The modifications I made were:

In the VCLTee.Teeengine.pas:
Change line 3577 from "ValueIndex:=CalcLegendIndex(LegendIndex);" to "ValueIndex:=LegendToValueIndex(LegendIndex);"

In the VCLTee.TeeSerires.pas:
Add in the line 1333: Function CalcLegendIndex(LegendIndex:Integer):Integer; override;
Add after line 10481:
Function TPieSeries.CalcLegendIndex(LegendIndex:Integer):Integer;
begin
result:=LegendToValueIndex(LegendIndex);
end;

Thank you very much

Re: The "group slice" color in legend is not same of the slice.

Posted: Wed Feb 01, 2017 7:28 am
by yeray
Hello,
NatSam wrote: Now I removed the Teechart from Delphi and did a new installation and this time the caption was mounted correctly :D .
I'm glad to hear it works fine now!
NatSam wrote:In the VCLTee.Teeengine.pas:
Change line 3577 from "ValueIndex:=CalcLegendIndex(LegendIndex);" to "ValueIndex:=LegendToValueIndex(LegendIndex);"
It works fine without this modification for me if I add the one in Series.pas. Could you please confirm it so we can put the correct fix in the production version?

Re: The "group slice" color in legend is not same of the slice.

Posted: Wed Feb 01, 2017 1:06 pm
by 16579726
Hello,

I did reinstall Teechart and applied only the patch in the Series.pas and it was enough to solve the problem.

To be "perfect" you only have to solve the #1760 issue :D .

Thank you.

Re: The "group slice" color in legend is not same of the slice.

Posted: Thu Feb 02, 2017 7:18 am
by yeray
Hello,
NatSam wrote:I did reinstall Teechart and applied only the patch in the Series.pas and it was enough to solve the problem.
Good! Thanks for the feedback.
NatSam wrote:To be "perfect" you only have to solve the #1760 issue :D .
Right. Feel free to add your mail to the CC list if the ticket to be automatically notified when an update arrives.