Postponed (maintainer needs more info)
Project:
Views Group By
Version:
6.x-1.0-rc2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
14 May 2010 at 15:29 UTC
Updated:
10 Jun 2011 at 07:51 UTC
I have a content type with a variety of vocabularies assigned to it, so that nodes will have terms from multiple vocabularies at once. I need a way to show a pie chart group the nodes by the terms in only one of the vocabularies at a time. Unfortunately, I can't seem to find a way to do that. Instead, it shows the terms from all vocabularies, sorted by vocab. Here's my views code:
$view = new view;
$view->name = 'dped_browser_charts';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'nid' => array(
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
),
'tid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'separator',
'separator' => ', ',
'link_to_taxonomy' => 1,
'limit' => 1,
'vids' => array(
'1' => 1,
'2' => 0,
'3' => 0,
'4' => 0,
'5' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'relationship' => 'none',
),
'name' => array(
'label' => 'Term',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_taxonomy' => 0,
'exclude' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'relationship' => 'none',
),
'name_1' => array(
'id' => 'name_1',
'table' => 'vocabulary',
'field' => 'name',
),
'views_sql_groupedfields' => array(
'label' => 'Group By Fields',
'alter' => array(
'alter_text' => FALSE,
'text' => '',
'make_link' => FALSE,
'path' => '',
'alt' => '',
'link_class' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'trim' => FALSE,
'max_length' => '',
'word_boundary' => TRUE,
'ellipsis' => TRUE,
'strip_tags' => FALSE,
'html' => FALSE,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => '1',
'id' => 'views_sql_groupedfields',
'table' => 'views_groupby',
'field' => 'views_sql_groupedfields',
'relationship' => 'none',
'views_groupby_fields_to_group' => array(
'name' => 'name',
'name_1' => 'name_1',
),
'views_groupby_sql_function' => 'count',
'views_groupby_fields_to_aggregate' => array(
'nid' => 'nid',
),
'views_groupby_field_sortby' => 'nid',
'views_groupby_sortby_direction' => 'desc',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'application' => 'application',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('style_plugin', 'charts');
$handler->override_option('style_options', array(
'views_charts_series_fields' => array(
'tid' => 'tid',
),
'views_charts_x_labels' => 'tid',
'width' => '500',
'height' => '700',
'engine' => 'bluff',
'type' => array(
'bluff' => 'pie',
),
'wmode' => 'window',
'y_min' => '0',
'y_legend' => '',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'chart');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
Comments
Comment #1
rsevero commentedWouldn't adding an extra filter on the desired vocabulary fix your problem?
Comment #2
jdvc commentedYes this works. All you need to do is add a filter for the specific taxonomy vocabulary you want to group by.