Fixed there are many bullet charts in one page (such as dashboard). TICKET: #3187

(cherry picked from commit 11f9f2ec32)
This commit is contained in:
mdtrooper 2016-01-11 15:18:13 +01:00
parent a5f8a9ca24
commit ed78a4e44f
1 changed files with 47 additions and 45 deletions

View File

@ -144,16 +144,18 @@ function d3_sunburst_graph ($data, $width = 700, $height = 700, $return = false)
function d3_bullet_chart($chart_data, $width, $height, $color, $legend,
$homeurl, $unit, $font, $font_size) {
global $config;
$output = '';
$output .= include_javascript_d3(true);
$id_bullet = uniqid();
$output .=
'<div id="bullet_graph" style="overflow: hidden;"></div>
'<div id="bullet_graph_' . $id_bullet . '" class="bulle" style="overflow: hidden;"></div>
<style>
#bullet_graph {
.bullet_graph {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
padding-top: 40px;
@ -211,7 +213,7 @@ function d3_bullet_chart($chart_data, $width, $height, $color, $legend,
';
$output .= '
var svg = d3.select("#bullet_graph").selectAll("svg")
var svg = d3.select("#bullet_graph_' . $id_bullet . '").selectAll("svg")
.data(data)
.enter().append("svg")
.attr("class", "bullet")