Chart\InlinePie: locale-ignorant casts for floats

PHP respects locales (LC_NUMERIC) when casting floats to string. That
affected the generated HTML for our inline pie charts. This patch is
not that beautiful - but fixes this.

fixes #6348
This commit is contained in:
Thomas Gelf 2014-05-28 10:20:34 +00:00
parent 7a0173e2fb
commit 92f454c36d
1 changed files with 6 additions and 1 deletions

View File

@ -220,12 +220,17 @@ EOD;
public function render()
{
$template = $this->template;
// Locale-ignorant string cast:
$data = array();
foreach ($this->data as $dat) {
$data[] = sprintf('%F', $dat);
}
$template = preg_replace('{{url}}', $this->url, $template);
$template = preg_replace('{{width}}', $this->width, $template);
$template = preg_replace('{{height}}', $this->height, $template);
$template = preg_replace('{{title}}', $this->title, $template);
$template = preg_replace('{{style}}', $this->style, $template);
$template = preg_replace('{{data}}', implode(',', $this->data), $template);
$template = preg_replace('{{data}}', implode(',', $data), $template);
$template = preg_replace('{{colors}}', implode(',', $this->colors), $template);
return $template;
}