You are here

public function Google::chartsGoogleEscapeIcuCharacters in Charts 8.4

Same name and namespace in other branches
  1. 5.0.x modules/charts_google/src/Plugin/chart/Library/Google.php \Drupal\charts_google\Plugin\chart\Library\Google::chartsGoogleEscapeIcuCharacters()

Utility to escape special characters in ICU number formats.

Google will use the ICU format to auto-adjust numbers based on special characters that are used in the format. This function escapes these special characters so they just show up as the character specified.

The format string is a subset of the ICU pattern set. For instance, {pattern:'#,###%'} will result in output values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.

1 call to Google::chartsGoogleEscapeIcuCharacters()
Google::chartsGooglePopulateChartData in modules/charts_google/src/Plugin/chart/Library/Google.php
Utility to populate chart data.

File

modules/charts_google/src/Plugin/chart/Library/Google.php, line 398

Class

Google
Define a concrete class for a Chart.

Namespace

Drupal\charts_google\Plugin\chart\Library

Code

public function chartsGoogleEscapeIcuCharacters($string) {
  return preg_replace('/([0-9@#\\.\\-,E\\+;%\'\\*])/', "'\$1'", $string);
}