From 0fd4564df71b48449ef0b8367dc31a719ad03696 Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Sun, 4 Feb 2024 17:35:22 +0100 Subject: [PATCH] TAChart: TBarSeries, TBubbleSeries and TPieSeries now use Styles for extended data point formatting --- components/tachart/tamultiseries.pas | 7 ++++++- components/tachart/taradialseries.pas | 2 ++ components/tachart/taseries.pas | 10 +++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/tachart/tamultiseries.pas b/components/tachart/tamultiseries.pas index c492621350..29aeaf35a5 100644 --- a/components/tachart/tamultiseries.pas +++ b/components/tachart/tamultiseries.pas @@ -101,6 +101,7 @@ type property OverrideColor: TBubbleOverrideColors read FOverrideColor write SetOverrideColor default []; property Source; + property Styles; property ToolTargets default [nptPoint, nptYList, nptCustom]; end; @@ -580,7 +581,8 @@ end; the chart area (ARect). } function TBubbleSeries.CalcBubbleScalingFactor(const ARect: TRect): Double; var - rMin, rMax: Double; + rMin: Double = 0.0; + rMax: Double = 0.0; begin if FBubbleRadiusUnits in [bruPercentageRadius, bruPercentageArea] then begin @@ -655,6 +657,9 @@ begin if bocBrush in OverrideColor then ADrawer.SetBrushColor(ColorDef(item^.Color, BubbleBrush.Color)); + if Styles <> nil then + Styles.Apply(ADrawer, i); + ADrawer.Ellipse(irect.Left, irect.Top, irect.Right, irect.Bottom); end; diff --git a/components/tachart/taradialseries.pas b/components/tachart/taradialseries.pas index 031839d464..b59ff25335 100644 --- a/components/tachart/taradialseries.pas +++ b/components/tachart/taradialseries.pas @@ -657,6 +657,8 @@ begin for ps in FSlices do if ps.FVisible then begin ADrawer.SetBrushParams(bsSolid, SliceColor(ps.FOrigIndex)); + if Styles <> nil then + Styles.Apply(ADrawer, ps.FOrigIndex); DrawSlice(ps); end; diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index 4095cad83d..97cc076afe 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -162,6 +162,7 @@ type property RotateLabels; property StartAngle; property Source; + property Styles; property ViewAngle; property OnCustomDrawPie; end; @@ -1332,8 +1333,15 @@ var c := Source[pointIndex]^.Color; if c <> clTAColor then ADrawer.BrushColor := c; + if Styles <> nil then - Styles.Apply(ADrawer, stackIndex); + begin + if Source.YCount = 1 then + Styles.Apply(ADrawer, pointIndex) + else + Styles.Apply(ADrawer, stackIndex); + end; + sz := Size(AR); if (sz.cx <= 2*BarPen.Width) or (sz.cy <= 2*BarPen.Width) then begin // Bars are too small to distinguish the border from the interior.