Looking at the module, it seems all the quants are only visible on the /analytics page...

Is there a way you could allow the embedding of a chart within a certain page or block, by calling something like quant_embed_quant(), similar to how views_embed_view() works? This would be really powerful for my own data analytics and reporting...

Comments

mstef’s picture

Status: Active » Postponed (maintainer needs more info)

Yep - that's the beauty of this module. I've been trying to think of better ways to handle it. Maybe provide a block for each module, but that doesn't offer a time selector. Maybe that should be in the block too..

What do you think? Any ideas..

For now, you can add the following in a custom block, and remember it's very flexible. Check out quants.quant.inc for examples..

<?php 
  if (!(arg(0) == 'user' && is_numeric(arg(1)))) {
    return FALSE;
  } 
  else {
    $uid = arg(1);
  }

  // Content type X by user Y
  $quant = new stdClass;
  $quant->id = 'content_x_by_user_y';
  $quant->label = t('Content by user');
  $quant->labelsum = TRUE;
  $quant->table = 'node';
  $quant->field = 'created';
  $quant->query = "SELECT created FROM {node} WHERE type = 'blog' AND uid = $uid AND created >= %d";
  $quant->dataType = 'single';
  $quant->chartType = 'line';
  print quant_process($quant, '-1 month');
?>
gateway69’s picture

I moved my support request to another ticket http://drupal.org/node/1027242

mstef’s picture

Status: Postponed (maintainer needs more info) » Fixed

The example in #1 shows how to do this in D6. You could also load the quant uses quant_get_quants(), then print it.

In D7, quants are now Quant-class objects. You can do $quant->execute($period), then print $quant->render(). Quants can either be defined on the spot, or loaded with quant_get_quant(). See more info in quant.api.php and quant.module.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.