TAChart: TBarSeries, TBubbleSeries and TPieSeries now use Styles for extended data point formatting

This commit is contained in:
wp_xyz 2024-02-04 17:35:22 +01:00
parent 366c2feca3
commit 0fd4564df7
3 changed files with 17 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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.