Page 1 of 1

setMinMax and dates

Posted: Mon Jul 02, 2012 8:22 pm
by 16461616
As a long-time customer of the VCL product, I'm very excited about using TChart for HTML5.

I'm having some trouble using setMinMax() when the data type of the x-axis values is Date. I was implementing the Scroller tool when I ran into this. I have an array of Date objects retX[]. This array is assigned to the data.x property of the two series which I'm plotting. Simply charting the entire data set works fine. If I try this:

cht.axes.bottom.setMinMax(retX[retX.length-13], retX[retX.length-1])

where cht = new Tee.Chart("canvasID"), then in date.format.js I get an uncaught exception on line 38 and the chart fails to redraw. If, when I create the chart, I use integer values for in retX[], all works as expected.

As another point of reference: if I don't use setMinMax and implement the Scroller tool then, as expected, the selection range in the scroller starts at full range. I can size the selection in the scroller, but I cannot scroll it. When I try to scroll the selection area left or right it snaps to the far left of the scroller canvas and will no longer move.

Any help would be greatly appreciated.

Thanks,
Rob Cooke

Re: setMinMax and dates

Posted: Fri Jul 06, 2012 10:37 am
by yeray
Hi Rob,

Excuse us for the delayed reply.
We've made a variation of the scroller example working with dates. We'll upload it to the server asap.

Re: setMinMax and dates

Posted: Fri Jul 06, 2012 3:23 pm
by 16461616
Thank you, I'll check it out. I also purchased a commercial license so I could trace the code myself.

Re: setMinMax and dates

Posted: Fri Jul 06, 2012 3:30 pm
by 16461616
I just checked out the demo. You'll notice that when you try to move the range around in the scroller canvas that the behavior I describe still happens. The range snaps to the far left and then you can't move it anymore. I tried this in Chrome, IE9 and Firefox with the same results. I haven't had time to trace through it myself, yet.

Re: setMinMax and dates

Posted: Fri Jul 06, 2012 4:29 pm
by 16461616
I think I've got it fixed, although I haven't yet gone back to test with other data types in the x-axis. Still, the logic is sound.

In teechart-extra.js, line 315 change

Code: Select all

v=(pp+this.delta-this.bounds.x)*ra/s;
to

Code: Select all

v=this.min + (pp+this.delta-this.bounds.x)*ra/s;

Re: setMinMax and dates

Posted: Tue Jul 10, 2012 3:50 pm
by yeray
Hi Rob,

Yes, we've also fixed it in a quite similar way. I'll send you the actual teechart-extra.js file to the mail account you have registered in this forum.