📄 series.pas
字号:
else
if FDrawLine and (not FDrawArea) then
DrawLine(ParentChart.View3D)
else
inherited
end;
procedure TCustomSeries.LinePrepareCanvas(tmpCanvas:TCanvas3D; tmpColor:TColor);
begin
with tmpCanvas do
begin
if MonoChrome then tmpColor:=clWhite;
if ParentChart.View3D then
begin
if Assigned(Self.Brush.Image.Graphic) then
Brush.Bitmap:=Self.Brush.Image.Bitmap
else
begin
Brush.Style:=LineBrush;
Brush.Color:=tmpColor;
end;
AssignVisiblePen(LinePen);
end
else
begin
Brush.Style:=bsClear;
AssignVisiblePenColor(LinePen,tmpColor);
end;
end;
end;
procedure TCustomSeries.PreparePointer(ValueIndex:Integer);
begin // empty. Overriden at BubbleSeries
end;
function TCustomSeries.RaiseClicked:Boolean; // 7.07
begin
result:=(inherited RaiseClicked) or
(Pointer.Visible and Assigned(FOnClickPointer));
end;
Procedure TCustomSeries.SetParentChart(Const Value:TCustomAxisPanel);
begin
inherited;
if Assigned(FPointer) then FPointer.ParentChart:=Value;
end;
Function TCustomSeries.GetAreaBrushColor(AColor:TColor):TColor;
begin
if ColorEachPoint or (FAreaColor=clTeeColor) then
result:=AColor
else
result:=FAreaColor;
end;
type TCustomAxisPanelAccess=class(TCustomAxisPanel);
procedure TCustomSeries.DrawValue(ValueIndex:Integer);
var x : Integer;
y : Integer;
{ calculate vertical pixel }
Function CalcYPosLeftRight(Const YLimit:Double; AnotherIndex:Integer):Integer;
var tmpPredValueX : Double;
tmpPredValueY : Double;
tmpDif : Double;
tmpY : Double;
begin
tmpPredValueX:=XValues.Value[AnotherIndex];
tmpDif:=XValues.Value[ValueIndex]-tmpPredValueX;
With ParentChart do
if tmpDif=0 then result:=CalcYPos(AnotherIndex)
else
begin
tmpPredValueY:=YValues.Value[AnotherIndex];
if MandatoryAxis.Logarithmic then // 7.0 #1225
if (tmpPredValueY>0) and (YValues.Value[ValueIndex]>0) then
tmpY:=Exp(Ln(tmpPredValueY)+(YLimit-tmpPredValueX)*
(Ln(YValues.Value[ValueIndex])-Ln(tmpPredValueY))/tmpDif)
else
tmpY:=0 // TV52010688
else
tmpY:=1.0*tmpPredValueY+(YLimit-tmpPredValueX)*
(YValues.Value[ValueIndex]-tmpPredValueY)/tmpDif;
result:=CalcYPosValue(tmpY);
end;
end;
var tmpColor : TColor;
IsLastValue : Boolean;
Procedure InternalDrawArea(BrushColor:TColor);
Function RectFromPoints(const P:TFourPoints):TRect;
begin
with result do
begin
Left :=Math.Min(P[3].X,Math.Min(P[2].X,Math.Min(P[0].X,P[1].X)));
Top :=Math.Min(P[3].Y,Math.Min(P[2].Y,Math.Min(P[0].Y,P[1].Y)));
Right :=Math.Max(P[3].X,Math.Max(P[2].X,Math.Max(P[0].X,P[1].X)));
Bottom:=Math.Max(P[3].Y,Math.Max(P[2].Y,Math.Max(P[0].Y,P[1].Y)));
end;
if ParentChart.View3D then
result:=ParentChart.Canvas.CalcRect3D(result,StartZ); { 5.03 }
end;
var tmpY : Integer;
tmpBottom : Integer;
tmpR : TRect;
tmpBlend : TTeeBlend;
tmpP : TFourPoints;
tmpMax : Integer;
tmpMin : Integer;
tmpColor2 : TColor;
tmpZ : Integer;
begin
tmpColor2:=FAreaBrush.Color;
if tmpColor2=clTeeColor then
tmpColor2:=SeriesColor;
if Assigned(FAreaBrush.Image.Graphic) and (tmpColor2=BrushColor) then
tmpColor2:=clWhite; // 7.04 TV52010270
ParentChart.SetBrushCanvas(BrushColor,FAreaBrush,tmpColor2);
with ParentChart do
begin
// Draw side at last Area edge, or inside middle Null area points.
if ParentChart.View3D and
( IsLastValue
or
((ValueIndex<Count-1) and IsNull(Succ(ValueIndex))
and (FTreatNulls=tnDontPaint))
or
((ValueIndex>0) and IsNull(Pred(ValueIndex))
and (FTreatNulls=tnDontPaint))
)
then
begin
if Dark3D then
Canvas.Brush.Color:=ApplyDark(Canvas.Brush.Color,DarkColorQuantity);
if YMandatory then
Canvas.RectangleZ(X,Y,BottomPos,StartZ,EndZ)
else
Canvas.RectangleY(X,Y,BottomPos,StartZ,EndZ);
if Dark3D then
SetBrushCanvas(BrushColor,FAreaBrush,tmpColor2);
end;
if FStairs then
begin
if FInvertedStairs then
begin
if YMandatory then tmpY:=Y
else tmpY:=X;
tmpBottom:=BottomPos;
end
else
begin
if YMandatory then tmpY:=OldY
else tmpY:=OldX;
tmpBottom:=OldBottomPos;
end;
if YMandatory then tmpR:=TeeRect(OldX,tmpBottom,X+1,tmpY)
else tmpR:=TeeRect(tmpBottom,OldY+1,tmpY+1,Y);
with Canvas do
begin
if Transparency>0 then
if View3D then
tmpBlend:=BeginBlending(RectFromRectZ(tmpR,StartZ),Transparency) // 6.01
else
tmpBlend:=BeginBlending(tmpR,Transparency) // 6.01
else
tmpBlend:=nil;
if View3D then
begin
RectangleWithZ(tmpR,StartZ);
if SupportsFullRotation then
RectangleWithZ(tmpR,EndZ);
end
else
begin
if FGradient.Visible then
begin
FGradient.Draw(Canvas,tmpR); // 5.03
if Pen.Style<>psClear then
begin
Brush.Style:=bsClear;
Rectangle(tmpR);
end;
end
else Rectangle(tmpR);
end;
if Transparency>0 then
EndBlending(tmpBlend);
end;
if LinePen.Visible then // TV52011701
begin
Canvas.AssignVisiblePen(LinePen);
if YMandatory then
if FInvertedStairs then
begin
Canvas.LineWithZ(OldX,Y,X,Y,StartZ);
if ValueIndex>FirstValueIndex+1 then
Canvas.LineWithZ(OldX,OldY,OldX,Y,StartZ);
end
else
begin
Canvas.LineWithZ(OldX,OldY,X,OldY,StartZ);
if ValueIndex<LastValueIndex then
Canvas.LineWithZ(X,OldY,X,Y,StartZ);
if (ValueIndex>(FirstDisplayedIndex+1)) then
Canvas.LineWithZ(OldX,OldY,OldX,CalcYPos(ValueIndex-2),StartZ);
end
else
if FInvertedStairs then
begin
Canvas.LineWithZ(X,OldY,X,Y,StartZ);
if ValueIndex>FirstValueIndex+1 then
Canvas.LineWithZ(OldX,OldY,X,OldY,StartZ);
end
else
begin
Canvas.LineWithZ(OldX,OldY,OldX,Y,StartZ);
if ValueIndex<LastValueIndex then
Canvas.LineWithZ(OldX,Y,X,Y,StartZ);
if (ValueIndex>(FirstDisplayedIndex+1)) then
Canvas.LineWithZ(OldX,OldY,CalcXPos(ValueIndex-2),OldY,StartZ);
end;
end;
end
else // not in "stairs" mode...
With Canvas do
begin
if YMandatory then
begin
tmpP[0]:=TeePoint(OldX,OldBottomPos);
tmpP[3]:=TeePoint(X,BottomPos);
end
else
begin
tmpP[0]:=TeePoint(OldBottomPos,OldY);
tmpP[3]:=TeePoint(BottomPos,Y);
end;
tmpP[1]:=TeePoint(OldX,OldY);
tmpP[2]:=TeePoint(X,Y);
if Transparency>0 then
tmpBlend:=Canvas.BeginBlending(RectFromPoints(tmpP),Transparency)
else
tmpBlend:=nil;
if View3D then
begin
if (View3DOptions.Rotation>90) and (View3DOptions.Rotation<270) then
tmpZ:=EndZ
else
tmpZ:=StartZ;
if FGradient.Visible then
FGradient.Draw(Canvas,tmpP,tmpZ)
else
PlaneWithZ(tmpP,tmpZ);
end
else // 5.02
begin
if FGradient.Visible then { 5.03 }
begin
ClipPolygon(tmpP,4);
tmpMax:=CalcPosValue(MandatoryValueList.MaxValue);
//tmpMin:=CalcPosValue(MandatoryValueList.MinValue);
tmpMin:=BottomPos;
if YMandatory then tmpR:=TeeRect(OldX,tmpMax,X,tmpMin)
else tmpR:=TeeRect(tmpMin,OldY,tmpMax,Y);
FGradient.Draw(Canvas,tmpR);
UnClipRectangle;
Brush.Style:=bsClear;
if Pen.Style<>psClear then
if YMandatory then DoVertLine(OldX,OldY,OldBottomPos)
else DoHorizLine(OldBottomPos,OldX,OldY);
end
else Polygon(tmpP);
end;
if Transparency>0 then
Canvas.EndBlending(tmpBlend);
if SupportsFullRotation then PlaneWithZ(tmpP,EndZ);
if LinePen.Visible then
begin
AssignVisiblePen(LinePen);
LineWithZ(OldX,OldY,X,Y,StartZ);
end;
end;
end;
end;
Procedure DrawPoint(DrawOldPointer:Boolean);
var
tmpPoint : TPoint;
tmpOldP : TPoint;
procedure DrawLineHeight;
var P4 : TFourPoints;
begin
if not FDrawArea then
begin
P4[0]:=tmpPoint;
P4[1]:=tmpOldP;
P4[2].X:=tmpOldP.X;
P4[2].Y:=tmpOldP.Y+LineHeight;
P4[3].X:=tmpPoint.X;
P4[3].Y:=tmpPoint.Y+LineHeight;
ParentChart.Canvas.PlaneFour3D(P4,StartZ,StartZ);
if IsLastValue then
ParentChart.Canvas.RectangleZ(tmpPoint.X,tmpPoint.Y,
tmpPoint.Y+FLineHeight,StartZ,EndZ);
end;
end;
var tmpDifX : Integer;
OldDarkColor : TColor;
tmpDark3D : Boolean;
tmpP : TFourPoints;
begin
if ((x<>OldX) or (y<>OldY)) and
((FTreatNulls=tnIgnore) or (tmpColor<>clNone)) then
with ParentChart,Canvas do
begin
if View3D then
Begin
{ 3D }
if FDrawArea or FDrawLine then
begin
if FColorEachLine or FDrawArea then
OldDarkColor:=GetAreaBrushColor(tmpColor)
else
OldDarkColor:=Series
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -