Page 1 of 1

TSeriesBandTool with C++Builder 10.1

Posted: Tue Sep 11, 2018 5:36 am
by 10052617
I am trying to dynamically create a TSeriesBandTool tool in C++Builder 10.1 using code such as ...

Code: Select all

TSeriesBandTool* ChartTool = new TSeriesBandTool(NULL);
TTeeCustomTool* customTool = Chart->Tools->Add(ChartTool);

TSeriesBandTool* Tool = dynamic_cast<TSeriesBandTool*>(customTool);
Tool->Series = MaxLine;
Tool->Series->Legend->Visible = false;
Tool->Series2 = MinLine;
Tool->Series2->Legend->Visible = false;
Tool->Brush->BackColor = TColor(16051931);
Tool->DrawBehindSeries = true;
Tool->Transparency = 50;
Tool->Active = true;
I am using TeeChart Pro v2017.21.170329 32 bit.

The code compiles and runs but the area between MinLine and MaxLine is not coloured.
Similar code works in another form where the TSeriesBandTool is statically created using the Chart Editor.

Can you help please.

Re: TSeriesBandTool with C++Builder 10.1

Posted: Wed Sep 12, 2018 10:10 am
by yeray
Hello,

We've tested it here and this seems to work fine here:
seriesband.png
seriesband.png (27.43 KiB) Viewed 6848 times
Find below the code I've tested with TeeChart Pro VCL/FMX v2018.25 and RAD Studio 10.1 Berlin:

Code: Select all

    Chart1->View3D=False;
    Chart1->Legend->Hide();

    Chart1->AddSeries(new TLineSeries(NULL));
    Chart1->AddSeries(new TLineSeries(NULL));

    Chart1->Series[0]->FillSampleValues();
    Chart1->Series[1]->FillSampleValues();

    TSeriesBandTool* ChartTool = new TSeriesBandTool(NULL);
    TTeeCustomTool* customTool = Chart1->Tools->Add(ChartTool);
    TSeriesBandTool* Tool = dynamic_cast<TSeriesBandTool*>(customTool);
    Tool->Series = Chart1->Series[0];
    Tool->Series2 = Chart1->Series[1];
    Tool->Brush->BackColor = TColor(16051931);
    Tool->DrawBehindSeries = true;
    Tool->Transparency = 50;
    Tool->Active = true;
What TeeChart version are you using?
Could you please test the code above in a new simple test project?
If you still find problems with it, please arrange a simple example project we can run as-is to reproduce the problem here.

Thanks in advance.