mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed problems with visual maps in dashboards view. Gitlab: #374
This commit is contained in:
parent
4d89b6496f
commit
0dd770a551
@ -882,72 +882,62 @@ else{
|
|||||||
$only_image = !$graph_javascript || $isExternalLink;
|
$only_image = !$graph_javascript || $isExternalLink;
|
||||||
if ($layoutData['id_custom_graph'] != 0) {
|
if ($layoutData['id_custom_graph'] != 0) {
|
||||||
// Show only avg on the visual console
|
// Show only avg on the visual console
|
||||||
if(get_parameter('action') == 'edit'){
|
if (get_parameter('action') == 'edit') {
|
||||||
if($width == 0 || $height == 0){
|
if($width == 0 || $height == 0) {
|
||||||
$img = '<img src="images/console/signes/custom_graph.png" style="width:300px;height:180px;'.$imgpos.'">';
|
$img = '<img src="images/console/signes/custom_graph.png" style="width:300px;height:180px;'.$imgpos.'">';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$img = '<img src="images/console/signes/custom_graph.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($width == 0 || $height == 0) {
|
||||||
|
if ($layoutData['label_position']=='left') {
|
||||||
|
$img = '<div style="float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
||||||
|
$layoutData['id_custom_graph'], 180, 300,
|
||||||
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
|
array(), '', array(), array(), true,
|
||||||
|
false, false, true, 1, false, true).'</div>';
|
||||||
}
|
}
|
||||||
else{
|
elseif ($layoutData['label_position']=='right') {
|
||||||
$img = '<img src="images/console/signes/custom_graph.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
if($width == 0 || $height == 0){
|
|
||||||
|
|
||||||
if($layoutData['label_position']=='left'){
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
|
||||||
$layoutData['id_custom_graph'], 180, 300,
|
|
||||||
$period, null, true, 0, false, $layoutData['image'],
|
|
||||||
array(), '', array(), array(), true,
|
|
||||||
false, false, true, 1, false, true).'</div>';
|
|
||||||
}
|
|
||||||
else if($layoutData['label_position']=='right'){
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
|
||||||
$layoutData['id_custom_graph'], 180, 300,
|
|
||||||
$period, null, true, 0, false, $layoutData['image'],
|
|
||||||
array(), '', array(), array(), true,
|
|
||||||
false, false, true, 1, false, true).'</div>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = custom_graphs_print(
|
|
||||||
$layoutData['id_custom_graph'], 180, 300,
|
|
||||||
$period, null, true, 0, false, $layoutData['image'],
|
|
||||||
array(), '', array(), array(), true,
|
|
||||||
false, false, true, 1, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else{
|
|
||||||
|
|
||||||
if($layoutData['label_position']=='left'){
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
|
||||||
$layoutData['id_custom_graph'],$height,$width,
|
|
||||||
$period, null, true, 0, false, $layoutData['image'],
|
|
||||||
array(), '', array(), array(), true,
|
|
||||||
false, false, true, 1, false, true).'</div>';
|
|
||||||
}
|
|
||||||
else if($layoutData['label_position']=='right'){
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
$img = '<div style="float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
||||||
$layoutData['id_custom_graph'],$height,$width,
|
$layoutData['id_custom_graph'], 180, 300,
|
||||||
$period, null, true, 0, false, $layoutData['image'],
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
array(), '', array(), array(), true,
|
array(), '', array(), array(), true,
|
||||||
false, false, true, 1, false, true).'</div>';
|
false, false, true, 1, false, true).'</div>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$img = custom_graphs_print(
|
||||||
|
$layoutData['id_custom_graph'], 180, 300,
|
||||||
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
|
array(), '', array(), array(), true,
|
||||||
|
false, false, true, 1, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$img = custom_graphs_print(
|
if ($layoutData['label_position']=='left') {
|
||||||
$layoutData['id_custom_graph'],$height,$width,
|
$img = '<div style="float:right;height:'.$himg.'px;">'.custom_graphs_print(
|
||||||
$period, null, true, 0, false, $layoutData['image'],
|
$layoutData['id_custom_graph'], $height, $width,
|
||||||
array(), '', array(), array(), true,
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
false, false, true, 1, false, true);
|
array(), '', array(), array(), true,
|
||||||
|
false, false, true, 1, false, true).'</div>';
|
||||||
|
}
|
||||||
|
elseif($layoutData['label_position']=='right') {
|
||||||
|
$img = '<div style="float:left;height:'.$himg.'px;">'.custom_graphs_print(
|
||||||
|
$layoutData['id_custom_graph'], $height, $width,
|
||||||
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
|
array(), '', array(), array(), true,
|
||||||
|
false, false, true, 1, false, true).'</div>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$img = custom_graphs_print(
|
||||||
|
$layoutData['id_custom_graph'], $height, $width,
|
||||||
|
$period, null, true, 0, $only_image, $layoutData['image'],
|
||||||
|
array(), '', array(), array(), true,
|
||||||
|
false, false, true, 1, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($isExternalLink)
|
if ($isExternalLink)
|
||||||
@ -955,65 +945,71 @@ else{
|
|||||||
else
|
else
|
||||||
$homeurl = '';
|
$homeurl = '';
|
||||||
|
|
||||||
if(get_parameter('action') == 'edit'){
|
if (get_parameter('action') == 'edit') {
|
||||||
if($width == 0 || $height == 0){
|
if($width == 0 || $height == 0){
|
||||||
$img = '<img src="images/console/signes/module_graph.png" style="width:300px;height:180px;'.$imgpos.'">';
|
$img = '<img src="images/console/signes/module_graph.png" style="width:300px;height:180px;'.$imgpos.'">';
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/module_graph.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
if($width == 0 || $height == 0){
|
|
||||||
|
|
||||||
if($layoutData['label_position']=='left'){
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.grafico_modulo_sparse($id_module, $period, 0,300,180,
|
|
||||||
'',null,
|
|
||||||
false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
|
|
||||||
'', false, false, false, $layoutData['image'], null, true, false,$type_graph).'</div>';
|
|
||||||
}
|
|
||||||
else if($layoutData['label_position']=='right'){
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.grafico_modulo_sparse($id_module, $period, 0,300,180,
|
|
||||||
'',null,
|
|
||||||
false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
|
|
||||||
'', false, false, false, $layoutData['image'], null, true, false,$type_graph).'</div>';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = grafico_modulo_sparse($id_module, $period, 0,300,180,
|
|
||||||
'',null,
|
|
||||||
false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
|
|
||||||
'', false, false, false, $layoutData['image'], null, true, false,$type_graph);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
$img = '<img src="images/console/signes/module_graph.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($width == 0 || $height == 0) {
|
||||||
|
|
||||||
if($layoutData['label_position']=='left'){
|
if ($layoutData['label_position']=='left') {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.grafico_modulo_sparse($id_module, $period, 0,$width,$height,
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
'',null,
|
grafico_modulo_sparse($id_module, $period,
|
||||||
false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
|
0, 300, 180, '',null, false, 1, false, 0,
|
||||||
'', false, false, false, $layoutData['image'], null, true, false,$type_graph).'</div>';
|
'', 0, 0, true, $only_image, '', 1, false, '',
|
||||||
}
|
false, false, false, $layoutData['image'],
|
||||||
else if($layoutData['label_position']=='right'){
|
null, true, false, $type_graph) . '</div>';
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.grafico_modulo_sparse($id_module, $period, 0,$width,$height,
|
|
||||||
'',null,
|
|
||||||
false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
|
|
||||||
'', false, false, false, $layoutData['image'], null, true, false,$type_graph).'</div>';
|
|
||||||
}
|
}
|
||||||
else{
|
elseif($layoutData['label_position']=='right') {
|
||||||
$img = grafico_modulo_sparse($id_module, $period, 0,$width,$height,
|
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||||
|
grafico_modulo_sparse($id_module,
|
||||||
|
$period, 0, 300, 180, '',null, false,
|
||||||
|
1, false, 0, '', 0, 0, true, $only_image, '',
|
||||||
|
1, false, '', false, false, false,
|
||||||
|
$layoutData['image'], null, true,
|
||||||
|
false, $type_graph) . '</div>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$img = grafico_modulo_sparse($id_module, $period, 0,300,180,
|
||||||
'',null,
|
'',null,
|
||||||
false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
|
false, 1, false, 0, '', 0, 0, true, $only_image, '', 1, false,
|
||||||
'', false, false, false, $layoutData['image'], null, true, false,$type_graph);
|
'', false, false, false, $layoutData['image'], null, true, false,$type_graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if ($layoutData['label_position']=='left') {
|
||||||
|
$img = '<div style="float:right;height:'.$himg.'px;">' .
|
||||||
|
grafico_modulo_sparse($id_module, $period,
|
||||||
|
0, $width, $height, '', null, false, 1,
|
||||||
|
false, 0, '', 0, 0, true, $only_image, '',
|
||||||
|
1, false, '', false, false, false,
|
||||||
|
$layoutData['image'], null, true,
|
||||||
|
false, $type_graph) . '</div>';
|
||||||
|
}
|
||||||
|
elseif ($layoutData['label_position']=='right') {
|
||||||
|
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||||
|
grafico_modulo_sparse($id_module, $period,
|
||||||
|
0, $width, $height, '', null, false, 1,
|
||||||
|
false, 0, '', 0, 0, true, $only_image,
|
||||||
|
'', 1, false, '', false, false, false,
|
||||||
|
$layoutData['image'], null, true,
|
||||||
|
false, $type_graph) . '</div>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$img = grafico_modulo_sparse($id_module,
|
||||||
|
$period, 0, $width, $height, '', null,
|
||||||
|
false, 1, false, 0, '', 0, 0, true,
|
||||||
|
$only_image, '', 1, false, '', false,
|
||||||
|
false, false, $layoutData['image'],
|
||||||
|
null, true, false, $type_graph);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
if ($layoutData['id_metaconsole'] != 0) {
|
||||||
@ -1081,9 +1077,7 @@ else{
|
|||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case BOX_ITEM:
|
case BOX_ITEM:
|
||||||
|
if ($width == 0 || $width == 0) {
|
||||||
|
|
||||||
if($width == 0 || $width == 0){
|
|
||||||
$style = "";
|
$style = "";
|
||||||
$style .= "width: 300px; ";
|
$style .= "width: 300px; ";
|
||||||
$style .= "height: 180px; ";
|
$style .= "height: 180px; ";
|
||||||
@ -1093,29 +1087,28 @@ else{
|
|||||||
$style .= "background-color: " . $fill_color . "; ";
|
$style .= "background-color: " . $fill_color . "; ";
|
||||||
echo "<div style='" . $style . "'></div>";
|
echo "<div style='" . $style . "'></div>";
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
if (!empty($proportion)){
|
if (!empty($proportion)) {
|
||||||
$style = "";
|
$style = "";
|
||||||
$style .= "width: " . ($width * $proportion['proportion_width']) . "px; ";
|
$style .= "width: " . ($width * $proportion['proportion_width']) . "px; ";
|
||||||
$style .= "height: " . ($height * $proportion['proportion_height']) . "px; ";
|
$style .= "height: " . ($height * $proportion['proportion_height']) . "px; ";
|
||||||
$style .= "border-style: solid; ";
|
$style .= "border-style: solid; ";
|
||||||
$style .= "border-width: " . $border_width . "px; ";
|
$style .= "border-width: " . $border_width . "px; ";
|
||||||
$style .= "border-color: " . $border_color . "; ";
|
$style .= "border-color: " . $border_color . "; ";
|
||||||
$style .= "background-color: " . $fill_color . "; ";
|
$style .= "background-color: " . $fill_color . "; ";
|
||||||
echo "<div style='" . $style . "'></div>";
|
echo "<div style='" . $style . "'></div>";
|
||||||
}
|
|
||||||
else{
|
|
||||||
$style = "";
|
|
||||||
$style .= "width: " . $width . "px; ";
|
|
||||||
$style .= "height: " . $height . "px; ";
|
|
||||||
$style .= "border-style: solid; ";
|
|
||||||
$style .= "border-width: " . $border_width . "px; ";
|
|
||||||
$style .= "border-color: " . $border_color . "; ";
|
|
||||||
$style .= "background-color: " . $fill_color . "; ";
|
|
||||||
echo "<div style='" . $style . "'></div>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$style = "";
|
||||||
|
$style .= "width: " . $width . "px; ";
|
||||||
|
$style .= "height: " . $height . "px; ";
|
||||||
|
$style .= "border-style: solid; ";
|
||||||
|
$style .= "border-width: " . $border_width . "px; ";
|
||||||
|
$style .= "border-color: " . $border_color . "; ";
|
||||||
|
$style .= "background-color: " . $fill_color . "; ";
|
||||||
|
echo "<div style='" . $style . "'></div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case STATIC_GRAPH:
|
case STATIC_GRAPH:
|
||||||
case GROUP_ITEM:
|
case GROUP_ITEM:
|
||||||
@ -1351,14 +1344,16 @@ else{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MODULE_GRAPH:
|
case MODULE_GRAPH:
|
||||||
if($layoutData['label_position']=='up'){
|
if ($layoutData['label_position']=='up') {
|
||||||
echo io_safe_output($text);
|
echo io_safe_output($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $img;
|
echo $img;
|
||||||
if($layoutData['label_position']=='down'){
|
|
||||||
echo io_safe_output($text);
|
if ($layoutData['label_position']=='down') {
|
||||||
}
|
echo io_safe_output($text);
|
||||||
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
|
}
|
||||||
|
elseif($layoutData['label_position']=='left' || $layoutData['label_position']=='right') {
|
||||||
echo io_safe_output($text);
|
echo io_safe_output($text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2390,8 +2385,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
|
|
||||||
//Fixed to wait the load of images.
|
//Fixed to wait the load of images.
|
||||||
$(window).load(function () {
|
$(window).load(function () {
|
||||||
draw_lines(lines, 'background_'+id_layout);
|
draw_lines(lines, 'background_' + id_layout);
|
||||||
draw_user_lines_read('background_'+id_layout);
|
draw_user_lines_read('background_' + id_layout);
|
||||||
//center_labels();
|
//center_labels();
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
@ -2433,20 +2428,20 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
$backgroundImage =
|
$backgroundImage =
|
||||||
'/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' .
|
'/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' .
|
||||||
$config['homeurl'] . 'images/console/background/' .
|
$config['homeurl'] . 'images/console/background/' .
|
||||||
io_safe_input ($layout["background"]);
|
$layout["background"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$backgroundImage =
|
$backgroundImage =
|
||||||
'/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' .
|
'/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' .
|
||||||
$config['homedir'] . '/images/console/background/' .
|
$config['homedir'] . '/images/console/background/' .
|
||||||
io_safe_input ($layout["background"]);
|
($layout["background"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$mapWidth = $layout["width"];
|
$mapWidth = $layout["width"];
|
||||||
$mapHeight = $layout["height"];
|
$mapHeight = $layout["height"];
|
||||||
$backgroundImage = $metaconsole_hack . 'images/console/background/' .
|
$backgroundImage = $metaconsole_hack . 'images/console/background/' .
|
||||||
io_safe_input ($layout["background"]);
|
$layout["background"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
|
@ -1519,7 +1519,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
// minTickSize
|
// minTickSize
|
||||||
var count_data = datas[0].data.length;
|
var count_data = datas[0].data.length;
|
||||||
var min_tick_pixels = 80;
|
var min_tick_pixels = 80;
|
||||||
var steps = parseInt( count_data / (width/min_tick_pixels));
|
//~ var steps = parseInt( count_data / (width/min_tick_pixels));
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
series: {
|
series: {
|
||||||
@ -1547,7 +1547,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
axisLabelUseCanvas: false,
|
axisLabelUseCanvas: false,
|
||||||
axisLabel: xaxisname,
|
axisLabel: xaxisname,
|
||||||
tickFormatter: xFormatter,
|
tickFormatter: xFormatter,
|
||||||
minTickSize: steps,
|
//~ minTickSize: steps,
|
||||||
color: '',
|
color: '',
|
||||||
font: font
|
font: font
|
||||||
} ],
|
} ],
|
||||||
@ -1603,25 +1603,26 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
// Adjust linked graph to the width and position of the main plot
|
// Adjust linked graph to the width and position of the main plot
|
||||||
|
|
||||||
// Miniplot
|
// Miniplot
|
||||||
var overview = $.plot($('#overview_'+graph_id),datas, {
|
if ( !dashboard ) {
|
||||||
series: {
|
var overview = $.plot($('#overview_'+graph_id),datas, {
|
||||||
stack: stacked,
|
series: {
|
||||||
lines: { show: true, lineWidth: 1 },
|
stack: stacked,
|
||||||
shadowSize: 0
|
lines: { show: true, lineWidth: 1 },
|
||||||
},
|
shadowSize: 0
|
||||||
grid: { borderWidth: 1, hoverable: true, autoHighlight: false},
|
},
|
||||||
xaxis: { },
|
grid: { borderWidth: 1, hoverable: true, autoHighlight: false},
|
||||||
xaxes: [ {
|
xaxis: { },
|
||||||
tickFormatter: xFormatter,
|
xaxes: [ {
|
||||||
minTickSize: steps,
|
tickFormatter: xFormatter,
|
||||||
color: ''
|
minTickSize: steps,
|
||||||
} ],
|
color: ''
|
||||||
yaxis: {ticks: [], autoscaleMargin: 0.1 },
|
} ],
|
||||||
selection: {mode: 'x', color: '#777' },
|
yaxis: {ticks: [], autoscaleMargin: 0.1 },
|
||||||
legend: {show: false},
|
selection: {mode: 'x', color: '#777' },
|
||||||
crosshair: {mode: 'x'}
|
legend: {show: false},
|
||||||
});
|
crosshair: {mode: 'x'}
|
||||||
|
});
|
||||||
|
}
|
||||||
// Connection between plot and miniplot
|
// Connection between plot and miniplot
|
||||||
|
|
||||||
$('#' + graph_id).bind('plotselected', function (event, ranges) {
|
$('#' + graph_id).bind('plotselected', function (event, ranges) {
|
||||||
@ -1669,7 +1670,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
plot.setSelection(ranges);
|
plot.setSelection(ranges);
|
||||||
});
|
});
|
||||||
|
|
||||||
var legends = $('#legend_' + graph_id + ' .legendLabel');
|
//~ var legends = $('#legend_' + graph_id + ' .legendLabel');
|
||||||
|
|
||||||
|
|
||||||
var updateLegendTimeout = null;
|
var updateLegendTimeout = null;
|
||||||
@ -1768,8 +1769,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
$('#legend_' + graph_id + ' .legendLabel')
|
$('#legend_' + graph_id + ' .legendLabel')
|
||||||
.eq(i).css('color','');
|
.eq(i).css('color','');
|
||||||
|
|
||||||
//~ $('#legend_' + graph_id + ' .legendLabel')
|
$('#legend_' + graph_id + ' .legendLabel')
|
||||||
//~ .eq(i).css('font-family',font+'Font');
|
.eq(i).css('font-family',font+'Font');
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -1857,7 +1858,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
$('#'+graph_id).bind('mouseout',resetInteractivity);
|
$('#'+graph_id).bind('mouseout',resetInteractivity);
|
||||||
$('#overview_'+graph_id).bind('mouseout',resetInteractivity);
|
$('#overview_'+graph_id).bind('mouseout',resetInteractivity);
|
||||||
|
|
||||||
// Reset interactivity styles
|
//~ // Reset interactivity styles
|
||||||
function resetInteractivity() {
|
function resetInteractivity() {
|
||||||
$('#timestamp_'+graph_id).hide();
|
$('#timestamp_'+graph_id).hide();
|
||||||
dataset = plot.getData();
|
dataset = plot.getData();
|
||||||
@ -1891,207 +1892,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
// Prepared to turn series with a checkbox
|
// Prepared to turn series with a checkbox
|
||||||
//return '<div style=color:;font-size:'+font_size+'pt><input type="checkbox" id="' + graph_id + '_' + item.id +'" checked="checked" class="check_serie_'+graph_id+'">'+v+'</div>';
|
//return '<div style=color:;font-size:'+font_size+'pt><input type="checkbox" id="' + graph_id + '_' + item.id +'" checked="checked" class="check_serie_'+graph_id+'">'+v+'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to export the graph data to a file.
|
|
||||||
// Uses plot, labels and labels_long as scope variables.
|
|
||||||
//~ function exportData (options) {
|
|
||||||
//~ options = options || {};
|
|
||||||
|
|
||||||
//~ // Options
|
|
||||||
//~ var type = options.type || 'csv';
|
|
||||||
//~ type = type.toLowerCase().trim();
|
|
||||||
|
|
||||||
//~ var graphData,
|
|
||||||
//~ dataObject,
|
|
||||||
//~ dataObjects = plot.getData(),
|
|
||||||
//~ result = [];
|
|
||||||
|
|
||||||
//~ // Throw errors
|
|
||||||
//~ var retrieveDataOject = function (dataObjects) {
|
|
||||||
//~ var result;
|
|
||||||
|
|
||||||
//~ if (typeof dataObjects === 'undefined')
|
|
||||||
//~ throw new Error('Empty parameter');
|
|
||||||
|
|
||||||
//~ // Try to retrieve the avg set (not 100% reliable, I know)
|
|
||||||
//~ if (dataObjects.length == 1) {
|
|
||||||
//~ result = dataObjects.shift();
|
|
||||||
//~ }
|
|
||||||
//~ if (dataObjects.length > 1) {
|
|
||||||
//~ dataObjects.forEach(function (element) {
|
|
||||||
//~ if (/^Avg.:/i.test(element.label))
|
|
||||||
//~ result = element;
|
|
||||||
//~ });
|
|
||||||
|
|
||||||
//~ // If the avg set is missing, retrieve the first set
|
|
||||||
//~ if (typeof result === 'undefined')
|
|
||||||
//~ result = dataObjects.shift();
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
//~ if (typeof result === 'undefined')
|
|
||||||
//~ throw new Error('Empty result');
|
|
||||||
|
|
||||||
//~ return result;
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
//~ // Throw errors
|
|
||||||
//~ var processDataObject = function (dataObject) {
|
|
||||||
//~ var result;
|
|
||||||
|
|
||||||
//~ if (typeof dataObject === 'undefined')
|
|
||||||
//~ throw new Error('Empty parameter');
|
|
||||||
|
|
||||||
//~ if (typeof dataObject.data === 'undefined'
|
|
||||||
//~ || !(dataObject.data instanceof Array))
|
|
||||||
//~ throw new Error('Object malformed');
|
|
||||||
|
|
||||||
//~ /* {
|
|
||||||
//~ * head: [<column>,<column>,...,<column>],
|
|
||||||
//~ * data: [
|
|
||||||
//~ * [<data>,<data>,...,<data>],
|
|
||||||
//~ * [<data>,<data>,...,<data>],
|
|
||||||
//~ * ...,
|
|
||||||
//~ * [<data>,<data>,...,<data>],
|
|
||||||
//~ * ]
|
|
||||||
//~ * }
|
|
||||||
//~ */
|
|
||||||
//~ if (type === 'csv') {
|
|
||||||
|
|
||||||
//~ result = {
|
|
||||||
//~ head: ['date', 'value','label'],
|
|
||||||
//~ data: []
|
|
||||||
//~ };
|
|
||||||
|
|
||||||
//~ dataObject.data.forEach(function (item, index) {
|
|
||||||
//~ var date = '', value = item[1];
|
|
||||||
|
|
||||||
//~ // Long labels are preferred
|
|
||||||
//~ if (typeof labels_long[index] !== 'undefined')
|
|
||||||
//~ date = labels_long[index];
|
|
||||||
//~ else if (typeof labels[index] !== 'undefined')
|
|
||||||
//~ date = labels[index];
|
|
||||||
|
|
||||||
//~ result.data.push([date, value,dataObject.label]);
|
|
||||||
//~ });
|
|
||||||
//~ }
|
|
||||||
//~ /* [
|
|
||||||
//~ * {
|
|
||||||
//~ * 'date': <date>,
|
|
||||||
//~ * 'value': <value>
|
|
||||||
//~ * }
|
|
||||||
//~ * ],
|
|
||||||
//~ * [
|
|
||||||
//~ * {
|
|
||||||
//~ * 'date': <date>,
|
|
||||||
//~ * 'value': <value>
|
|
||||||
//~ * }
|
|
||||||
//~ * ],
|
|
||||||
//~ * ...,
|
|
||||||
//~ * [
|
|
||||||
//~ * {
|
|
||||||
//~ * 'date': <date>,
|
|
||||||
//~ * 'value': <value>
|
|
||||||
//~ * }
|
|
||||||
//~ * ]
|
|
||||||
//~ */
|
|
||||||
//~ else if (type === 'json') {
|
|
||||||
//~ result = [];
|
|
||||||
|
|
||||||
//~ dataObject.data.forEach(function (item, index) {
|
|
||||||
//~ var date = '', value = item[1];
|
|
||||||
|
|
||||||
//~ // Long labels are preferred
|
|
||||||
//~ if (typeof labels_long[index] !== 'undefined')
|
|
||||||
//~ date = labels_long[index];
|
|
||||||
//~ else if (typeof labels[index] !== 'undefined')
|
|
||||||
//~ date = labels[index];
|
|
||||||
|
|
||||||
//~ result.push({
|
|
||||||
//~ 'date': date,
|
|
||||||
//~ 'value': value,
|
|
||||||
//~ 'label': dataObject.label
|
|
||||||
//~ });
|
|
||||||
//~ });
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
//~ if (typeof result === 'undefined')
|
|
||||||
//~ throw new Error('Empty result');
|
|
||||||
|
|
||||||
//~ return result;
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
//~ try {
|
|
||||||
//~ var elements = [];
|
|
||||||
//~ var custom_graph = $('input:hidden[name=custom_graph]').value;
|
|
||||||
|
|
||||||
//~ if (custom_graph) {
|
|
||||||
//~ dataObject = retrieveDataOject(dataObjects);
|
|
||||||
//~ dataObjects.forEach(function (element) {
|
|
||||||
//~ elements.push(processDataObject(element));
|
|
||||||
//~ });
|
|
||||||
//~ graphData = elements;
|
|
||||||
//~ }
|
|
||||||
//~ else {
|
|
||||||
//~ dataObject = retrieveDataOject(dataObjects);
|
|
||||||
//~ elements.push(processDataObject(dataObject));
|
|
||||||
//~ graphData = elements;
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
//~ // Transform the object data into a string
|
|
||||||
//~ // cause PHP has limitations in the number
|
|
||||||
//~ // of POST params received.
|
|
||||||
//~ var graphDataStr = JSON.stringify(graphData);
|
|
||||||
|
|
||||||
//~ // Build form
|
|
||||||
//~ var $form = $('<form></form>'),
|
|
||||||
//~ $dataInput = $('<input>'),
|
|
||||||
//~ $typeInput = $('<input>'),
|
|
||||||
//~ $separatorInput = $('<input>'),
|
|
||||||
//~ $excelInput = $('<input>');
|
|
||||||
|
|
||||||
//~ $dataInput
|
|
||||||
//~ .prop('name', 'data')
|
|
||||||
//~ .prop('type', 'text')
|
|
||||||
//~ .prop('value', graphDataStr);
|
|
||||||
|
|
||||||
//~ $typeInput
|
|
||||||
//~ .prop('name', 'type')
|
|
||||||
//~ .prop('type', 'text')
|
|
||||||
//~ .prop('value', type);
|
|
||||||
|
|
||||||
//~ $separatorInput
|
|
||||||
//~ .prop('name', 'separator')
|
|
||||||
//~ .prop('type', 'text')
|
|
||||||
//~ .prop('value', ';');
|
|
||||||
|
|
||||||
//~ $excelInput
|
|
||||||
//~ .prop('name', 'excel_encoding')
|
|
||||||
//~ .prop('type', 'text')
|
|
||||||
//~ .prop('value', 0);
|
|
||||||
|
|
||||||
//~ $form
|
|
||||||
//~ .prop('method', 'POST')
|
|
||||||
//~ .prop('action', homeurl + '/include/graphs/export_data.php')
|
|
||||||
//~ .append($dataInput, $typeInput, $separatorInput, $excelInput)
|
|
||||||
//~ .hide()
|
|
||||||
//~ // Firefox made me write into the DOM for this :(
|
|
||||||
//~ .appendTo('body')
|
|
||||||
//~ .submit();
|
|
||||||
//~ }
|
|
||||||
//~ catch (e) {
|
|
||||||
//~ alert('There was an error exporting the data');
|
|
||||||
//~ console.log(e);
|
|
||||||
//~ }
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
// Prepared to turn series with a checkbox
|
|
||||||
//~ $('.check_serie_'+graph_id).click(function() {
|
|
||||||
//~ // Format of the id is graph_3905jf93f03_serie_id
|
|
||||||
//~ id_clicked = this.id.split('_')[3];
|
|
||||||
//~ // Update the serie clicked
|
|
||||||
//~ showed[id_clicked] = this.checked;
|
|
||||||
//~ });
|
|
||||||
|
|
||||||
if (menu) {
|
if (menu) {
|
||||||
var parent_height;
|
var parent_height;
|
||||||
$('#menu_overview_' + graph_id).click(function() {
|
$('#menu_overview_' + graph_id).click(function() {
|
||||||
@ -2119,7 +1920,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
//~ event.preventDefault();
|
//~ event.preventDefault();
|
||||||
//~ plot.exportDataJSON();
|
//~ plot.exportDataJSON();
|
||||||
//~ });
|
//~ });
|
||||||
|
|
||||||
$('#menu_threshold_' + graph_id).click(function() {
|
$('#menu_threshold_' + graph_id).click(function() {
|
||||||
datas = new Array();
|
datas = new Array();
|
||||||
|
|
||||||
@ -2193,12 +1994,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
$('#menu_'+graph_id).parent().css('height').split('px')[0]);
|
$('#menu_'+graph_id).parent().css('height').split('px')[0]);
|
||||||
adjust_menu(graph_id, plot, parent_height);
|
adjust_menu(graph_id, plot, parent_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (water_mark) {
|
if (!dashboard) {
|
||||||
set_watermark(graph_id, plot, $('#watermark_image_'+graph_id).attr('src'));
|
if (water_mark)
|
||||||
|
set_watermark(graph_id, plot, $('#watermark_image_'+graph_id).attr('src'));
|
||||||
|
adjust_menu(graph_id, plot, parent_height, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust_menu(graph_id, plot, parent_height, width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjust_menu(graph_id, plot, parent_height, width) {
|
function adjust_menu(graph_id, plot, parent_height, width) {
|
||||||
|
@ -461,7 +461,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||||||
|
|
||||||
// Javascript code
|
// Javascript code
|
||||||
$return .= "<script type='text/javascript'>";
|
$return .= "<script type='text/javascript'>";
|
||||||
$return .= "//<![CDATA[\n";
|
$return .= "$(document).ready( function () {";
|
||||||
$return .= "pandoraFlotArea(" .
|
$return .= "pandoraFlotArea(" .
|
||||||
"'$graph_id', \n" .
|
"'$graph_id', \n" .
|
||||||
"'$values', \n" .
|
"'$values', \n" .
|
||||||
@ -474,7 +474,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||||||
"$watermark, \n" .
|
"$watermark, \n" .
|
||||||
"$width, \n" .
|
"$width, \n" .
|
||||||
"$max_x, \n" .
|
"$max_x, \n" .
|
||||||
"'" . $homeurl . "', \n" .
|
"'$homeurl', \n" .
|
||||||
"'$unit', \n" .
|
"'$unit', \n" .
|
||||||
"$font_size, \n" .
|
"$font_size, \n" .
|
||||||
"'$font', \n" .
|
"'$font', \n" .
|
||||||
@ -500,11 +500,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||||||
"'$xaxisname', \n" .
|
"'$xaxisname', \n" .
|
||||||
"'$background_color', \n" .
|
"'$background_color', \n" .
|
||||||
"'$legend_color'
|
"'$legend_color'
|
||||||
|
|
||||||
);";
|
);";
|
||||||
|
$return .= "});";
|
||||||
|
|
||||||
$return .= "\n//]]>";
|
|
||||||
$return .= "</script>";
|
$return .= "</script>";
|
||||||
|
|
||||||
// Parent layer
|
// Parent layer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user