### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook (preview only)

### Author Topic: Chart question  (Read 3838 times)

#### xinyiman

• Hero Member
• Posts: 2033
##### Chart question
« on: June 13, 2014, 08:20:17 pm »
Hello guys, who tells me how to make the candlestick charts that do not necessarily depart from the value 0?

I could use colored bars or red or green for example, start at 8 and end at 13. Thank
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

#### wp

• Hero Member
• Posts: 6650
##### Re: Chart question
« Reply #1 on: June 13, 2014, 08:34:37 pm »
To be honest I never used such a chart. Could you post a sketch how it should look like?
If it would come down to a bar series: This series has a "ZeroLevel" property to start the bars at.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

#### xinyiman

• Hero Member
• Posts: 2033
##### Re: Chart question
« Reply #2 on: June 13, 2014, 09:36:09 pm »
Thanks ZeroLevel with works like I want.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

#### taazz

• Hero Member
• Posts: 5363
##### Re: Chart question
« Reply #3 on: June 13, 2014, 09:40:28 pm »
To be honest I never used such a chart. Could you post a sketch how it should look like?
If it would come down to a bar series: This series has a "ZeroLevel" property to start the bars at.
Take a look on the attached image. In short candlesticks are financial charts for a stock in predefined intervals in the day eg 5 minutes 10 15 etc. What they show are the 4 basic prices of a stock for that period open= the price of the stock 's first action (buy/sell) for that interval ee 5min close the price of the last action high the highest price inside the interval and low is the lowest price in the interval if high or low are equal to open/close no sticks are drawn for that if the open price is higher than the close price then the rectangle is red if the close price is higher or equal to the open price then in green those color should be adjustable and based on the app's general theme. a sample can be seen at http://www.tmssoftware.com/site/img/chart_collection_large.png.   Titled OHLC chart (top left)
« Last Edit: June 13, 2014, 09:42:24 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

#### wp

• Hero Member
• Posts: 6650
##### Re: Chart question
« Reply #4 on: June 13, 2014, 11:16:42 pm »
Sounds similar to the ohlc series that comes with TAChart. There is an example in the (lazarus)/components/tachart/demo/multi folder, or have a look at http://wiki.lazarus.freepascal.org/TAChart_Demos#multi (a bit down the page).
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

#### taazz

• Hero Member
• Posts: 5363
##### Re: Chart question
« Reply #5 on: June 13, 2014, 11:39:56 pm »
true both Box-and-Whiskers-Series and OHLC can be used. I prefer the box and whiskers look from the ticks on a stick personally but hey different strokes and all that.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

#### xinyiman

• Hero Member
• Posts: 2033
##### Re: Chart question
« Reply #6 on: June 14, 2014, 03:02:13 pm »
In fact I want to make a chart like this

and the example is very similar but has OHCL dashes too ...
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

#### wp

• Hero Member
• Posts: 6650
##### Re: Chart question
« Reply #7 on: June 14, 2014, 05:31:08 pm »
I'd use the Box-Whisker series, just have a look at the demo that I mentioned above. You can configure every detail of the series, e.g. remove the "Whisker" by setting the WhiskerWidth to zero. The only problem is that a common color is used throughout the series. In order to change color between increasing and decreasing price I'd use two series: the first one in green for the increasing price, and the other one in red for the decreasing price. When you add a data point to the chart you only have to decide whether the price is increasing or decreasing in order to add it to the correct series.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

#### xinyiman

• Hero Member
• Posts: 2033
##### Re: Chart question
« Reply #8 on: June 14, 2014, 07:19:45 pm »
Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1