Page 1 of 1

Candle stick bars overlap

Posted: Fri Nov 05, 2004 10:35 am
by 8127800
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

Posted: Mon Nov 08, 2004 8:44 am
by Marjan
Hi.
a candle stick chart do NOT overlap. I would prefer
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:

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

Posted: Tue Nov 09, 2004 8:54 am
by 8127800
Hi,

Thanks for that hint. I'll give it a try. :-)

Regards

calc Candle.candlewidth for not overlapping

Posted: Thu Nov 23, 2006 7:50 am
by 9336596
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).

Posted: Thu Nov 23, 2006 11:44 am
by narcis
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.