Commit a7167ed3 authored by murtech's avatar murtech

adding updated files

parent 5bc6c20d
This diff is collapsed.
......@@ -6,3 +6,10 @@ package = Visualization
dependencies[] = libraries (>=2.0)
dependencies[] = d3
dependencies[] = xautoload (>= 7.x-5.0)
; Information added by Drupal.org packaging script on 2016-10-27
version = "7.x-1.x-dev"
core = "7.x"
project = "d3_sankey"
datestamp = "1477583498"
......@@ -18,3 +18,10 @@ dependencies[] = d3.chart.sankey
; chart; and;
; - if we override the original d3_views plugins, we will conflict with other
; modules that need to do the same thing.
; Information added by Drupal.org packaging script on 2016-10-27
version = "7.x-1.x-dev"
core = "7.x"
project = "d3_sankey"
datestamp = "1477583498"
......@@ -4,3 +4,10 @@ core = 7.x
package = Visualization
dependencies[] = d3_sankey
; Information added by Drupal.org packaging script on 2016-10-27
version = "7.x-1.x-dev"
core = "7.x"
project = "d3_sankey"
datestamp = "1477583498"
......@@ -6,3 +6,10 @@ package = Visualization
dependencies[] = d3_sankey
dependencies[] = composer_manager
dependencies[] = xautoload (>= 7.x-5.0)
; Information added by Drupal.org packaging script on 2016-10-27
version = "7.x-1.x-dev"
core = "7.x"
project = "d3_sankey"
datestamp = "1477583498"
......@@ -38,6 +38,7 @@ function d3_sankey_table_group_pp_field_formatter_info() {
'alignLabel' => D3_SANKEY_ALIGNLABEL_AUTO,
'node_colors' => '',
'link_colors' => '',
'skip_rows_with_empty_data' => FALSE,
),
);
......@@ -137,6 +138,14 @@ function d3_sankey_table_group_pp_field_formatter_settings_form($field, $instanc
'#default_value' => $settings['link_colors'],
'#element_validate' => array('d3_sankey_element_validate_optional_color_list'),
);
// Whether to not to skip rows with empty data.
$element['skip_rows_with_empty_data'] = array(
'#type' => 'checkbox',
'#title' => t('Skip rows with empty data'),
'#description' => t("Empty data causes infinite recursion as of d3.chart.sankey version 0.2.1. Enabling this option checks whether there is any empty data in a row, and if so, does not output it. Skipping data makes the chart less accurate, but avoids crashing the end-user's browser."),
'#default_value' => $settings['skip_rows_with_empty_data'],
);
}
return $element;
......@@ -212,6 +221,11 @@ function d3_sankey_table_group_pp_field_formatter_settings_summary($field, $inst
'%colors' => implode(', ', $link_colors),
));
}
// Display whether we're skipping rows with empty data.
if ((bool) $settings['skip_rows_with_empty_data'] === TRUE) {
$summary .= ' ' . t('Skipping rows with empty data.');
}
}
return $summary;
......@@ -276,6 +290,19 @@ function d3_sankey_table_group_pp_field_formatter_view($entity_type, $entity, $f
// raw data out of the preprocessor, and add it to the chart.
$preprocessor = new TableGroupingPreprocessor();
foreach ($rows as $row) {
// If we've been asked to skip rows with empty data, search the columns
// in the current row for empty data.
if ((bool) $settings['skip_rows_with_empty_data'] === TRUE) {
foreach ($row as $column) {
if (empty($column)) {
// We are currently in 2 foreach loops; the inner one for the
// column, and the outer one for the row. We want to skip
// processing the current row iteration.
continue 2;
}
}
}
$preprocessor->ingestRow((array) $row);
}
$raw_data = $preprocessor->getRawData();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment