Adapts donut graph to meta

This commit is contained in:
Arturo Gonzalez 2017-10-18 16:29:51 +02:00
parent b4c1e7d5fe
commit ddbe2a298c
5 changed files with 17 additions and 17 deletions

View File

@ -2005,9 +2005,7 @@ function setDonutsGraph (id_data, values) {
parameter.push ({name: "action", value: "get_module_type_string"});
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "id_agent_module", value: values['module']});
if (is_metaconsole()) {
parameter.push ({name: "id_metaconsole", value: id_metaconsole});
}
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "id_visual_console", value: id_visual_console});
jQuery.ajax({
url: get_url_ajax(),
@ -2015,7 +2013,6 @@ function setDonutsGraph (id_data, values) {
type: "POST",
dataType: 'json',
success: function (data) {
console.log(data);
if (data['no_data'] == true) {
if (values['width'] == "0") {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/wrong_donut_graph.png');

View File

@ -144,8 +144,10 @@ switch ($action) {
case 'get_module_type_string':
$data = array ();
if (!empty($id_metaconsole)) {
$connection = db_get_row_filter ('tmetaconsole_setup', $id_metaconsole);
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup', $layoutData['id_metaconsole']);
if (metaconsole_load_external_db($connection) != NOERR) {
continue;
}
@ -155,7 +157,7 @@ switch ($action) {
array ('id_agente' => $id_agent,
'id_agente_modulo' => $id_agent_module));
if (!empty($id_metaconsole)) {
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}

View File

@ -1141,8 +1141,8 @@ function visual_map_print_item($mode = "read", $layoutData,
break;
case DONUT_GRAPH:
if (!empty($id_metaconsole)) {
$connection = db_get_row_filter ('tmetaconsole_setup', $id_metaconsole);
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup', $layoutData['id_metaconsole']);
if (metaconsole_load_external_db($connection) != NOERR) {
continue;
}
@ -1151,10 +1151,6 @@ function visual_map_print_item($mode = "read", $layoutData,
$is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo',
array ('id_agente' => $layoutData['id_agent'],
'id_agente_modulo' => $id_module));
if (!empty($id_metaconsole)) {
metaconsole_restore_db();
}
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
($is_string == 10) || ($is_string == 33)) {
@ -1831,6 +1827,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
function get_donut_module_data ($id_module) {
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module));
$values = explode(";", $mod_values);

View File

@ -24,9 +24,14 @@ function include_javascript_d3 ($return = false) {
if (!$is_include_javascript) {
$is_include_javascript = true;
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
if (is_metaconsole()) {
$output .= '<script type="text/javascript" src="' . '../../' . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="' . '../../' . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
}
else {
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
}
}
if (!$return)
echo $output;

View File

@ -1590,7 +1590,6 @@ function print_donut_graph (recipient, width, height, module_data) {
slice.enter()
.insert("path")
.style("fill", function(d) {
console.log(d);
return d.data.color;
})
.attr("class", "slice")