Module: check_mk
Branch: master
Commit: d2556b9f1e58e039f7eeb41effe1f2fb38ca6a40
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d2556b9f1e58e0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 11 13:38:35 2017 +0100
Add option to show/hide the graph margin space
Change-Id: Idaa7f6ada2adfcf85e16bf1d1bf1bd54477ef67f
---
web/htdocs/metrics.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 358648a..195dca8 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -1571,13 +1571,19 @@ def page_graph_dashlet():
def host_service_graph_dashlet_cmk(graph_identification, custom_graph_render_options):
- size = (int(((float(html.var("width")) - 25)/html_size_per_ex)),
- int((float(html.var("height")) - 18)/html_size_per_ex))
-
graph_render_options = default_dashlet_graph_render_options.copy()
- graph_render_options["size"] = size
+ graph_render_options = add_default_render_options(graph_render_options)
graph_render_options.update(custom_graph_render_options)
+ width, height = (int((float(html.var("width"))/html_size_per_ex)),
+ int(float(html.var("height"))/html_size_per_ex))
+
+ height -= _graph_title_height_ex(graph_render_options)
+ height -= (_graph_top_margin_px(graph_render_options) +
_graph_bottom_margin_px(graph_render_options)) / html_size_per_ex
+ width -= (_graph_left_margin_px(graph_render_options) +
_graph_right_margin_px(graph_render_options)) / html_size_per_ex
+
+ graph_render_options["size"] = (width, height)
+
# The timerange is specified in PNP like manner.
range_secs = {
"0" : 4 * 3600,
@@ -1613,7 +1619,10 @@ def host_service_graph_dashlet_cmk(graph_identification,
custom_graph_render_opt
if graph_render_options["show_legend"]:
# TODO FIXME: This graph artwork is calulated twice. Once here and once in
render_graphs_from_specification_html()
graph_artwork = compute_graph_artwork(graph_recipe, graph_data_range,
graph_render_options)
- graph_render_options["size"] = (size[0], size[1] -
graph_legend_height_ex(graph_render_options, graph_artwork))
+ graph_render_options["size"] = (
+ graph_render_options["size"][0],
+ graph_render_options["size"][1] -
graph_legend_height_ex(graph_render_options, graph_artwork)
+ )
html_code = render_graphs_from_definitions([graph_recipe], graph_data_range,
graph_render_options, render_async=False)
html.write(html_code)