Hi,
Just making my first steps with TeeCharts...
Here is my first problem:
My app will have a chart display for stocks, commodities ... So far I have not been able to manage that the displayed bars on a candle stick chart do NOT overlap. I would prefer having something like a min spacing - in pixels or so - between the bars.
Can someone please point me to the right direction.
Thanks
Candle stick bars overlap
-
- Newbie
- Posts: 5
- Joined: Fri Nov 05, 2004 5:00 am
- Contact:
Hi.
What's the total number of points you're trying to display on chart ? If it's more than 40-50, then I think the best approach is to use the chart paging and display data on severar chart pages. There are couple of examples of this feature available in TeeChart NET demo. The following examples displays 500 points with 50 points per chart page. You can easily navigate through all pages by using the Page Current, Next and Previous methods:a candle stick chart do NOT overlap. I would prefer
Code: Select all
tChart1.Page.MaxPointsPerPage = 50;
tChart1.Page.Current = 1; // move to 1st page
// alternatively, you can also use Page.Next and Page.Previous
// methods for navigation
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
-
- Newbie
- Posts: 5
- Joined: Fri Nov 05, 2004 5:00 am
- Contact:
calc Candle.candlewidth for not overlapping
I tried to do below code onbeforedrawchart event:
Numpixels:=abs(scandle.CalcXPos(scandle.LastValueIndex)-scandle.CalcXPos(scandle.FirstValueIndex))+2;
PixelPerbar:=math.Max(1,trunc(Numpixels/NumBars+1)-Scandle.pen.width-2);
if pixelperbar>=20 then
Begin
scandle.CandleWidth:=20;
ENd
else
Scandle.CandleWidth:=trunc(pixelperbar);
in this example, candle does not overlap, but scandle.CandleWidth should be bigger as possible.
Just compare your chart with a stock charts software (i.e Metastock).
Numpixels:=abs(scandle.CalcXPos(scandle.LastValueIndex)-scandle.CalcXPos(scandle.FirstValueIndex))+2;
PixelPerbar:=math.Max(1,trunc(Numpixels/NumBars+1)-Scandle.pen.width-2);
if pixelperbar>=20 then
Begin
scandle.CandleWidth:=20;
ENd
else
Scandle.CandleWidth:=trunc(pixelperbar);
in this example, candle does not overlap, but scandle.CandleWidth should be bigger as possible.
Just compare your chart with a stock charts software (i.e Metastock).
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi fnn,
I don't understand what's your point here. However you may be interested in checking a couple features:
1. Candle style, you'll find an example at All Features\Welcome !\Chart styles\Financial\Candle (OHLC)\Candle Custom colors.
2. OHLC compression function, there's an example at All Features\Welcome !\Functions\Financial\Compression OHLC in the features demo.
The features demo can be found at the program group created by TeeChart's installer.
I don't understand what's your point here. However you may be interested in checking a couple features:
1. Candle style, you'll find an example at All Features\Welcome !\Chart styles\Financial\Candle (OHLC)\Candle Custom colors.
2. OHLC compression function, there's an example at All Features\Welcome !\Functions\Financial\Compression OHLC in the features demo.
The features demo can be found at the program group created by TeeChart's installer.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |