Adding data to CandleChart(OHLC) for TeeChart(Javascript/HTM

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
twarpdev
Newbie
Newbie
Posts: 4
Joined: Wed Mar 13, 2013 12:00 am

Adding data to CandleChart(OHLC) for TeeChart(Javascript/HTM

Post by twarpdev » Fri Nov 01, 2013 2:45 pm

I'm trying to draw a CandleStick chart for a TeeChart JavaScript Version. However I only found the below demo. I'd like to find out how to add series(data) instead of using a addRandom() method. a addRandom() does not explain how to add a actual data.

I believe it could be something like this new Tee.Candle(open, high, low, close).
Please provide me a simple demo.

function draw() {
Chart1=new Tee.Chart("canvas");
Chart1.title.text="Candle OHLC";

var ohlc=new Tee.Candle();
Chart1.addSeries(ohlc).addRandom(20);

Chart1.draw();
}

twarpdev
Newbie
Newbie
Posts: 4
Joined: Wed Mar 13, 2013 12:00 am

Re: Adding data to CandleChart(OHLC) for TeeChart(Javascript/HTM

Post by twarpdev » Tue Nov 05, 2013 2:10 am

I forgot to add a date parameter.
I believe the function might be like this
-> new Tee.Candle(new Date(), open, high, low, close).

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Adding data to CandleChart(OHLC) for TeeChart(Javascript/HTM

Post by Narcís » Tue Nov 05, 2013 8:26 am

Hello,

You should do as in the example I posted here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

twarpdev
Newbie
Newbie
Posts: 4
Joined: Wed Mar 13, 2013 12:00 am

Re: Adding data to CandleChart(OHLC) for TeeChart(Javascript/HTM

Post by twarpdev » Wed Nov 06, 2013 10:36 am

Is there any way that I can add dates as bottom labels instead of index?
I put the date like the below code, but I can not use the tooltip once I put those dates as bottom labes.

Code: Select all

var dates = [];
for(var i =0 ; i<json.length; i++){
	ohlc.add(json[i].OPEN, json[i].CLOSE, json[i].HIGH, json[i].LOW);
	dates.push(new Date(json[i].CHART_DATE));
}
Chart1.series.items[0].data.x = dates;
Chart1.axes.bottom.labels.dateFormat = "mm-dd-yyyy"

tip=new Tee.ToolTip(Chart1);
tip.ongettext=function(tool, text, series, index) {

	  if (tip.render=="dom"){
	       return 'Point: <strong>'+ index.toFixed(0) +'</strong><br/>Open: '+series.data.open[index].toFixed(2)+'<br/>High: '+series.data.high[index].toFixed(2)+'<br/>Low: '+series.data.low[index].toFixed(2)+'<br/>Close: '+series.data.close[index].toFixed(2);
	   }else{
	       return 'Point : '+ index.toFixed(0) +'\nOpen : '+series.data.open[index].toFixed(2) +'\nHigh : '+series.data.high[index].toFixed(2) +'\nLow : '+series.data.low[index].toFixed(2) +'\nClose : '+series.data.close[index].toFixed(2);
	  }
};


Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Adding data to CandleChart(OHLC) for TeeChart(Javascript/HTM

Post by Narcís » Fri Nov 08, 2013 8:27 am

Hello,

Did my last comment at StackOverflow help you solve the problem or do you still need help?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply