Sunday, 21 August 2011

GSoC 2011: Week 13

This week mostly I worked on fixing bugs, improving some features and documenting my work. The panning feature required much attention as mentioned in my previous report. So I worked around this by changing the equations used for panning. One issue that we faced was that the existing panning feature had a zoom associated with it. On exploring the Highcharts reference manual we found out that Highchart rounds off to nearest tick in the plot. So on disabling that option the panning feature worked fine.

Apart from that I worked on providing a 'Reset zoom' link to get the original display(if zoomed/panned), added a FAQ in the official documentation about 'How to use the zoom search feature?' (FAQ 6.32), added some code documentation, fixed issue with browsing foreign values and handled the notice that used to be displayed in case data label not selected.

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.

Monday, 8 August 2011

GSoC 2011: Week 11

Things worked on this week:
  • Using AJAX to get data row on point click. 
  • Better support for date/time objects
  • Panning feature
Using ajax to get the data row on click reduces the amount of data being passed on to the javascript layer. On data point click the where clause of the point is passed on to the server in request and the data row is returned in response. 

Support for date/time turned out to be rather tricky in Highcharts. The different date/time formats have to be converted into javascript 'date' type to have correct distance between them. Somehow using new Date(dateString) does not produce correct plots. Next I tried code snippet at http://www.mattkruse.com/javascript/date/source.html , which a getDateFromFormat function which return the getTime of the date. So the difference of those getTime() can be a measure of distance between two dates. Will continue on on working on it this week.

Highcharts has an inbuilt zoom feature but not a panning feature. Also, the zoom feature utilizes the mouse click and drag events, so a pan cannot be used with those events. The code snippet at http://jsfiddle.net/HXUmK/4/ provides a method of implementing zoom(mousewheel) and pan(click and drag) manually. Currently I'm trying to integrate it within my code, there are some unresolved issues with use of  setExtremes() functions. 



Sunday, 31 July 2011

GSoC 2011: Week 10

I made a lot of changes to the edit feature this week. Main objective was to avoid replot of charts on edit and to replot only the points which gets changed. Progess this week:
  • Optimizations to edit feature.
  • Edit support when using strings as fields (only replot of chart , query generation remains the same)
  • Minor changes like validations, some bugs.
Also I was working on using ajax to get a selected point's data row, rather than posting the whole data on submission of input criteria. The edit feature also changes accordingly along with some events, so its getting a little complicated. This was in my to-do list of 10th week but it stalled. I'll try to finish it in this week and continue on to work on more optimizations.

Sunday, 24 July 2011

GSoC 2011: Week 9

This week I worked on two major issues:
  • Changing the display of the data point content  from a form based interface to a dialog based display.
  • Providing support for plotting of other data-types like strings.
Using the jQuery-UI plugin the first issue was rather straight forward. On point click/select just open a dialog which will contain the HTML of the dataDisplay form. This helped in cleaning up the interface. It adjusts well to different resolutions which the previous work did not.

The second issue was a little complex. Direct plotting of strings is not well supported in Highcharts, it is usually through 'categories' option of xAxis/yAxis. The data points are plotted corresponding to each of category values in this case. In our case, a field may have duplicates so in categories, the labels are repeated on the axes. So instead of using categories I assigned each distinct string (for a field) an integer value (eg. 1,2,3...), mapped the corresponding string values to integer values and formatted the labels to show the string values instead of the integer map. This helped to solve the following issues:
  • Duplicate labels in the axes are removed (as opposed to categories)
  • Can now plot them as simple integer values
  • In addition to above sorting the array containing the distinct values (inbuilt sort for now) solves the issue where we have a large number of labels and their text get mixed up. What happens now is like integer labels some divisions are created on the axes and when we zoom in the divisions get smaller and labels within that division are show. 
For the next week, compatibility issues still need to be fixed for different browsers. Also, the update feature needs to be modified to support the replotting of strings.

Monday, 18 July 2011

GSoC 2011: Week 8

This week's work was to fix bugs and test the interface. Some pending issues were fixed like:
  • The display field of a table is the defualt selected value for DataLabel and if not selected it defaults to the display field also.
  • The edit functionality was malfunctioning, there were issues with null values on fileds. The Datapoint display form now includes a null checkbox to indicate null value. 
  I ran some tests on the interface to check response timings and also asked some users to try and give suggestions. Some of the things that came up were:
  • The input phase, when we select the two fields; on selection of a field the data-type,operators and value field change and it takes some time. I was suggested to improve upon the response time there.
  • The plot generation process also slow according to some users. If we are accessing the database locally (on the same system) it is relatively fine but when accessed on a remote server, it slows down. 
  • Depending on the resolution, the plot and the Data point display form can appear adjacent to each other or one below the other (the plot up and the form below it)
  • One of the user reported that his chrome browser crashed once on the plot generation phase.
  • Some users suggested that the divs are not alligned properly. For example, for a higher resolution when the plot and form appear adjacent to each other, the plot div is slightly higher than the form div. So it did not look good.
  • Some users were more interested in have the plot of text fields( fields that are strings and not only numeric), which is not currently available in the interface.
So looking at the response I got from these tests, I have to focus on response timings more and include the plot functions of strings next. Also, the positioning of the Data-point form and plot is a problem. It could well be fixed as Marc suggested, by having a dialogue box type form which appears at the center of the screen when we click a point and disappears after we edit/view and not always have it on the screen.  The input phase can be improved by passing the entire table information(field type, collation, operators and value field) as json and using jQuery to update it onChange.