Area series with two colours
Posted: Wed Apr 28, 2021 7:22 am
Hello,
I need area series with two colours. One for negative and one for positive areas. (See attached screenshot for details)
I've done that by using OnAfterAdd:
but it doesn't work automatically, only if I call OnAfterAdd in code:
also I want to apply new colours by pressing button, I need to redraw chart in OnClick handler for that?
I need area series with two colours. One for negative and one for positive areas. (See attached screenshot for details)
I've done that by using OnAfterAdd:
Code: Select all
void __fastcall MyFlowRateRectangleSeries::OnAfterAddPoint(TChartSeries *Sender, int ValueIndex)
{
if(Sender->YValues->Value[ValueIndex] > 0)
Sender->ValueColor[ValueIndex] = DefaultPosColor;
else
Sender->ValueColor[ValueIndex] = DefaultNegColor;
}
Code: Select all
NewSeries->AddXY(XValue, YValue);
NewSeries->OnAfterAdd(NewSeries, Index); //OnAfterAddPoint doesn't work without that line