Fixed problems with unit

This commit is contained in:
Arturo Gonzalez 2017-11-07 10:57:30 +01:00
parent 3763a1a93c
commit 31577a823c
3 changed files with 8 additions and 21 deletions

View File

@ -1515,14 +1515,7 @@ function loadFieldsFromDB(item) {
}
if (key == 'value_show') {
if (val == 'percent') {
$("input[name=value_show][value=percent]")
.attr("checked", "checked");
}
else {
$("input[name=value_show][value=value]")
.attr("checked", "checked");
}
$("select[name=value_show]").val(val);
}
if (key == 'id_group') {

View File

@ -670,11 +670,7 @@ switch ($action) {
$values['type'] = PERCENTILE_BUBBLE;
}
//Check the field's value for back compatibility
$values['image'] = 'percent';
if (($value_show == 'percent') ||
($value_show == 'value'))
$values['image'] = $value_show;
$values['image'] = $value_show;
$values['border_color'] = $percentile_color;
$values['fill_color'] = $percentile_label_color;
@ -842,11 +838,8 @@ switch ($action) {
case 'percentile_bar':
$elementFields['width_percentile'] = $elementFields['width'];
$elementFields['max_percentile'] = $elementFields['height'];
//Check the field's value for back compatibility
$elementFields['value_show'] = 'percent';
if (($elementFields['image'] == 'percent') ||
($elementFields['image'] == 'value'))
$elementFields['value_show'] = $elementFields['image'];
$elementFields['value_show'] = $elementFields['image'];
$elementFields['type_percentile'] = 'percentile';
if ($elementFields['type'] == PERCENTILE_BAR) {
@ -864,6 +857,7 @@ switch ($action) {
$elementFields['percentile_color'] = $elementFields['border_color'];
$elementFields['percentile_label_color'] = $elementFields['fill_color'];
$elementFields['percentile_label'] = $elementFields['label'];
html_debug($elementFields, true);
break;
case 'donut_graph':
$elementFields['width_percentile'] = $elementFields['width'];

View File

@ -1552,7 +1552,7 @@ function progress_bar_d3 (recipient, percentile, width, height, color, unit, lab
function updateProgress(bar_progress) {
var percent_value = Number(bar_progress * 100);
numberText.text(percent_value.toFixed());
numberText.text(percent_value.toFixed() + " " + unit);
progress_front.attr('width', (width * bar_progress));
}
@ -1657,11 +1657,11 @@ function progress_bubble_d3 (recipient, percentile, width, height, color, unit,
.style("font-weight", "bold")
.style("font-size", numberSize)
.attr('text-anchor', 'middle')
.attr('dy', width/2);
.attr('dy', width/3);
function updateProgress(bar_progress) {
var percent_value = Number(bar_progress * 100);
numberText.text(percent_value.toFixed() + " %");
numberText.text(percent_value.toFixed() + " " + unit);
progress_front.attr('r', ((width/2) * bar_progress));
}