fpspreadsheet: Fix default brushes and pens in stock series.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9271 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
3f0fa39576
commit
d459d064e8
@ -189,7 +189,6 @@ type
|
|||||||
Gradient: Integer; // Index into chart's Gradients list
|
Gradient: Integer; // Index into chart's Gradients list
|
||||||
Hatch: Integer; // Index into chart's Hatches list
|
Hatch: Integer; // Index into chart's Hatches list
|
||||||
Image: Integer; // Index into chart's Images list
|
Image: Integer; // Index into chart's Images list
|
||||||
Transparency: Double; // 0.0 ... 1.0
|
|
||||||
constructor CreateSolidFill(AColor: TsChartColor);
|
constructor CreateSolidFill(AColor: TsChartColor);
|
||||||
constructor CreateHatchFill(AHatchIndex: Integer; ABkColor: TsChartColor);
|
constructor CreateHatchFill(AHatchIndex: Integer; ABkColor: TsChartColor);
|
||||||
procedure CopyFrom(AFill: TsChartFill);
|
procedure CopyFrom(AFill: TsChartFill);
|
||||||
@ -752,7 +751,9 @@ type
|
|||||||
FLowRange: TsChartRange; // close = normal y range
|
FLowRange: TsChartRange; // close = normal y range
|
||||||
FCandleStickDownFill: TsChartFill;
|
FCandleStickDownFill: TsChartFill;
|
||||||
FCandleStickDownBorder: TsChartLine;
|
FCandleStickDownBorder: TsChartLine;
|
||||||
|
FCandleStickUpFill: TsChartFill;
|
||||||
FCandleStickUpBorder: TsChartLine;
|
FCandleStickUpBorder: TsChartLine;
|
||||||
|
FRangeLine: TsChartLine;
|
||||||
FTickWidthPercent: Integer;
|
FTickWidthPercent: Integer;
|
||||||
// fill is CandleStickUpFill, line is RangeLine
|
// fill is CandleStickUpFill, line is RangeLine
|
||||||
public
|
public
|
||||||
@ -768,11 +769,11 @@ type
|
|||||||
procedure SetCloseRange(ASheet1: String; ARow1, ACol1: Cardinal; ASheet2: String; ARow2, ACol2: Cardinal);
|
procedure SetCloseRange(ASheet1: String; ARow1, ACol1: Cardinal; ASheet2: String; ARow2, ACol2: Cardinal);
|
||||||
property CandleStick: Boolean read FCandleStick write FCandleStick;
|
property CandleStick: Boolean read FCandleStick write FCandleStick;
|
||||||
property CandleStickDownFill: TsChartFill read FCandleStickDownFill write FCandleStickDownFill;
|
property CandleStickDownFill: TsChartFill read FCandleStickDownFill write FCandleStickDownFill;
|
||||||
property CandleStickUpFill: TsChartFill read FFill write FFill;
|
property CandleStickUpFill: TsChartFill read FCandleStickUpFill write FCandleStickUpFill;
|
||||||
property CandleStickDownBorder: TsChartLine read FCandleStickDownBorder write FCandleStickDownBorder;
|
property CandleStickDownBorder: TsChartLine read FCandleStickDownBorder write FCandleStickDownBorder;
|
||||||
property CandleStickUpBorder: TsChartLine read FCandleStickUpBorder write FCandleStickUpBorder;
|
property CandleStickUpBorder: TsChartLine read FCandleStickUpBorder write FCandleStickUpBorder;
|
||||||
property TickWidthPercent: Integer read FTickWidthPercent write FTickWidthPercent;
|
property TickWidthPercent: Integer read FTickWidthPercent write FTickWidthPercent;
|
||||||
property RangeLine: TsChartLine read FLine write FLine;
|
property RangeLine: TsChartLine read FRangeLine write FRangeLine;
|
||||||
property OpenRange: TsChartRange read FOpenRange;
|
property OpenRange: TsChartRange read FOpenRange;
|
||||||
property HighRange: TsChartRange read FHighRange;
|
property HighRange: TsChartRange read FHighRange;
|
||||||
property LowRange: TsChartRange read FLowRange;
|
property LowRange: TsChartRange read FLowRange;
|
||||||
@ -1449,7 +1450,6 @@ begin
|
|||||||
Gradient := AFill.Gradient;
|
Gradient := AFill.Gradient;
|
||||||
Hatch := AFill.Hatch;
|
Hatch := AFill.Hatch;
|
||||||
Image := AFill.Image;
|
Image := AFill.Image;
|
||||||
Transparency := AFill.Transparency;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2746,24 +2746,18 @@ begin
|
|||||||
FLowRange := TsChartRange.Create(AChart);
|
FLowRange := TsChartRange.Create(AChart);
|
||||||
|
|
||||||
// FFill is CandleStickUp, FLine is RangeLine
|
// FFill is CandleStickUp, FLine is RangeLine
|
||||||
FCandleStickDownFill := TsChartFill.Create;
|
FCandleStickDownBorder := TsChartLine.CreateSolid(ChartColor(scBlack), PtsToMM(DEFAULT_CHART_LINEWIDTH));
|
||||||
FCandleStickDownFill.Style := cfsSolid;
|
FCandleStickDownFill := TsChartFill.CreateSolidFill(ChartColor(scBlack)); // These are the Excel default colors
|
||||||
FCandleStickDownFill.Color := ChartColor(scBlack);
|
FCandleStickUpBorder := TsChartLine.CreateSolid(ChartColor(scBlack), PtsToMM(DEFAULT_CHART_LINEWIDTH));
|
||||||
FCandleStickDownBorder := TsChartLine.Create;
|
FCandleStickUpFill := TsChartFill.CreateSolidFill(ChartColor(scWhite));
|
||||||
FCandleStickDownBorder.Style := clsSolid;
|
FRangeLine := TsChartLine.CreateSolid(ChartColor(scBlack), PtsToMM(DEFAULT_CHART_LINEWIDTH));
|
||||||
FCandleStickDownBorder.Color := ChartColor(scBlack);
|
|
||||||
FCandleStickDownBorder.Width := PtsToMM(DEFAULT_CHART_LINEWIDTH);
|
|
||||||
FCandleStickUpBorder := TsChartLine.Create;
|
|
||||||
FCandleStickUpBorder.Style := clsSolid;
|
|
||||||
FCandleStickUpBorder.Color := ChartColor(scBlack);
|
|
||||||
FCandleStickUpBorder.Width := PtsToMM(DEFAULT_CHART_LINEWIDTH);
|
|
||||||
FLine.Style := clsSolid;
|
|
||||||
FLine.Color := ChartColor(scBlack);
|
|
||||||
FTickWidthPercent := 50;
|
FTickWidthPercent := 50;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TsStockSeries.Destroy;
|
destructor TsStockSeries.Destroy;
|
||||||
begin
|
begin
|
||||||
|
FRangeLine.Free;
|
||||||
|
FCandleStickUpFill.Free;
|
||||||
FCandleStickUpBorder.Free;
|
FCandleStickUpBorder.Free;
|
||||||
FCandleStickDownBorder.Free;
|
FCandleStickDownBorder.Free;
|
||||||
FCandleStickDownFill.Free;
|
FCandleStickDownFill.Free;
|
||||||
|
@ -1378,7 +1378,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ser.Transparency := round(ASeries.Fill.Transparency);
|
ser.Transparency := round(ASeries.Fill.Color.Transparency);
|
||||||
axis := ASeries.Chart.YAxis;
|
axis := ASeries.Chart.YAxis;
|
||||||
UpdateChartSeriesMarks(ASeries, ser);
|
UpdateChartSeriesMarks(ASeries, ser);
|
||||||
if IsStackable(ASeries) then
|
if IsStackable(ASeries) then
|
||||||
@ -2000,7 +2000,7 @@ procedure TsWorkbookChartLink.UpdateAreaSeries(AWorkbookSeries: TsAreaSeries;
|
|||||||
begin
|
begin
|
||||||
UpdateChartBrush(AWorkbookSeries.Chart, AWorkbookSeries.Fill, AChartSeries.AreaBrush);
|
UpdateChartBrush(AWorkbookSeries.Chart, AWorkbookSeries.Fill, AChartSeries.AreaBrush);
|
||||||
UpdateChartPen(AWorkbookSeries.Chart, AWorkbookSeries.Line, AChartSeries.AreaContourPen);
|
UpdateChartPen(AWorkbookSeries.Chart, AWorkbookSeries.Line, AChartSeries.AreaContourPen);
|
||||||
AChartSeries.Transparency := round(AWorkbookSeries.Fill.Transparency * 255);
|
AChartSeries.Transparency := round(AWorkbookSeries.Fill.Color.Transparency * 255);
|
||||||
AChartSeries.AreaLinesPen.Style := psClear;
|
AChartSeries.AreaLinesPen.Style := psClear;
|
||||||
AChartSeries.Stacked := AWorkbookSeries.Chart.StackMode <> csmDefault;
|
AChartSeries.Stacked := AWorkbookSeries.Chart.StackMode <> csmDefault;
|
||||||
AChartSeries.UseZeroLevel := true;
|
AChartSeries.UseZeroLevel := true;
|
||||||
@ -2038,7 +2038,7 @@ procedure TsWorkbookChartLink.UpdateBarSeries(AWorkbookSeries: TsBarSeries;
|
|||||||
begin
|
begin
|
||||||
UpdateChartBrush(AWorkbookSeries.Chart, AWorkbookSeries.Fill, AChartSeries.BarBrush);
|
UpdateChartBrush(AWorkbookSeries.Chart, AWorkbookSeries.Fill, AChartSeries.BarBrush);
|
||||||
UpdateChartPen(AWorkbookSeries.Chart, AWorkbookSeries.Line, AChartSeries.BarPen);
|
UpdateChartPen(AWorkbookSeries.Chart, AWorkbookSeries.Line, AChartSeries.BarPen);
|
||||||
AChartSeries.Transparency := round(AWorkbookSeries.Fill.Transparency * 255);
|
AChartSeries.Transparency := round(AWorkbookSeries.Fill.Color.Transparency * 255);
|
||||||
AChartSeries.BarWidthPercent := CalcBarWidthPercent;
|
AChartSeries.BarWidthPercent := CalcBarWidthPercent;
|
||||||
AChartSeries.BarOffsetPercent := 0; // TAChart currently does not support offsets in multiple-y bar series.
|
AChartSeries.BarOffsetPercent := 0; // TAChart currently does not support offsets in multiple-y bar series.
|
||||||
AChartSeries.BarWidthStyle := bwPercentMin;
|
AChartSeries.BarWidthStyle := bwPercentMin;
|
||||||
@ -2055,7 +2055,7 @@ procedure TsWorkbookChartlink.UpdateBubbleSeries(AWorkbookSeries: TsBubbleSeries
|
|||||||
begin
|
begin
|
||||||
UpdateChartBrush(AWorkbookSeries.Chart, AWorkbookSeries.Fill, AChartSeries.BubbleBrush);
|
UpdateChartBrush(AWorkbookSeries.Chart, AWorkbookSeries.Fill, AChartSeries.BubbleBrush);
|
||||||
UpdateChartPen(AWorkbookSeries.Chart, AWorkbookSeries.Line, AChartSeries.BubblePen);
|
UpdateChartPen(AWorkbookSeries.Chart, AWorkbookSeries.Line, AChartSeries.BubblePen);
|
||||||
AChartSeries.Transparency := round(255*AWorkbookSeries.Fill.Transparency);
|
AChartSeries.Transparency := round(255*AWorkbookSeries.Fill.Color.Transparency);
|
||||||
AChartSeries.Legend.Multiplicity := lmPoint;
|
AChartSeries.Legend.Multiplicity := lmPoint;
|
||||||
|
|
||||||
{$IF LCL_FullVersion >= 3990000}
|
{$IF LCL_FullVersion >= 3990000}
|
||||||
@ -2807,7 +2807,7 @@ var
|
|||||||
begin
|
begin
|
||||||
ppi := GetParentForm(FChart).PixelsPerInch;
|
ppi := GetParentForm(FChart).PixelsPerInch;
|
||||||
|
|
||||||
AChartSeries.Transparency := round(AWorkbookSeries.Fill.Transparency * 255);
|
AChartSeries.Transparency := round(AWorkbookSeries.Fill.Color.Transparency * 255);
|
||||||
AChartSeries.CloseCircle := true;
|
AChartSeries.CloseCircle := true;
|
||||||
AChartSeries.Filled := (AWorkbookSeries.ChartType = ctFilledRadar);
|
AChartSeries.Filled := (AWorkbookSeries.ChartType = ctFilledRadar);
|
||||||
AChartSeries.ShowPoints := AWorkbookSeries.ShowSymbols;
|
AChartSeries.ShowPoints := AWorkbookSeries.ShowSymbols;
|
||||||
|
@ -352,14 +352,24 @@ procedure TStockSeries.Draw(ADrawer: IChartDrawer);
|
|||||||
ADrawer.Line(MaybeRotate(AX1, AY1), MaybeRotate(AX2, AY2));
|
ADrawer.Line(MaybeRotate(AX1, AY1), MaybeRotate(AX2, AY2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure NoZeroRect(var R: TRect);
|
||||||
|
begin
|
||||||
|
if IsRotated then
|
||||||
|
begin
|
||||||
|
if R.Left = R.Right then inc(R.Right);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if R.Top = R.Bottom then inc(R.Bottom);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure DoRect(AX1, AY1, AX2, AY2: Double);
|
procedure DoRect(AX1, AY1, AX2, AY2: Double);
|
||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
begin
|
begin
|
||||||
with ParentChart do begin
|
r.TopLeft := MaybeRotate(AX1, AY1);
|
||||||
r.TopLeft := MaybeRotate(AX1, AY1);
|
r.BottomRight := MaybeRotate(AX2, AY2);
|
||||||
r.BottomRight := MaybeRotate(AX2, AY2);
|
NoZeroRect(r);
|
||||||
end;
|
|
||||||
ADrawer.FillRect(r.Left, r.Top, r.Right, r.Bottom);
|
ADrawer.FillRect(r.Left, r.Top, r.Right, r.Bottom);
|
||||||
ADrawer.Rectangle(r);
|
ADrawer.Rectangle(r);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user