I want to show my users a chart that lists the node views hit for that day (Content statistics: Views today), something like this:

enter image description here

So the user can see how many views each node of his had in each day of last week!

I'm using the Charts module for making the charts, using the Google charts API as the charting engine (library) and it works just fine.

Issue is, that I have no idea if it's possible to list last 7 days date in Views at all or not, let alone integrating it with Charts.

Any suggestions about how to do so?

  • 2
    I just realized I didn't +1 this yet (soooooooorry)! Jul 20, 2015 at 20:09

1 Answer 1


Using the Charts module

Step 1: Create the tabular format of the view

First to address the "if it's possible to list last 7 days date in views at all or not" part of your question, you really need to first work on getting the view created correctly. That's also what's recommended in the Bonus tip within Steps to create charts using the views UI, i.e.:

You may find it easier to start with a "Table" display and convert it to a chart display after setting up the data. It can be easier to visualize what the result of the chart will be if it's been laid out in a table first. ...

Step 2: Add the chart to your view

Do not try to start this step if you didn't first complete the prior step.

There is an issue which might help to answer this question, or at least to understand the challenge here. I.e. Graph node input over time (support date formatting on a continuous axis).

In Comment #3 of that issue is stated: 'The trouble here is that neither Views nor Date modules provide aggregation options for date-based fields.'.

Using the Quant module

If using the Charts module you can't get it to work (or don't want to consider the suggestions above), then you may want to look at the Quant module as an alternative. Here are some excerpts from its project page:

... provides an engine for producing quantitative, time-based analytics for virtually any Drupal component. Quant takes raw data about normal Drupal actions, such as node creation, and plots the activity over time, with the selected time being configurable. See the screenshot provided for a better understanding.

Provided charts:

  • Content creation
  • Comment creation
  • Content creation by type
  • Aggregate content creation
  • User creation
  • Page views (requires Statistics)
  • User shouts (requires Shoutbox)
  • User point transactions (requires User Points)
  • Group creation (requires Organic groups)
  • Group joins (requires Organic groups)
  • Invites sent (requires Invite)
  • Invites accepted (requires Invite)
  • Statuses shared (requires Facebook-style statuses)
  • Private messages (requires Private message)

Especially the "Page views* chart that is provided might be close to what you're looking for.

Using the Visitors module

If you're looking for info related to visitors of a website (registered users is a subset of them ...), the Visitors module might be a valid alternative to consider also (and/or addition to the above modules). In this case, all you have to do is to enable the module and review the various out-of-the-box reports (which include charts created with the pChart library).

The demo site contains some sample reports (charts) available to anonymous users also. This demo site also shows some additional blocks with reports also created by the Visitors module.

In this specific case, you probably would want to look at the Days of week report (and chart). Note that, as a bonus, you can specify the desired date filter (from / to) also.

Refer to the Visitors community docu for some more details.

Extra reporting features can be enabled via these sub-modules:

  • The Visitors GeoIP module, to also report about countries and cities.
  • The Visitors Browscap module, providing statistics on visiting browsers.

Evaluating other charting modules

If none of the above modules would work in your case, then you might want to look at the "Comparison of Charting modules" documentation.

Disclosure: I'm a (co-)maintainer of all modules mentioned above (and original author of the comparison), I hope this does not violate the site's policy on self-promotion.

  • Thanks Pierre for the reference, I went through that issue and thought maybe since two years ago maybe someone came up with some other workaround for this. so what you are saying is that achieving this is kinda impossible with views and date ?
    – Sohail
    Jul 14, 2015 at 6:30
  • 1
    The key word for me in that comment is "provide". This means it is going to take some work, but is doable. Perhaps the Aggregation Plus module can help, or perhaps you need to define your own. The chart aspect adds further complexity to the problem, and I admit not trying any of this myself. Jul 17, 2015 at 12:58
  • 1
    So all and all I guess I should try a custom approach, I'll give a try to Quant as well and let you know If I managed to do anything about it, thanks for the detailed answer Pierre.
    – Sohail
    Jul 19, 2015 at 13:47
  • 1
    @Pierre.Vriens, I also want to thank you for this answer. I've been using the Charts module in some of my websites but didn't know the Quant module. I will look at it.
    – herci
    Jul 20, 2015 at 20:02
  • 1
    Thanks Pierre, I was looking for an answer for the views part of the question and to be able to sort by aggregated date like days and week, but you did answer what is the current situation regarding that. thanks
    – user23288
    Jul 21, 2015 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.