Monday 15 August 2011

GSoC 2011: Week 12

This week I continued my work on the issues of plotting support for date-time fields. After looking around for a suitable distance criteria, I decided upon the timestamp values of each date-time (milliseconds passed since 1970-01-01 00:00:00). Date, time, datetime field values were converted into timestamps and plotted with these values to give a meaningful distance measure. Time fields were measured by considering the time values on the day 1970-01-01. The date library at http://www.mattkruse.com/javascript/date/source.html was helpful in converting values to and from timestamps.

The second issue was implementing zoom and pan based on the code snippet at
http://jsfiddle.net/HXUmK/5/. Although the logic of zoom and pan is right the system response time is not good. Also, the equations used for implementing zoom by readjusting extremes are not correct. The equations used in the snippet were:           
newXMin = xMin + (1 - zoomRatio) * xMax                                                            newXMax =  Max * zoomRatio 
(zoomRatio varying from 1 to .6, xMin and xMax being the datamin and datamax)

I replaced the equation with:                                                                                    newXMin  = xMin + (xMax - xMin) * (1 - zoomRatio) / 2;
newXMax = xMax - (xMax - xMin) * (1 - zoomRatio) / 2;
(zoomRatio varying from 1 to .6, xMin and xMax being the axis-min and axis-max)

This improved the mousewheel zoom to some extent. The panning feature was taken from the snippet but its very difficult to use. The logic seems to be right, readjusting the axis extremes based on the position of mouse drag but it is very sensitive. Even a little drag sometimes shifts the axis to a much larger value. I'll look to improve on this but I still think that using the inbuilt zoom, where we can select an area and zoom into it is much powerful and faster way of implementing the zoom/pan.

No comments:

Post a Comment