mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch '99-problemas-visualizacion-graficas-combinadas-tipo-gauge-bullet-chart-y-pie-chart-en-consolas-visuales' into 'develop'
Filter custom graph size in visual console editor, autoset size - #99 See merge request !287
This commit is contained in:
commit
553e58deba
7
pandora_console/general/cg_items.php
Normal file
7
pandora_console/general/cg_items.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
$stacked = db_get_sql('select stacked from tgraph where id_graph = '.$_GET['data']);
|
||||||
|
$num_items = db_get_sql('select count(*) from tgraph_source where id_graph = '.$_GET['data']);
|
||||||
|
echo "$stacked,$num_items";
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@ -298,6 +298,26 @@ function update_button_palette_callback() {
|
|||||||
break;
|
break;
|
||||||
case 'module_graph':
|
case 'module_graph':
|
||||||
|
|
||||||
|
|
||||||
|
if($('#dir_items').html() == 'horizontal'){
|
||||||
|
if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))
|
||||||
|
|| parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){
|
||||||
|
|
||||||
|
alert($('#count_items').html()+' joined graph items are wider than background');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($('#dir_items').html() == 'vertical'){
|
||||||
|
if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){
|
||||||
|
alert($('#count_items').html()+' joined graph items are higher than background');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if($('input[name=width_module_graph]').val() == ''){
|
if($('input[name=width_module_graph]').val() == ''){
|
||||||
alert('Undefined width');
|
alert('Undefined width');
|
||||||
return false;
|
return false;
|
||||||
@ -1151,6 +1171,8 @@ function loadFieldsFromDB(item) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#count_items').html(1);
|
||||||
|
|
||||||
if (data.type == 6 || data.type == 7 || data.type == 8 || data.type == 1) {
|
if (data.type == 6 || data.type == 7 || data.type == 8 || data.type == 1) {
|
||||||
|
|
||||||
$("#period_row." + item).css('display', '');
|
$("#period_row." + item).css('display', '');
|
||||||
@ -1170,6 +1192,20 @@ function loadFieldsFromDB(item) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
jQuery.get ("ajax.php",
|
||||||
|
{"page": "general/cg_items","data": data.id_custom_graph},
|
||||||
|
function (data, status) {
|
||||||
|
if(data.split(",")[0] == 4){
|
||||||
|
$('#count_items').html(data.split(",")[1]);
|
||||||
|
$('#dir_items').html('vertical');
|
||||||
|
}
|
||||||
|
else if (data.split(",")[0] == 5) {
|
||||||
|
$('#count_items').html(data.split(",")[1]);
|
||||||
|
$('#dir_items').html('horizontal');
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("input[name='radio_choice'][value='custom_graph']")
|
$("input[name='radio_choice'][value='custom_graph']")
|
||||||
.prop('checked', true);
|
.prop('checked', true);
|
||||||
$("input[name='radio_choice']").trigger('change');
|
$("input[name='radio_choice']").trigger('change');
|
||||||
|
@ -446,7 +446,10 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
html_print_input_text('width_module_graph', 300, '', 3, 5, true) .
|
html_print_input_text('width_module_graph', 300, '', 3, 5, true) .
|
||||||
' X ' .
|
' X ' .
|
||||||
html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
|
html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
|
||||||
'</td>';
|
' X ' .
|
||||||
|
'<span id="count_items">1</span> '.
|
||||||
|
'<span id="dir_items"></span> item/s
|
||||||
|
</td>';
|
||||||
|
|
||||||
|
|
||||||
//Insert and modify before the buttons to create or update.
|
//Insert and modify before the buttons to create or update.
|
||||||
@ -587,6 +590,49 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$(".border_color").attachColorPicker();
|
$(".border_color").attachColorPicker();
|
||||||
$(".fill_color").attachColorPicker();
|
$(".fill_color").attachColorPicker();
|
||||||
$(".line_color").attachColorPicker();
|
$(".line_color").attachColorPicker();
|
||||||
|
|
||||||
|
$("input[name=radio_choice]").change(function(){
|
||||||
|
$('#count_items').html(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#custom_graph").click(function(){
|
||||||
|
$('#count_items').html(1);
|
||||||
|
jQuery.get ("ajax.php",
|
||||||
|
{"page": "general/cg_items","data": $(this).val()},
|
||||||
|
function (data, status) {
|
||||||
|
if(data.split(",")[0] == 8){
|
||||||
|
size = 400+(data.split(",")[1] * 50);
|
||||||
|
if(data.split(",")[1]>3){
|
||||||
|
size = 400+(3 * 50);
|
||||||
|
}
|
||||||
|
$('#text-width_module_graph').val(size);
|
||||||
|
$('#text-height_module_graph').val(180);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (data.split(",")[0] == 4) {
|
||||||
|
size = data.split(",")[1];
|
||||||
|
if(data.split(",")[1] > 1){
|
||||||
|
$('#count_items').html(data.split(",")[1]);
|
||||||
|
$('#dir_items').html('vertical');
|
||||||
|
}
|
||||||
|
$('#text-width_module_graph').val(300);
|
||||||
|
$('#text-height_module_graph').val(50);
|
||||||
|
}
|
||||||
|
else if (data.split(",")[0] == 5) {
|
||||||
|
size = data.split(",")[1];
|
||||||
|
if(data.split(",")[1] > 1){
|
||||||
|
$('#count_items').html(data.split(",")[1]);
|
||||||
|
$('#dir_items').html('horizontal');
|
||||||
|
}
|
||||||
|
$('#text-width_module_graph').val(100);
|
||||||
|
$('#text-height_module_graph').val(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -600,7 +600,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
|
|||||||
|
|
||||||
$graph_id = uniqid('graph_');
|
$graph_id = uniqid('graph_');
|
||||||
|
|
||||||
$return = "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
$return = "<div id='$graph_id' class='graph noresizevc' style='width: ".$width."px; height: ".$height."px;'></div>";
|
||||||
|
|
||||||
if ($water_mark != '') {
|
if ($water_mark != '') {
|
||||||
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='".$water_mark["url"]."'></div>";
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='".$water_mark["url"]."'></div>";
|
||||||
|
@ -302,9 +302,8 @@ $ignored_params['refr'] = '';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".graph").each(function(){
|
$(".graph:not([class~='noresizevc'])").each(function(){
|
||||||
height = parseInt($(this).css("height")) - 30;
|
height = parseInt($(this).css("height")) - 30;
|
||||||
|
|
||||||
$(this).css('height', height);
|
$(this).css('height', height);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user