Page 1 of 1
TPieSeries
Posted: Mon Sep 29, 2014 9:07 pm
by 16470252
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
Re: TPieSeries
Posted: Tue Sep 30, 2014 10:51 am
by yeray
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 (17.29 KiB) Viewed 11829 times
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
Re: TPieSeries
Posted: Wed Oct 01, 2014 9:00 am
by yeray
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:
And the pragma link in the .cpp:
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
Re: TPieSeries
Posted: Wed Oct 01, 2014 6:23 pm
by 16470252
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);
Re: TPieSeries
Posted: Thu Oct 02, 2014 9:12 am
by yeray
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
Re: TPieSeries
Posted: Thu Oct 02, 2014 2:25 pm
by 16470252
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
Re: TPieSeries
Posted: Thu Oct 02, 2014 5:53 pm
by 16470252
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
Re: TPieSeries
Posted: Fri Oct 03, 2014 2:12 pm
by yeray
Hello Kevin,
In BCB it's a bit different.
Find attached a simple demo.
We'll consider making Canvas->FontQuality public.
Re: TPieSeries
Posted: Fri Oct 03, 2014 4:16 pm
by 16470252
Your code works as intended.
Thank you !
Kevin