diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index fe37fb9058..703f309a1a 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -179,7 +179,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_vcolumn_chart ($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, - $homedir); + $homedir,$font,$font_size); } else { $graph = array(); @@ -263,7 +263,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $backgroundColor, $dashboard, $vconsole, - $agent_module_id); + $agent_module_id, + $font, + $font_size); } else { $graph = array(); @@ -316,6 +318,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $legend, $long_index, $homeurl, + $font, + $font_size, $unit, $water_mark_url, array(), @@ -378,6 +382,8 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $legend, $long_index, $homeurl, + $font, + $font_size, $unit, $water_mark_url, array(), @@ -524,6 +530,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $homeurl, + $font, + $font_size, $unit, $water_mark_url, array(), @@ -603,7 +611,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_hcolumn_chart( - $chart_data, $width, $height, $water_mark_url); + $chart_data, $width, $height, $water_mark_url, $font, $font_size); } else { $graph = array(); diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 9bdb6da385..7cf3fbc779 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -117,9 +117,10 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat } } -function pandoraFlotPieCustom(graph_id, values, labels, width, - font_size, water_mark, separator, legend_position, height, +function pandoraFlotPieCustom(graph_id, values, labels, width, + font_size, font, water_mark, separator, legend_position, height, colors,legend) { + font = font.split("/").pop().split(".").shift(); var labels = labels.split(separator); var legend = legend.split(separator); var data = values.split(separator); @@ -189,6 +190,8 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, legends.each(function () { //$(this).css('width', $(this).width()); $(this).css('font-size', font_size+'pt'); + $(this).removeClass("legendLabel"); + $(this).addClass(font); $(this).text(legend[j]); j++; }); @@ -259,10 +262,11 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, } function pandoraFlotHBars(graph_id, values, labels, water_mark, - maxvalue, water_mark, separator, separator2) { + maxvalue, water_mark, separator, separator2, font, font_size) { var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27']; values = values.split(separator2); + font = font.split("/").pop().split(".").shift(); var datas = new Array(); for (i = 0; i < values.length; i++) { var serie = values[i].split(separator); @@ -309,7 +313,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, yaxis: { axisLabelUseCanvas: true, axisLabelFontSizePixels: 12, - axisLabelFontFamily: 'Verdana, Arial', + axisLabelFontFamily: font+'Font', axisLabelPadding: 3, ticks: yFormatter, tickSize: 1, @@ -465,7 +469,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, title = label; label = shortLabel; } - format.push([i,'
' + format.push([i,'
' + label + '
']); } @@ -543,10 +547,11 @@ function showTooltip(x, y, color, contents) { }).appendTo("body").fadeIn(200); } -function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2) { +function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size ) { values = values.split(separator2); legend = legend.split(separator); + font = font.split("/").pop().split(".").shift(); labels_long = labels_long.length > 0 ? labels_long.split(separator) : 0; colors = colors.length > 0 ? colors.split(separator) : []; var colors_data = colors.length > 0 @@ -591,7 +596,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, xaxis: { axisLabelUseCanvas: true, axisLabelFontSizePixels: 7, - axisLabelFontFamily: 'Verdana, Arial', + axisLabelFontFamily: font+'Font', axisLabelPadding: 0, ticks: xFormatter, labelWidth: 130, @@ -599,7 +604,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, yaxis: { axisLabelUseCanvas: true, axisLabelFontSizePixels: 7, - axisLabelFontFamily: 'Verdana, Arial', + axisLabelFontFamily: font+'Font', axisLabelPadding: 100, autoscaleMargin: 0.02, tickFormatter: function (v, axis) { @@ -695,7 +700,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, label = shortLabel; } format.push([i, - '
' + '
' + label + '
']); } @@ -820,7 +825,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul function pandoraFlotArea(graph_id, values, labels, labels_long, legend, colors, type, serie_types, water_mark, width, max_x, homeurl, unit, - font_size, menu, events, event_ids, legend_events, alerts, + font_size, font, menu, events, event_ids, legend_events, alerts, alert_ids, legend_alerts, yellow_threshold, red_threshold, force_integer, separator, separator2, yellow_up, red_up, yellow_inverse, red_inverse, @@ -828,6 +833,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, var threshold = true; var thresholded = false; + font = font.split("/").pop().split(".").shift(); values = values.split(separator2); serie_types = serie_types.split(separator); @@ -1713,6 +1719,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, $('#legend_' + graph_id + ' .legendLabel') .eq(i).css('color','#000'); + $('#legend_' + graph_id + ' .legendLabel') + .eq(i).css('font-family',font+'Font'); + i++; } } @@ -1816,17 +1825,17 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, if (labels[v] == undefined) { return ''; } - return '
'+labels[v]+'
'; + return '
'+labels[v]+'
'; } function yFormatter(v, axis) { var formatted = number_format(v,force_integer,unit); - return '
'+formatted+'
'; + return '
'+formatted+'
'; } function lFormatter(v, item) { - return '
'+v+'
'; + return '
'+v+'
'; // Prepared to turn series with a checkbox //return '
'+v+'
'; } @@ -2317,4 +2326,4 @@ function reduceText (text, maxLength) { if (text.length <= maxLength) return text var firstSlideEnd = parseInt((maxLength - 3) / 2); return text.substr(0, firstSlideEnd) + '...' + text.substr(-firstSlideEnd - 3); -} \ No newline at end of file +} diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index 20cc615490..8540eba1e1 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -150,8 +150,9 @@ function d3_bullet_chart($chart_data, $width, $height, $color, $legend, $output .= include_javascript_d3(true); $id_bullet = uniqid(); - - $output .= + $font = array_shift(explode(".",array_pop(explode("/",$font)))); + + $output .= '
"; return $output; diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 42434796e6..2cb236fd61 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -90,7 +90,7 @@ function include_javascript_dependencies_flot_graph($return = false) { ////////// AREA GRAPHS //////// /////////////////////////////// function flot_area_stacked_graph($chart_data, $width, $height, $color, - $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', + $legend, $long_index, $homeurl = '', $font = '', $font_size = 7,$unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, @@ -102,7 +102,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_stacked', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole, $agent_module_id); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id, $font,$font_size); } function flot_area_simple_graph($chart_data, $width, $height, $color, @@ -110,19 +110,19 @@ function flot_area_simple_graph($chart_data, $width, $height, $color, $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { - + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0, $font = '',$font_size = 7) { + global $config; return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_simple', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole, $agent_module_id); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id,$font,$font_size); } function flot_line_stacked_graph($chart_data, $width, $height, $color, - $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', + $legend, $long_index, $homeurl = '',$font = '', $font_size = 7, $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, @@ -134,11 +134,11 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_stacked', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole, $agent_module_id); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id, $font, $font_size); } function flot_line_simple_graph($chart_data, $width, $height, $color, - $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', + $legend, $long_index, $homeurl = '', $font = '', $font_size = 7,$unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '', $menu = true, @@ -150,22 +150,20 @@ function flot_line_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_simple', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, - $menu, $background_color, $dashboard, $vconsole); + $menu, $background_color, $dashboard, $vconsole, $agent_module_id, $font, $font_size); } function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $type, $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str = '', $menu = true, - $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) { - + $background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0,$font = '',$font_size = 7) { + global $config; include_javascript_dependencies_flot_graph(); - - $font_size = '7'; - + $menu = (int)$menu; // Get a unique identifier to graph @@ -430,6 +428,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, "'" . $homeurl . "', \n" . "'$unit', \n" . "$font_size, \n" . + "'$font', \n" . "$menu, \n" . "'$events', \n" . "'$event_ids', \n" . @@ -571,7 +570,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values, $return .= ""; @@ -580,7 +579,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values, } // Returns a 3D column chart -function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) { +function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7) { global $config; include_javascript_dependencies_flot_graph(); @@ -661,8 +660,8 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) { $return .= ""; return $return; diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 8d08b3afb9..0ba73862bf 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -888,7 +888,7 @@ function createGauge(name, etiqueta, value, min, max, min_warning,max_warning,mi config.redZones = [{ from: min_critical, to: max_critical }]; } } - gauges = new Gauge(name, config); + gauges = new Gauge(name, config, font); gauges.render(); gauges.redraw(value); $(".gauge>text").each(function() { @@ -927,7 +927,7 @@ function createGauge(name, etiqueta, value, min, max, min_warning,max_warning,mi config = false; } -function createGauges(data, width, height, font_size, no_data_image) +function createGauges(data, width, height, font_size, no_data_image, font) { var nombre,label,minimun_warning,maximun_warning,minimun_critical,maximun_critical, mininum,maxinum,valor; @@ -981,16 +981,18 @@ function createGauges(data, width, height, font_size, no_data_image) valor = (-1200); createGauge(nombre, label, valor, mininum, maxinum, minimun_warning, maximun_warning, minimun_critical, - maximun_critical, font_size, height); - - + maximun_critical, font_size, height, font); + + } } -function Gauge(placeholderName, configuration) +function Gauge(placeholderName, configuration, font) { + + var font = font.split("/").pop().split(".").shift(); this.placeholderName = placeholderName; var self = this; // for internal d3 functions @@ -1067,6 +1069,7 @@ function Gauge(placeholderName, configuration) .attr("y", this.config.cy / 2 + fontSize / 2) .attr("dy", fontSize / 2) .attr("text-anchor", "middle") + .attr("class", font) .text(this.config.label) .style("font-size", this.config.font_size+"pt") .style("fill", "#333") diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ea8d4a2e1e..1de73f7c5c 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -3189,4 +3189,125 @@ div.simple_value > span.text > p { /* Image open dialog in group events by agents*/ #open_agent_groups { cursor: pointer; +} + +/*Font ttf */ +@font-face +{ + font-family: 'DejaVuSerif-BoldFont'; + src: url('../fonts/DejaVuSerif-Bold.ttf') format('truetype'); +} + +.DejaVuSerif-Bold{ + font-family: DejaVuSerif-BoldFont; +} + +@font-face +{ + font-family: 'DejaVuSerif-BoldItalicFont'; + src: url('../fonts/DejaVuSerif-BoldItalic.ttf') format('truetype'); +} + +.DejaVuSerif-BoldItalic{ + font-family: DejaVuSerif-BoldItalicFont; +} + +@font-face +{ + font-family: 'DejaVuSerif-ItalicFont'; + src: url('../fonts/DejaVuSerif-Italic.ttf') format('truetype'); +} + +.DejaVuSerif-Italic{ + font-family: DejaVuSerif-ItalicFont; +} + +@font-face +{ + font-family: 'DejaVuSerifFont'; + src: url('../fonts/DejaVuSerif.ttf') format('truetype'); +} + +.DejaVuSerif{ + font-family: DejaVuSerifFont; +} + +@font-face +{ + font-family: 'DejaVuSerifCondensed-BoldFont'; + src: url('../fonts/DejaVuSerifCondensed-Bold.ttf') format('truetype'); +} + +.DejaVuSerifCondensed-Bold{ + font-family: DejaVuSerifCondensed-BoldFont; +} + +@font-face +{ + font-family: 'DejaVuSerifCondensed-BoldItalicFont'; + src: url('../fonts/DejaVuSerifCondensed-BoldItalic.ttf') format('truetype'); +} + +.DejaVuSerifCondensed-BoldItalic{ + font-family: DejaVuSerifCondensed-BoldItalicFont; +} + +@font-face +{ + font-family: 'DejaVuSerifCondensed-ItalicFont'; + src: url('../fonts/DejaVuSerifCondensed-Italic.ttf') format('truetype'); +} + +.DejaVuSerifCondensed-Italic{ + font-family: DejaVuSerifCondensed-ItalicFont; +} + +@font-face +{ + font-family: 'DejaVuSerifCondensedFont'; + src: url('../fonts/DejaVuSerifCondensed.ttf') format('truetype'); +} + +.DejaVuSerifCondensed{ + font-family: DejaVuSerifCondensedFont; +} + +@font-face +{ + font-family: 'FreeSansFont'; + src: url('../fonts/FreeSans.ttf') format('truetype'); +} + +.FreeSans{ + font-family: FreeSansFont; +} + +@font-face +{ + font-family: 'FreeSansBoldFont'; + src: url('../fonts/FreeSansBold.ttf') format('truetype'); +} + +.FreeSansBold{ + font-family: FreeSansBoldFont; +} + +@font-face +{ + font-family: 'smallfontFont'; + src: url('../fonts/smallfont.ttf') format('truetype'); +} + +.smallfont{ + font-family: smallfontFont; +} + +@font-face +{ + font-family: 'unicodeFont'; + src: url('../fonts/unicode.ttf') format('truetype'); +} + +.unicode{ + font-family: unicodeFont; } \ No newline at end of file