There was a thread, where WP told me, that a bug in TAChart (the color-setting in Candle chart) will be repaired in version 4.4.
4.4. ist done to about 70 percent
https://gitlab.com/groups/freepascal.org/-/milestones
This number is created by GitLab, I don't know how seriously it should be taken.
I have installed 4.0. and love it.
However, the thing with the colour is important to me, it blocks an element's software feature.
Maybe you should try to patch your TAChart manually. The changes for the OHLCSeries were only in a single unit, ta multiseries.pas (in folder components/tachart of your Lazarus installation) (NOTE: The forum software does not allow me to print the unit name here - remove the space after "ta")
I am attaching the patch file as a reference for the following verbal description. It contains several sections, each beginning with "@@" and the line number where the change is to be made - but you must be aware that these line numbers will differ from your v4.0 code by some delta. But there are also unmodified lines from the neighborhood which help to find the places to be changed. Lines beginning with '-' will have to be deleted, and lines beginning with '+' will have to be added.
- At first make a backup copy of your original file so that you can restore it if something goes wrong.
- Find the type declaration of TOHLCBrush in the interface section - delete the entire type.
- Repeat with TOHLCPen.
- Rename TOHLCBrush to TBrush and TOHLCPen to TPen
- In the private section of TOpenHighLowCloseSeries add "const OHLC_BRUSH_COLORS: array[TOHLCBrushKind] of TColor = (clLime, clRed); OHLC_PEN_COLORS: array[TOHLCPenKind] of TColor = (clGreen, clMaroon, clDefault, clLime, clRed);". The beginning of the type declaration should read now:
TOpenHighLowCloseSeries = class(TBasicPointSeries)
private // <-- added
const // <-- added
OHLC_BRUSH_COLORS: array[TOHLCBrushKind] of TColor = (clLime, clRed); // <-- added
OHLC_PEN_COLORS: array[TOHLCPenKind] of TColor = (clGreen, clMaroon, clDefault, clLime, clRed); // <--added
private
FPen: array[TOHLCPenKind] of TPen; // <-- TOHLCPen changed to TPen
FBrush: array[TOHLCBrushKind] of TBrush; // <-- TOHLCBrush changed to TBrush
FTickWidth: Integer;
FTickWidthStyle: TTickWidthStyle;
...
FMode: TOHLCMode
function GetBrush(AIndex: TOHLCBrushKind): TBrush; // <-- TOHLCBrush changed to TBrush
function GetPen(AIndex: TOHLCPenKind): TPen; // <-- TOHLCPen changed to TPen
function IsBrushStored(AIndex: TOHLCBrushKind): Boolean; // <-- added
function IsPenStored(AIndex: TOHLCPenKind): Boolean; // <-- added
procedure SetBrush(AIndex: TOHLCBrushKind; AValue: TBrush); // <-- TOHLCBrush changed to TBrush
procedure SetPen(AIndex: TOHLCPenKind; AValue: TPen); // <--- TOHLCPen changed to TPen
...
published
property CandlestickDownBrush: TBrush index obkCandleDown // <--- TOHLCBrush chanded to TBrush
read GetBrush write SetBrush stored IsBrushStored; // <-- added "stored IsBrushStored"
property CandlestickDownPen: TPen index opkCandleDown // ... same logic of changes as with CandleStickDownBrush
read GetPen write SetPen stored IsPenStored;
property CandlestickLinePen: TPen index opkCandleLine
read GetPen write SetPen stored IsPenStored;
property CandlestickUpBrush: TBrush index obkCandleUp
read GetBrush write SetBrush stored IsBrushStored;
property CandlestickUpPen: TPen index opkCandleUp
read GetPen write SetPen stored IsPenStored;
property DownLinePen: TPen index opkLineDown
read GetPen write SetPen stored IsPenStored;
property LinePen: TPen index opkLineUp
read GetPen write SetPen stored IsPenStored;
property Mode: TOHLCMode read FMode write SetOHLCMode default mOHLC; // original line after changes
...
- In the implementation section delete the implementation of the TOHLCBrush and TOHLCPen methods
- In TOpenHighLowcloseSeries.Create replace the part following the comment "// Candlestick up brush" by the following lines (up to the "end"):
// Candlestick up brush
FBrush[obkCandleUp] := TBrush.Create;
FBrush[obkCandleUp].Color := OHLC_BRUSH_COLORS[obkCandleUp];
FBrush[obkCandleUp].OnChange := @StyleChanged;
// Candlestick down brush
FBrush[obkCandleDown] := TBrush.Create;
FBrush[obkCandleDown].Color := OHLC_BRUSH_COLORS[obkCandleDown];
FBrush[obkCandleDown].OnChange := @StyleChanged;
// Candlestick up border pen
FPen[opkCandleUp] := TPen.Create;
FPen[opkCandleUp].Color := OHLC_PEN_COLORS[opkCandleUp];
FPen[opkCandleUp].OnChange := @StyleChanged;
// Candlestick down border pen
FPen[opkCandleDown] := TPen.Create;
FPen[opkCandleDown].Color := OHLC_PEN_COLORS[opkCandleDown];
FPen[opkCandleDown].OnChange := @StyleChanged;
// Candlestick range pen
FPen[opkCandleLine] := TPen.Create;
FPen[opkCandleLine].Color := OHLC_PEN_COLORS[opkCandleLine];
FPen[opkCandleLine].OnChange := @StyleChanged;
// OHLC up pen
FPen[opkLineUp] := TPen.Create;
FPen[opkLineUp].Color := OHLC_PEN_COLORS[opkLineUp];
FPen[opkLineUp].OnChange := @StyleChanged;
// OHLC down pen
FPen[opkLineDown] := TPen.Create; //TOHLCPen.Create;
FPen[opkLineDown].Color := OHLC_PEN_COLORS[opkLineDown];
FPen[opkLineDown].OnChange := @StyleChanged;
end; // <--- unmodified line as a reference
- Find the implementation of TOpenHighLowCloseSeries.GetBrush - replace TOHLCBrush by TBrush ("function TOpenHighLowCloseSeries.GetBrush(AIndex: TOHLCBrushKind): TBrush")
- Likewise with GetPen, SetBrush and SetPen
- Add IsStored functions:
function TOpenHighLowCloseSeries.IsBrushStored(AIndex: TOHLCBrushKind): Boolean;
begin
Result := not (
(FBrush[AIndex].Color = OHLC_BRUSH_COLORS[AIndex]) and
(FBrush[AIndex].Style = bsSolid)
);
end;
function TOpenHighLowCloseSeries.IsPenStored(AIndex: TOHLCPenKind): Boolean;
begin
Result := not (
(FPen[AIndex].Color = OHLC_PEN_COLORS[AIndex]) and
FPen[AIndex].Cosmetic and
(FPen[AIndex].EndCap = pecRound) and
(FPen[AIndex].JoinStyle = pjsRound) and
(FPen[AIndex].Mode = pmCopy) and
(FPen[AIndex].Style = psSolid) and
(FPen[AIndex].Width = 1)
);
end;
- Save and recompile the IDE ("Tools" > "Configure Build Lazarus" > in the "Clean-up mode" box check "Clean all" and "Switch to automatic mode after building" > "Build".
- When the IDE rebuild you should have the modified TOpenHighLowCloseSeries.
- If the IDE fails to restarts try to find the error (compare the changes with the diff file that I attach) and repeat to rebuild. If you are not successful and want to give up, restore the saved version of the taohlcsseries.pas unit and rebuild again to get the old Lazarus version back with which you started.
1) Work on with 4.0 (easy way) and wait for 4.4.
That's always an option. But I don't know when v4.4 will be ready, maybe next spring?
2) Install 4.2. and having some bugs repaired of which I do not suffer too much. The bug I need fixed, is not.
Since you are on Windows you can install as many independent Lazarus versions as you like. Just select the "Secondary installation" checkbox in one of the first installer pages. And on the next page define a directory in which that new version will store its settings. Always use a new directory for it, never the one of another already existing installation.
You can also try fpcupdeluxe to create any combination of FPC and Lazarus in an independent way without conflicting with existing installations.
about installing Lazarus:
I wonder if the installing of any new version means, that I have to re-install all my components from scratch, which is every time a thrilling act, if they will work on (IBX and tvPlanit are two crucial ones)
Yes, every new installation is default. 3rdParty components must be reinstalled. But when you get them from OPM they are just a few clicks away, definitely for tvPlanIt which I maintain myself, and IIRC also IBX is fine in the OPM version now).