TPieSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
kmanuele
Newbie
Newbie
Posts: 11
Joined: Thu Sep 25, 2014 12:00 am

TPieSeries

Post by kmanuele » Mon Sep 29, 2014 9:07 pm

TeeChart Pro v2014, XE3 Builder

I have a strange problem with new VCL version.

Using GDI, default view, 3D turned off

Clear the series, then add a number of series at runtime, setting each color directly.
The first color is defined as clRed. This is also the biggest slice.
This slice displays as black on the pie, though the mark symbol color is correctly set as red. The other slices are the correct colors.
If I turn on 3D, the pie slice turns red. Turn off 3D, the slice turns black.
If I explode the biggest slice, a red slice moves out from underneath the black slice. Apparently this slice is behind a black background.
With 3D turned on, but Views set to 2D, red slice moves behind black background.
If I change the data (in the editor) so another slice is the biggest, this one explodes correctly with the colored slice in front of the black background.
All other slices behave as expected.

Selecting GDI+ seems to fix the problem, but the background is now transparent (or there is no background).

OpenGL is available in the chart editor during design time (but not at runtime). I get an access violation at 0 if I select OpenGL.

How do I programmatically set TextQuality under 3D GDI ?

thanks

K

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

Re: TPieSeries

Post by Yeray » Tue Sep 30, 2014 10:51 am

Hello,
kmanuele wrote:Using GDI, default view, 3D turned off

Clear the series, then add a number of series at runtime, setting each color directly.
The first color is defined as clRed. This is also the biggest slice.
This slice displays as black on the pie, though the mark symbol color is correctly set as red. The other slices are the correct colors.
If I turn on 3D, the pie slice turns red. Turn off 3D, the slice turns black.
I've made a simple example with C++Builder XE7 and TeeChart Pro v2014.12 trying to reproduce this:

Code: Select all

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  this->Caption = TeeMsg_Version;

  TTeeCanvas3D * teeCanvas3D = new TTeeCanvas3D();
  Chart1->Canvas=teeCanvas3D;
  Chart1->View3D=false;

  TPieSeries * pie1 = new TPieSeries(Chart1);
  Chart1->AddSeries(pie1);
  pie1->FillSampleValues();

  int maxIndex = 0;
  for (int i=1; i<pie1->Count(); i++)
	if (pie1->YValue[i]>pie1->YValue[maxIndex])
	  maxIndex = i;

  pie1->ValueColor[maxIndex]=clRed;
}
But the result looks correct to me:
2014-09-30_1246.png
2014-09-30_1246.png (17.29 KiB) Viewed 11836 times
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
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

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

Re: TPieSeries

Post by Yeray » Wed Oct 01, 2014 9:00 am

Hello,

I've tried the same above with XE3 and TeeChart Pro v2014.12. It also seems to work fine for me here.
kmanuele wrote:If I explode the biggest slice, a red slice moves out from underneath the black slice. Apparently this slice is behind a black background.
With 3D turned on, but Views set to 2D, red slice moves behind black background.
If I change the data (in the editor) so another slice is the biggest, this one explodes correctly with the colored slice in front of the black background.
All other slices behave as expected.
Of course I can't reproduce this second part either.
kmanuele wrote:OpenGL is available in the chart editor during design time (but not at runtime). I get an access violation at 0 if I select OpenGL.
Add the include in the .h:

Code: Select all

#include <VCLTee.TeeOpenGL.hpp>
And the pragma link in the .cpp:

Code: Select all

#pragma link "VCLTee.TeeOpenGL"
kmanuele wrote:How do I programmatically set TextQuality under 3D GDI ?
Here you have a Delphi example where this is being done:
http://www.teechart.net/support/viewtop ... 489#p66489
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

kmanuele
Newbie
Newbie
Posts: 11
Joined: Thu Sep 25, 2014 12:00 am

Re: TPieSeries

Post by kmanuele » Wed Oct 01, 2014 6:23 pm

Thanks for the responses.

I found the source of the problem: make one of your values 0, or a very low number:

Pie1->Clear();

Pie1->Gradient->Visible = false;
Pie1->Marks->Visible = true;
Pie1->AutoMarkPosition = true;
Pie1->Marks->Shadow->Visible = false;
Pie1->Marks->Symbol->Shadow->Visible = false;
Pie1->Circled = true;
Pie1->PieValues->Order = loNone;
Pie1->Marks->Style = smsLabelValue;
Pie1->ValueFormat = "#0.#####";

Chart1->View3D = false;

Chart1->Legend->Visible = false;

Pie1->Add(400.0, "red", clRed);
Pie1->Add(120.32, "green", clGreen);
Pie1->Add(231.89, "blue", clBlue);
Pie1->Add(16.12, "yellow", clYellow);
Pie1->Add(3.20088, "aqua", clAqua);
Pie1->Add(0.31345, "purple", clPurple);
Pie1->Add(0.0001, "black", clBlack);

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

Re: TPieSeries

Post by Yeray » Thu Oct 02, 2014 9:12 am

Hello,

I'm afraid I have to confirm this is the well known and difficult to solve problem with the TPieSeries in some situations.
It's not a trivial problem that would probably need a complete redesign of the series to be fixed.

The only workarounds I can think on at the moment is to switch to GDIPlus or to make the chart 3D:

Code: Select all

  Chart1->View3D = true;
  Chart1->Chart3DPercent = 1;
  Chart1->View3DOptions->Elevation = 360;
http://bugs.teechart.net/show_bug.cgi?id=935
http://bugs.teechart.net/show_bug.cgi?id=939
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

kmanuele
Newbie
Newbie
Posts: 11
Joined: Thu Sep 25, 2014 12:00 am

Re: TPieSeries

Post by kmanuele » Thu Oct 02, 2014 2:25 pm

Thanks for the confirmation. I did not see this problem with 2012 VCL with same code and pie values.

I have solved the problem by controlling what values are added to the series.

K

kmanuele
Newbie
Newbie
Posts: 11
Joined: Thu Sep 25, 2014 12:00 am

Re: TPieSeries

Post by kmanuele » Thu Oct 02, 2014 5:53 pm

re: the Delphi code to set font quality in GDI programmatically, this doesn't seem to work in C++

I like the look of ClearType at smaller fonts

This is what I am trying:

gdic = new TTeeCanvas3D();
gdic->FontQuality = fqClearType;
Chart1->Canvas = gdic;

but FontQuality is declared private, and not accessible

Canvas->Font->Quality is accessible, but has no effect.

Can you help?

thanks for all the support

Kevin

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

Re: TPieSeries

Post by Yeray » Fri Oct 03, 2014 2:12 pm

Hello Kevin,

In BCB it's a bit different.
Find attached a simple demo.
BCB_FontQuality.zip
(46.47 KiB) Downloaded 588 times
We'll consider making Canvas->FontQuality public.
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

kmanuele
Newbie
Newbie
Posts: 11
Joined: Thu Sep 25, 2014 12:00 am

Re: TPieSeries

Post by kmanuele » Fri Oct 03, 2014 4:16 pm

Your code works as intended.

Thank you !

Kevin

Post Reply