web-dev-qa-db-ja.com

グラフにフィールドコレクションアイテムを表示する方法

私のユーザーには、「ポイント」(整数)と「日付」の2つのフィールドを持つフィールドコレクションがあります( date )。 Charts モジュールを使用して「ポイント」の折れ線グラフを作成し、ラベルとして「日付」を使用します。これはビューで簡単に達成できると思いましたが、何らかの理由で、チャートがビューに表示されません。これはエクスポートです:

$view = new view();
$view->name = 'linegraph';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'linegraph';
$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['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'access user profiles';
$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'] = 'full';
$handler->display->display_options['style_plugin'] = 'chart';
$handler->display->display_options['style_options']['type'] = 'line';
$handler->display->display_options['style_options']['library'] = '';
$handler->display->display_options['style_options']['label_field'] = 'field_date';
$handler->display->display_options['style_options']['data_fields'] = array(
  'field_points' => 'field_points',
  'field_date' => 0,
);
$handler->display->display_options['style_options']['field_colors'] = array(
  'field_date' => '#2f7ed8',
  'field_points' => '#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';
/* Relationship: User: Points (field_points) */
$handler->display->display_options['relationships']['field_points_value']['id'] = 'field_points_value';
$handler->display->display_options['relationships']['field_points_value']['table'] = 'field_data_field_points';
$handler->display->display_options['relationships']['field_points_value']['field'] = 'field_points_value';
$handler->display->display_options['relationships']['field_points_value']['required'] = TRUE;
$handler->display->display_options['relationships']['field_points_value']['delta'] = '-1';
/* Field: Field collection item: Date */
$handler->display->display_options['fields']['field_date']['id'] = 'field_date';
$handler->display->display_options['fields']['field_date']['table'] = 'field_data_field_date';
$handler->display->display_options['fields']['field_date']['field'] = 'field_date';
$handler->display->display_options['fields']['field_date']['relationship'] = 'field_poins_value';
$handler->display->display_options['fields']['field_date']['label'] = '';
$handler->display->display_options['fields']['field_date']['element_label_colon'] = FALSE;
/* Field: Field collection item: Points */
$handler->display->display_options['fields']['field_points']['id'] = 'field_points';
$handler->display->display_options['fields']['field_points']['table'] = 'field_data_field_points';
$handler->display->display_options['fields']['field_points']['field'] = 'field_points';
$handler->display->display_options['fields']['field_points']['relationship'] = 'field_points_value';
$handler->display->display_options['fields']['field_points']['label'] = '';
$handler->display->display_options['fields']['field_points']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_points']['settings'] = array(
  'thousand_separator' => ' ',
  'prefix_suffix' => 1,
);
/* 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']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$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';
/* Filter criterion: User: Active */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'users';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

何が問題になっていて、どうすれば解決できますか?


この質問は、 プロファイルページの合計ユーザーポイントの折れ線グラフを作成する方法の一部です

1
Jeroen

これが私のエクスポートしたビューです。正常に動作しています。お役に立てれば幸いです。

$view = new view();
$view->name = 'test_view';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test view';
$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'] = 'test view';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$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'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '3';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'chart';
$handler->display->display_options['style_options']['yaxis_title'] = 'Weight';
$handler->display->display_options['style_options']['yaxis_min'] = '0';
$handler->display->display_options['style_options']['label_field'] = 'field_collection_date';
$handler->display->display_options['style_options']['data_fields'] = array(
  'field_collection_weight' => 'field_collection_weight',
  'field_collection_date' => 0,
);
$handler->display->display_options['style_options']['field_colors'] = array(
  'field_collection_date' => '#2f7ed8',
  'field_collection_weight' => '#0d233a',
);
/* Relationship: Content: Actual mesaurment (field_actual_mesaurment) */
$handler->display->display_options['relationships']['field_actual_mesaurment_value']['id'] = 'field_actual_mesaurment_value';
$handler->display->display_options['relationships']['field_actual_mesaurment_value']['table'] = 'field_data_field_actual_mesaurment';
$handler->display->display_options['relationships']['field_actual_mesaurment_value']['field'] = 'field_actual_mesaurment_value';
$handler->display->display_options['relationships']['field_actual_mesaurment_value']['delta'] = '-1';
/* Field: Field collection item: Date */
$handler->display->display_options['fields']['field_collection_date']['id'] = 'field_collection_date';
$handler->display->display_options['fields']['field_collection_date']['table'] = 'field_data_field_collection_date';
$handler->display->display_options['fields']['field_collection_date']['field'] = 'field_collection_date';
$handler->display->display_options['fields']['field_collection_date']['relationship'] = 'field_actual_mesaurment_value';
$handler->display->display_options['fields']['field_collection_date']['alter']['strip_tags'] = TRUE;
$handler->display->display_options['fields']['field_collection_date']['settings'] = array(
  'format_type' => 'day_month_year',
  'fromto' => 'both',
  'multiple_number' => '',
  'multiple_from' => '',
  'multiple_to' => '',
);
/* Field: Field collection item: Your weight */
$handler->display->display_options['fields']['field_collection_weight']['id'] = 'field_collection_weight';
$handler->display->display_options['fields']['field_collection_weight']['table'] = 'field_data_field_collection_weight';
$handler->display->display_options['fields']['field_collection_weight']['field'] = 'field_collection_weight';
$handler->display->display_options['fields']['field_collection_weight']['relationship'] = 'field_actual_mesaurment_value';
$handler->display->display_options['fields']['field_collection_weight']['settings'] = array(
  'thousand_separator' => ' ',
  'decimal_separator' => '.',
  'scale' => '2',
  'prefix_suffix' => 1,
);
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Content: Author uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'node';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$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';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'goal' => 'goal',
);
/* Filter criterion: Date: Date (field_collection_item) */
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['table'] = 'field_collection_item';
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['relationship'] = 'field_actual_mesaurment_value';
$handler->display->display_options['filters']['date_filter']['operator'] = 'between';
$handler->display->display_options['filters']['date_filter']['exposed'] = TRUE;
$handler->display->display_options['filters']['date_filter']['expose']['operator_id'] = 'date_filter_op';
$handler->display->display_options['filters']['date_filter']['expose']['label'] = 'Period';
$handler->display->display_options['filters']['date_filter']['expose']['operator'] = 'date_filter_op';
$handler->display->display_options['filters']['date_filter']['expose']['identifier'] = 'date_filter';
$handler->display->display_options['filters']['date_filter']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
  3 => 0,
  4 => 0,
);
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_popup';
$handler->display->display_options['filters']['date_filter']['date_fields'] = array(
  'field_data_field_collection_date.field_collection_date_value' => 'field_data_field_collection_date.field_collection_date_value',
);
$handler->display->display_options['filters']['date_filter']['date_method'] = 'AND';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test-view';
1
Ahmad