Hi,
I'm trying to enable transparency property of OHLC,
but seeing unexpected Hi-Low line reveal in the center of candle. (pic. attached)
How can I keep a "plain transparency" without seeing the middle part of the line in the candle body?
I'm a source user, please advice if source modification is required. Thanks!
OHLC transparency problem
OHLC transparency problem
- Attachments
-
- OHLC.png (25.6 KiB) Viewed 4562 times
Re: OHLC transparency problem
Hello,
I'm afraid in this case you should draw the lines manually. Ie:
I'm afraid in this case you should draw the lines manually. Ie:
Code: Select all
uses Math;
var Series1: TCandleSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Series1:=Chart1.AddSeries(TCandleSeries) as TCandleSeries;
Series1.UpCloseColor:=RGB(29, 123, 99);
Series1.FillSampleValues();
Series1.HighLowPen.Visible:=false;
Series1.HighLowColor:=cbSameAsCandle;
Series1.Transparency:=50;
Series1.OnGetPointerStyle:=Series1GetPointerStyle;
end;
function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
var tmpX, tmpOpen, tmpClose, tmpHigh, tmpLow: Integer;
procedure drawLine(FromY: Integer);
var ToY: Integer;
begin
ToY:=Min(tmpOpen, tmpClose);
if (FromY<ToY) then
begin
if Sender.ParentChart.View3D then
Sender.ParentChart.Canvas.VertLine3D(tmpX,FromY,ToY,Sender.MiddleZ)
else
Sender.ParentChart.Canvas.DoVertLine(tmpX,FromY,ToY);
end
else
begin
ToY:=Max(tmpOpen, tmpClose);
if (FromY>ToY) then
if Sender.ParentChart.View3D then
Sender.ParentChart.Canvas.VertLine3D(tmpX,FromY,ToY,Sender.MiddleZ)
else
Sender.ParentChart.Canvas.DoVertLine(tmpX,FromY,ToY);
end;
end;
begin
if (Sender is TCandleSeries) and (ValueIndex>-1) and (ValueIndex<Sender.Count) then
begin
with (Sender as TCandleSeries) do
begin
tmpX:=CalcXPos(ValueIndex);
tmpOpen:=CalcYPosValue(OpenValues[ValueIndex]);
tmpClose:=CalcYPosValue(CloseValues[ValueIndex]);
tmpHigh:=CalcYPosValue(HighValues[ValueIndex]);
tmpLow:=CalcYPosValue(LowValues[ValueIndex]);
if HighLowColor=cbUseColor then
if HighLowPen.Color=clTeeColor then
Chart1.Canvas.Pen.Color:=Pen.Color
else
Chart1.Canvas.Pen.Color:=HighLowPen.Color
else
if tmpOpen<tmpClose then
Chart1.Canvas.Pen.Color:=DownCloseColor
else
Chart1.Canvas.Pen.Color:=UpCloseColor;
drawLine(tmpHigh);
drawLine(tmpLow);
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |