Sunday 3 February 2013

Data comparison on StatDiary

During my last day's post I realized that data comparison is indeed one of the most requested result users want. So I decided to add it today.


Comparison is great method to see how 2 data flow correlates with each other. It can be two or more streams, however make 3 or more work nice on one chart can be tricky. So in this first implementation I added two. There is a new link on the main hub page saying [Create comparison]:


Going there you will find a form where the 2 statistics can be selected:


The following screen shows the new feature:


For the optimal view the 2 scale located on the opposite sites and data value ranges are equalized as well. You can select a date range below the stat - so you can narrow down or broaden the visible data.

Fortunately this update could be rolled out pretty soon with only a little development. I added a new module that defines two pages: the selection and the presentation page. Selection page is a simple Form API page. Presentation page is using the existing statistics API of StatDiary. The API works the following way:

  • creation of a chart object (represents one chart display with any number of data flows)
  • setting up an interval (so all loaded streams are in the same range)
  • loading all the data streams
  • adding extra configuration (such as scaling, labels, colors, legend, etc)
  • generating the output
One thing I always realize that I never make it perfect. Every time I make a new feature there is something that should be changed in the underlying API. This time the y-axis made me a little headache. So far all the stats were displayed with the same y-axis scale - such as the global all-mashup page (and that was one of the reasons why it wasn't that useful).
The solution I used is temporary, I used the configuration of the Highcharts API and not the API directly. Should be fixed sometime.

---

Anyways, it works. If it isn't, please, file a bug report.

Peter

No comments:

Post a Comment

Note: only a member of this blog may post a comment.