# -*- coding: utf-8 -*- # $Id: wuihlpgraphgooglechart.py $ """ Test Manager Web-UI - Graph Helpers - Implemented using Google Charts. """ __copyright__ = \ """ Copyright (C) 2012-2019 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation, in version 2 as it comes in the "COPYING" file of the VirtualBox OSE distribution. VirtualBox OSE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. The contents of this file may alternatively be used under the terms of the Common Development and Distribution License Version 1.0 (CDDL) only, as it comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution, in which case the provisions of the CDDL are applicable instead of those of the GPL. You may elect to license modified versions of this file under the terms and conditions of either the GPL or the CDDL or both. """ __version__ = "$Revision: 127855 $" # Validation Kit imports. from common import webutils; from testmanager.webui.wuihlpgraphbase import WuiHlpGraphBase; from testmanager.webui import wuihlpgraphsimple; #******************************************************************************* #* Global Variables * #******************************************************************************* g_cGraphs = 0; class WuiHlpGraphGoogleChartsBase(WuiHlpGraphBase): """ Base class for the Google Charts graphs. """ pass; ## @todo bar graphs later. WuiHlpBarGraph = wuihlpgraphsimple.WuiHlpBarGraph; class WuiHlpLineGraph(WuiHlpGraphGoogleChartsBase): """ Line graph. """ ## @todo implement error bars. kfNoErrorBarsSupport = True; def __init__(self, sId, oData, oDisp = None, fErrorBarY = False): # oData must be a WuiHlpGraphDataTableEx like object. WuiHlpGraphGoogleChartsBase.__init__(self, sId, oData, oDisp); self._cMaxErrorBars = 12; self._fErrorBarY = fErrorBarY; def setErrorBarY(self, fEnable): """ Enables or Disables error bars, making this work like a line graph. """ self._fErrorBarY = fEnable; return True; def renderGraph(self): # pylint: disable=R0914 fSlideFilter = True; # Tooltips? cTooltips = 0; for oSeries in self._oData.aoSeries: cTooltips += oSeries.asHtmlTooltips is not None; # Unique on load function. global g_cGraphs; iGraph = g_cGraphs; g_cGraphs += 1; sHtml = '