Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-10

TAChart CandleStick Chart

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kamen Ketev

Thank you for adding CandleStick Chart!

I have 2 questions:
In OHLC tails are in the same color like body but in CandleStick is not. When I change background to black tails hides. How can I make color of the tails like body? Maybe in CandlestickLinePen add option to copy color from body? When I add big portion of data for example 2 years all period are in screen and CandleStick are too small. How can I add HorzScrollBar or something like this and keep the scale of CandleStick? I can zoom it but I want to scroll back to earlier time period. Kamen

-------- ?????????? ????? --------
??: Werner Pamler
???????: [Lazarus] TAChart CandleStick Chart
??:
????????? ??: ???????, 2014, ????????? 16 22:09:11 EEST

In r46244 the TOpenHighLowCloseSeries has a new property "Mode":

selection "mOHLC" does the standard painting as before while

"mChandleStick" paints the candlesticks that you requested. Since your

code was mostly a copy of existing code I decided to stick to the old

series type, but just add the painting modes. There are also properties

"CandleStickUpBrush", "CandleStickDownBrush" and "CandleStickLinePen" to

control painting of the up and down bars and the border and shadow line.

I also added a little demo "financial" to the "demo" folder of the

TAChart installation which demonstrates both modes. It would be nice if

you could have a look if everything is fine - I'm not an expert in

financial charts.

I also fixed the bug which ignored the true minimum of the data -

therefore, it is no longer necessary to calculate the minimum by

yourself, just have a look at the code in the demo project. And,

finally, I modified the AddXOHLC method such that it automatically

initializes the size of the YCount of the chart source if the current

size would not be enough.

Reply by email

Werner Pamler
> How can I make color of the tails like body?

I uploaded a small modification today which takes care of your request: the color of the body border and the tails of the CandleStick series is determined by the property CandleStickLinePen. If you set this color to clDefault these lines will be painted in the color of the body. Please see the updated "financial" demo.

> How can I add HorzScrollBar or something like this and keep the

scale of CandleStick?
In TAChart you can zoom by left-dragging a rectangle across the chart. And you can pan the zoomed window by dragging with the right-mouse button down. Or you can implement more sophisticated features by using the chart tools.

In addition, there is a TChartNavScrollbar which you can use to scroll the zoomed window across the chart range. You just have to link its "Chart" property to the chart which you want to control. The "Min" and "Max" of the scrollbar map to the data range used in the chart. To get day-by-day scrolling set the scrollbar's Min and Max to the corresponding values of the horizontal axis (Chart1.GetFullExtent.a.x and b.x) at run-time.

Moreover, there is also a TChartNavPanel which displays the full range of the data and encloses the zoomed range by a rectangle. You can drag this rectangle over the chart, and the zoom window will follow automatically. Having "MiniMap" true displays a miniature chart for rough orientation. Again, you have to couple it to the chart of interest by means of the "Chart" property. In my feeling, however, there are still some weaknesses of this component, maybe I can look after them in the next days.

BTW: Do you know the TAChart documentation
http://wiki.lazarus.freepascal.org/TAChart_documentation?

Reply by email

Kamen Ketev

Thank you very much!

Regards,
Kamen

-------- ?????????? ????? --------
??: Werner Pamler
???????: [Lazarus] TAChart CandleStick Chart
??:
????????? ??: ??????????, 2014, ???????? 6 21:45:30 EEST

> How can I make color of the tails like body?

I uploaded a small modification today which takes care of your request:

the color of the body border and the tails of the CandleStick series is

determined by the property CandleStickLinePen. If you set this color to

clDefault these lines will be painted in the color of the body. Please

see the updated "financial" demo.

> How can I add HorzScrollBar or something like this and keep the

scale of CandleStick?

In TAChart you can zoom by left-dragging a rectangle across the chart.

And you can pan the zoomed window by dragging with the right-mouse

button down. Or you can implement more sophisticated features by using

the chart tools.

In addition, there is a TChartNavScrollbar which you can use to scroll

the zoomed window across the chart range. You just have to link its

"Chart" property to the chart which you want to control. The "Min" and

"Max" of the scrollbar map to the data range used in the chart. To get

day-by-day scrolling set the scrollbar's Min and Max to the

corresponding values of the horizontal axis (Chart1.GetFullExtent.a.x

and b.x) at run-time.

Moreover, there is also a TChartNavPanel which displays the full range

of the data and encloses the zoomed range by a rectangle. You can drag

this rectangle over the chart, and the zoom window will follow

automatically. Having "MiniMap" true displays a miniature chart for

rough orientation. Again, you have to couple it to the chart of interest

by means of the "Chart" property. In my feeling, however, there are

still some weaknesses of this component, maybe I can look after them in

the next days.

BTW: Do you know the TAChart documentation

http://wiki.lazarus.freepascal.org/TAChart_documentation?

Reply by email

Kamen Ketev

When I am loading new
financialdemo there is an error (please see attached image). I was updated only tamultiseries.pas from http://svn.freepascal.org/svn/lazarus/trunk/components/tachart/. Which other files I must update?

Regards,
Kamen

-------- ?????????? ????? --------
??: Werner Pamler
???????: [Lazarus] TAChart CandleStick Chart
??:
????????? ??: ??????????, 2014, ???????? 6 21:45:30 EEST

> How can I make color of the tails like body?

I uploaded a small modification today which takes care of your request:

the color of the body border and the tails of the CandleStick series is

determined by the property CandleStickLinePen. If you set this color to

clDefault these lines will be painted in the color of the body. Please

see the updated "financial" demo.

> How can I add HorzScrollBar or something like this and keep the

scale of CandleStick?

In TAChart you can zoom by left-dragging a rectangle across the chart.

And you can pan the zoomed window by dragging with the right-mouse

button down. Or you can implement more sophisticated features by using

the chart tools.

In addition, there is a TChartNavScrollbar which you can use to scroll

the zoomed window across the chart range. You just have to link its

"Chart" property to the chart which you want to control. The "Min" and

"Max" of the scrollbar map to the data range used in the chart. To get

day-by-day scrolling set the scrollbar's Min and Max to the

corresponding values of the horizontal axis (Chart1.GetFullExtent.a.x

and b.x) at run-time.

Moreover, there is also a TChartNavPanel which displays the full range

of the data and encloses the zoomed range by a rectangle. You can drag

this rectangle over the chart, and the zoom window will follow

automatically. Having "MiniMap" true displays a miniature chart for

rough orientation. Again, you have to couple it to the chart of interest

by means of the "Chart" property. In my feeling, however, there are

still some weaknesses of this component, maybe I can look after them in

the next days.

BTW: Do you know the TAChart documentation

http://wiki.lazarus.freepascal.org/TAChart_documentation?

Reply by email

Werner Pamler
> (please see attached image)

Sorry I can't find an attachment here... What did you do? Replace the tamultiseries.pas in a TAChart of Lazarus 1.2.4? I'm not sure if this is gonna work because there have been several changes since 1.2.4. Switch to trunk, and you won't see an error.

Reply by email