Page 1 of 1

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

Posted: Fri Nov 01, 2013 2:45 pm
by 17765406
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();
}

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

Posted: Tue Nov 05, 2013 2:10 am
by 17765406
I forgot to add a date parameter.
I believe the function might be like this
-> new Tee.Candle(new Date(), open, high, low, close).

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

Posted: Tue Nov 05, 2013 8:26 am
by narcis
Hello,

You should do as in the example I posted here.

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

Posted: Wed Nov 06, 2013 10:36 am
by 17765406
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);
	  }
};


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

Posted: Fri Nov 08, 2013 8:27 am
by narcis
Hello,

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

Thanks in advance.