HC decimal value not works without prfix or suffix or when set to no decimals

Created on 6 March 2016, about 9 years ago
Updated 11 March 2025, about 1 month ago

Hi, I try to set decimal_value property for a serie to 0 because I want no decimals but nothings happens. I check the code and I note that the conditions that define de number format not allow me to set what I want. I fix the problem doing the following changes:
@@ -233,17 +233,18 @@ function _charts_highcharts_populate_chart_data(&$chart, $chart_definition) {
$series['tooltip']['valueDecimals'] = $chart[$key]['#decimal_count'];
$series['tooltip']['xDateFormat'] = $chart[$key]['#date_format'];
$series['tooltip']['valuePrefix'] = $chart[$key]['#prefix'];
$series['tooltip']['valueSuffix'] = $chart[$key]['#suffix'];

- if ($chart[$key]['#prefix'] || $chart[$key]['#suffix']) {
+ if ($chart[$key]['#prefix'] || $chart[$key]['#suffix'] || isset($chart[$key]['#decimal_count'])) {
$yaxis_index = isset($series['yAxis']) ? $series['yAxis'] : 0;
// For axis formatting, we need to use a format string.
// See http://docs.highcharts.com/#formatting.
- $decimal_formatting = $chart[$key]['#decimal_count'] ? (':.' . $chart[$key]['#decimal_count'] . 'f') : '';
+ $decimal_formatting = isset($chart[$key]['#decimal_count']) ? (':.' . $chart[$key]['#decimal_count'] . 'f') : '';
$chart_definition['yAxis'][$yaxis_index]['labels']['format'] = $chart[$key]['#prefix'] . "{value$decimal_formatting}" . $chart[$key]['#suffix'];
}

// Remove unnecessary keys to trim down the resulting JS settings.
charts_trim_array($series);

Please review this changes and consider integrating.

Regards

πŸ› Bug report
Status

Closed: outdated

Component

Highcharts integration

Created by

πŸ‡¨πŸ‡±Chile cgv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.

Production build 0.71.5 2024