« Back Issue #271
  • 2016-10-15 15:28 Reported by prana
  • 2016-11-13 18:02 Marked fixed
Status: Marked fixed
Priority: Medium

Initial patch for developing statistics chart for each group's items

prana 2016-10-15 15:28

Currently under Manage Group > Statistics page, number of views for each item of the group is displayed based on different time period (last hour, day, month, year). Add a new page that adds a chart to display those data graphically for different time period.

administrator 2016-10-20 11:42

Hi Pragya,

One thing I was a little worried about was that dygraph is MIT licensed. Can you find a GPL 3 graphics library with fewer dependencies on other JS libraries that does the same job?

Best, Chris

prana 2016-10-20 18:06

Hi Professor,

Sure, I'll look for the alternative library. For now, I have uploaded a patch 2 that addresses the comments from our last meeting:

  • Added missing @return
  • Added missing documentation
  • Fixed wrong ending tag for \<p\>
  • Added translation
  • Removed blank line after <?php
  • Removed Timezone setting
  • Removed javascript section for graph in View and instead passed it from controller via $data['SCRIPT']
administrator 2016-10-22 10:05

Hey Pragya,

Thanks for the patch! It still needs some minor tweaks, but I can handle them. I am waiting on the licensing agreement signature to decide whether to push your patch to the main repository.

Best, Chris

prana 2016-10-23 15:54

Hi Professor, got busy this weekend. I'll send the pdf of the agreement tonight!

Pragya

prana 2016-10-28 17:55

Hi Professor,

Uploading patch 3 that uses RGraph instead of dygraphs for the chart.

The main difference with the new one is there's no any labels on the x-axis because I couldn't figure out a way to scale it automatically depending on number of data. Instead of that, I added tooltips feature that shows corresponding date as you move the mouse around the chart area.

At the end of the script, there are 4-5 lines(RGraph.tooltips.style) that adds styling to the tooltip. Not sure if you would want it there! In case if we remove that additional styling, it will still look ok (just not as prettier as with styling).

administrator 2016-10-29 23:27

Hey Pragya,

Your code is now in the git repository. Congratulations! Please do a git pull to see the changes I made after your code. I didn't use dygraph or rgraph, I wrote my own small chart class in Javascript instead. I probably still need to tweak how it draws the x-axis labels. Yioop is installed on systems that use sqlite, mysql, and postgres. The queries you added didn't work with the group by syntax for Postgres. You can see how I fixed that.

Best, Chris

administrator 2016-11-13 18:02

Thanks Pragya! Fixed by b094c6a9.

prana 2016-11-13 18:02
X