setMinMax and dates

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
RJCookeSE
Newbie
Newbie
Posts: 8
Joined: Fri Feb 17, 2012 12:00 am
Contact:

setMinMax and dates

Post by RJCookeSE » Mon Jul 02, 2012 8:22 pm

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

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: setMinMax and dates

Post by Yeray » Fri Jul 06, 2012 10:37 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

RJCookeSE
Newbie
Newbie
Posts: 8
Joined: Fri Feb 17, 2012 12:00 am
Contact:

Re: setMinMax and dates

Post by RJCookeSE » Fri Jul 06, 2012 3:23 pm

Thank you, I'll check it out. I also purchased a commercial license so I could trace the code myself.

RJCookeSE
Newbie
Newbie
Posts: 8
Joined: Fri Feb 17, 2012 12:00 am
Contact:

Re: setMinMax and dates

Post by RJCookeSE » Fri Jul 06, 2012 3:30 pm

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.

RJCookeSE
Newbie
Newbie
Posts: 8
Joined: Fri Feb 17, 2012 12:00 am
Contact:

Re: setMinMax and dates

Post by RJCookeSE » Fri Jul 06, 2012 4:29 pm

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;

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: setMinMax and dates

Post by Yeray » Tue Jul 10, 2012 3:50 pm

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply