I have 3 terms in Taxonomy > User Points: Articles, Comments and Favorites. I created some rules to grant user points of one of these categories, based upon the users' actions. So far, everything works fine.

Now, I'd like to create a pie chart of the user points per category for the profile pages. For example, such a pie chart might look like this:

Pie chart

How can I achieve this?

Edit: I'm working with User Points 7.x-1.0.


There are a number of chart modules for drupal.

If you used the charts module, it has views integration, so assuming you are using the user points module, and that user points has view integration, you should be able to create a view with items grouped by term and display as a chart.


Replicated your environment as above, updated the userpoints module to 7.x-1.x (dev), installed charts module (and included google charts module to test), constructed view of userpoints with contextual filter on user and the chart works perfectly! Thanks for asking the question, I have suddenly thought of loads of places I could use similar graphic incentives.

Here is the exported view - in this example it uses taxonomy terms article, page and comments:

$view = new view();
$view->name = 'points_chart_userpoints';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'userpoints';
$view->human_name = 'points_chart_userpoints';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'userpoints table block';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'chart';
$handler->display->display_options['style_options']['library'] = '';
$handler->display->display_options['style_options']['label_field'] = 'tid';
$handler->display->display_options['style_options']['data_fields'] = array(
  'points' => 'points',
  'tid' => 'tid',
$handler->display->display_options['style_options']['field_colors'] = array(
  'points' => '#2f7ed8',
  'tid' => '#0d233a',
$handler->display->display_options['style_options']['width'] = '';
$handler->display->display_options['style_options']['height'] = '';
$handler->display->display_options['style_options']['xaxis_labels_rotation'] = '0';
$handler->display->display_options['style_options']['yaxis_labels_rotation'] = '0';
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['label'] = 'no points';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'no points found';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Userpoints: User */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'userpoints';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
/* Field: Userpoints: Current points in category */
$handler->display->display_options['fields']['points']['id'] = 'points';
$handler->display->display_options['fields']['points']['table'] = 'userpoints';
$handler->display->display_options['fields']['points']['field'] = 'points';
/* Field: Userpoints: Points category */
$handler->display->display_options['fields']['tid']['id'] = 'tid';
$handler->display->display_options['fields']['tid']['table'] = 'userpoints';
$handler->display->display_options['fields']['tid']['field'] = 'tid';
/* Contextual filter: User: Uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['relationship'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'user';
$handler->display->display_options['arguments']['uid']['default_argument_options']['user'] = FALSE;
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';

/* Display: Chart (block) */
$handler = $view->new_display('block', 'Chart (block)', 'block');

/* Display: Table (block) */
$handler = $view->new_display('block', 'Table (block)', 'block_1');
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'points' => 'points',
  'tid' => 'tid',
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'points' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  'tid' => array(
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['defaults']['row_options'] = FALSE;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'userpoints/chart';
  • I've installed the Charts module and created a pie chart. I'm getting the following errors: 1) Strict warning: Declaration of userpoints_views_handler_field_category::init() should be compatible with views_handler::init(&$view, &$options) in _registry_check_code() (line 3160 of C:\wamp\www\mysite\includes\bootstrap.inc). 2) Strict warning: Declaration of userpoints_views_handler_field_category::pre_render() should be compatible with views_handler_field::pre_render(&$values) in _registry_check_code() (line 3160 of C:\wamp\www\mysite\includes\bootstrap.inc). Any ideas for a solution? – Jeroen Dec 17 '13 at 22:52
  • I have not used userpoints module specifically, but itr sounds like this is very much a problem with userpoints code rather than misconfiguration. I would try updating userpoints to the dev version to see if they have fixed this. Other than that I have no suggestions except perhaps flushing the views cache just in case. – autopoietic Dec 18 '13 at 9:24
  • If (or while) you continue to have problems with userpoints>views>charts, the only solution (hack) I can suggest is to duplicate the user points in another field with better integration with views. As a last resort, or temporarily, you could use views_php or computed_field to get your userpoints values into a different field in the view. – autopoietic Dec 18 '13 at 9:34
  • replicated your setup and had same warning, updated userpoints to 7.x-1.x and it went away – autopoietic Dec 18 '13 at 12:06
  • That's odd: I'm working with User Points 7.x-1.0 too. Did you activate the Userpoints Service? I didn't. – Jeroen Dec 18 '13 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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