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

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
NatSam
Newbie
Newbie
Posts: 13
Joined: Fri Dec 09, 2016 12:00 am

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

Post by NatSam » Sat Jan 28, 2017 1:10 pm

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.
Attachments
group.zip
Sample project and print screen
(116.24 KiB) Downloaded 756 times
Samuel (NatSam)

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Mon Jan 30, 2017 11:51 am

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

NatSam
Newbie
Newbie
Posts: 13
Joined: Fri Dec 09, 2016 12:00 am

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

Post by NatSam » Mon Jan 30, 2017 4:29 pm

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
Samuel (NatSam)

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Tue Jan 31, 2017 8:17 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

NatSam
Newbie
Newbie
Posts: 13
Joined: Fri Dec 09, 2016 12:00 am

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

Post by NatSam » Tue Jan 31, 2017 2:04 pm

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
Attachments
group_2.zip
Sample project
(88.56 KiB) Downloaded 813 times
Samuel (NatSam)

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Tue Jan 31, 2017 3:00 pm

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 15574 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

NatSam
Newbie
Newbie
Posts: 13
Joined: Fri Dec 09, 2016 12:00 am

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

Post by NatSam » Tue Jan 31, 2017 5:17 pm

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
Samuel (NatSam)

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Wed Feb 01, 2017 7:28 am

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?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

NatSam
Newbie
Newbie
Posts: 13
Joined: Fri Dec 09, 2016 12:00 am

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

Post by NatSam » Wed Feb 01, 2017 1:06 pm

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.
Samuel (NatSam)

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » Thu Feb 02, 2017 7:18 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply