mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
When print Pie graph and not containt data, add image with text is 'no data to show'. Tiquet: #3010
(cherry picked from commit 0d7359577688a7b799744c567ab0e612010ee815)
This commit is contained in:
parent
bad24f658a
commit
4ec33a4c9a
BIN
pandora_console/images/no_data_toshow.png
Normal file
BIN
pandora_console/images/no_data_toshow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
@ -133,6 +133,7 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
|
|||||||
var labels = labels.split(separator);
|
var labels = labels.split(separator);
|
||||||
var legend = legend.split(separator);
|
var legend = legend.split(separator);
|
||||||
var data = values.split(separator);
|
var data = values.split(separator);
|
||||||
|
var no_data = 0;
|
||||||
if (colors != '') {
|
if (colors != '') {
|
||||||
colors = colors.split(separator);
|
colors = colors.split(separator);
|
||||||
}
|
}
|
||||||
@ -142,8 +143,11 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
|
|||||||
if (colors != '') {
|
if (colors != '') {
|
||||||
color = colors_data[i];
|
color = colors_data[i];
|
||||||
}
|
}
|
||||||
|
var datos = data[i];
|
||||||
|
data[i] = { label: labels[i], data: parseFloat(data[i]), color: color };
|
||||||
|
if (!datos)
|
||||||
|
no_data++;
|
||||||
|
|
||||||
data[i] = { label: labels[i], data: parseFloat(data[i]), color: color}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var label_conf;
|
var label_conf;
|
||||||
@ -184,7 +188,12 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
|
|||||||
};
|
};
|
||||||
|
|
||||||
var plot = $.plot($('#'+graph_id), data, conf_pie);
|
var plot = $.plot($('#'+graph_id), data, conf_pie);
|
||||||
|
if (no_data == data.length) {
|
||||||
|
$('#'+graph_id+' .overlay').remove();
|
||||||
|
$('#'+graph_id+' .base').remove();
|
||||||
|
$('#'+graph_id).prepend("<img style='width:50%;' src='images/no_data_toshow.png' />");
|
||||||
|
|
||||||
|
}
|
||||||
var legends = $('#'+graph_id+' .legendLabel');
|
var legends = $('#'+graph_id+' .legendLabel');
|
||||||
var j = 0;
|
var j = 0;
|
||||||
legends.each(function () {
|
legends.each(function () {
|
||||||
|
@ -505,12 +505,16 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
|
|||||||
unset($graph_values['total_modules']);
|
unset($graph_values['total_modules']);
|
||||||
|
|
||||||
foreach ($graph_values as $label => $value) {
|
foreach ($graph_values as $label => $value) {
|
||||||
if ($value['value'] > 1000000)
|
if ($value['value']) {
|
||||||
$legendvalue = sprintf("%sM", number_format($value['value'] / 1000000, 2));
|
if ($value['value'] > 1000000)
|
||||||
else if ($value['value'] > 1000)
|
$legendvalue = sprintf("%sM", number_format($value['value'] / 1000000, 2));
|
||||||
$legendvalue = sprintf("%sK", number_format($value['value'] / 1000, 2));
|
else if ($value['value'] > 1000)
|
||||||
|
$legendvalue = sprintf("%sK", number_format($value['value'] / 1000, 2));
|
||||||
|
else
|
||||||
|
$legendvalue = $value['value'];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$legendvalue = $value['value'];
|
$legendvalue = __('No data');
|
||||||
$values[] = $value['value'];
|
$values[] = $value['value'];
|
||||||
$legend[] = $label .": " . $legendvalue . " " .$value['unit'];
|
$legend[] = $label .": " . $legendvalue . " " .$value['unit'];
|
||||||
$labels[] = $label;
|
$labels[] = $label;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user