diff --git a/components/tachart/tacustomseries.pas b/components/tachart/tacustomseries.pas index 9f96319bd9..e744551487 100644 --- a/components/tachart/tacustomseries.pas +++ b/components/tachart/tacustomseries.pas @@ -1313,25 +1313,28 @@ begin prev := IfThen(FSupportsZeroLevel, GetZeroLevel, 0.0); for si := 0 to Source.YCount - 1 do begin g := GetLabelDataPoint(i, si); - if si = 0 then begin - y := Source[i]^.Y; - yIsNaN := IsNaN(y); - ysum := IfThen(yIsNaN, prev, y); - end else begin - y := Source[i]^.YList[si-1]; - yIsNaN := IsNaN(y); - if yIsNaN then y := 0.0; - if Stacked then begin - ysum += y; - y := ysum; + if FStacked then begin + if si = 0 then begin + y := Source[i]^.Y; + yIsNaN := IsNaN(y); + ysum := IfThen(yIsNaN, prev, y); + end else begin + y := Source[i]^.YList[si-1]; + yIsNaN := IsNaN(y); + if yIsNaN then y := 0.0; + if Stacked then begin + ysum += y; + y := ysum; + end; end; - end; - if IsRotated then - g.X := AxisToGraphY(y) - // Axis-to-graph transformation is independent of axis rotation -> - // Using AxisToGraph_Y_ is correct! - else - g.Y := AxisToGraphY(y); + if IsRotated then + g.X := AxisToGraphY(y) + // Axis-to-graph transformation is independent of axis rotation -> + // Using AxisToGraph_Y_ is correct! + else + g.Y := AxisToGraphY(y); + end else + yIsNaN := IsNaN(g.y); curr := TDoublePointBoolArr(g)[not IsRotated]; if FMarkPositionCentered then begin diff --git a/components/tachart/tamultiseries.pas b/components/tachart/tamultiseries.pas index 1a698c0d9e..0ba6d57e7a 100644 --- a/components/tachart/tamultiseries.pas +++ b/components/tachart/tamultiseries.pas @@ -52,6 +52,7 @@ type procedure SetOverrideColor(AValue: TBubbleOverrideColors); protected function GetBubbleRect(AItem: PChartDataItem; out ARect: TRect): Boolean; + function GetLabelDataPoint(AIndex, AYIndex: Integer): TDoublePoint; override; procedure GetLegendItems(AItems: TChartLegendItems); override; function GetSeriesColor: TColor; override; class procedure GetXYCountNeeded(out AXCount, AYCount: Integer); override; @@ -76,6 +77,8 @@ type property BubblePen: TPen read FBubblePen write SetBubblePen; property BubbleRadiusUnits: TBubbleRadiusUnits read FBubbleRadiusUnits write SetBubbleRadiusUnits default bruXY; + property MarkPositions; + property Marks; property OverrideColor: TBubbleOverrideColors read FOverrideColor write SetOverrideColor default []; property Source; @@ -601,6 +604,20 @@ begin Result := true; end; +function TBubbleSeries.GetLabelDataPoint(AIndex, AYIndex: Integer): TDoublePoint; +var + item: PChartDataItem; + R: TRect; +begin + if (AYIndex = 1) and GetBubbleRect(Source.Item[AIndex], R) then begin + if IsRotated then + Result := ParentChart.ImageToGraph(Point(R.Right, (R.Top + R.Bottom) div 2)) + else + Result := parentChart.ImageToGraph(Point((R.Left + R.Right) div 2, R.Top)); + end else + Result := GetGraphPoint(AIndex, 0, 0); +end; + procedure TBubbleSeries.GetLegendItems(AItems: TChartLegendItems); begin GetLegendItemsRect(AItems, BubbleBrush);