# -*- coding: utf-8 -*-
# $Id$
"""
Test Manager Web-UI - Graph Helpers - Implemented using matplotlib.
"""
__copyright__ = \
"""
Copyright (C) 2012-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
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.
"""
# Standard Python Import and extensions installed on the system.
import re;
import StringIO;
# Validation Kit imports.
""" Base class for the matplotlib graphs. """
""" Enables xkcd style graphs for implementations that supports it. """
return True;
"""
Wrapper around matplotlib.pyplot.figure that feeds the figure the
basic graph configuration.
"""
return oFigure;
""" Creates an SVG string from the given figure. """
if fTightLayout:
# This browser will stretch images to fit if no size or width is given.
sSubstitute = r'\1 \3 reserveAspectRatio="xMidYMin meet"';
else:
# Chrome and IE likes to have the sizes as well as the viewBox.
sSubstitute = r'\1 \3 reserveAspectRatio="xMidYMin meet" \2 \4';
return re.sub(r'(<svg) (height="\d+pt") (version="\d+.\d+" viewBox="\d+ \d+ \d+ \d+") (width="\d+pt")',
count = 1);
"""
Bar graph.
"""
self.cxBarWidth = None;
""" Sets the max range."""
return None;
#
#
if self.cxBarWidth is None:
# Render the PNG.
aoSeries[i],
align = 'edge'));
#oSubPlot.set_title('Title')
#oSubPlot.set_xlabel('X-axis')
#oSubPlot.set_xticks(oXRange + self.cxBarWidth);
#oSubPlot.set_ylabel('Y-axis')
else:
"""
Line graph.
"""
# oData must be a WuiHlpGraphDataTableEx like object.
""" Enables or Disables error bars, making this work like a line graph. """
return True;
cSeriesNames = 0;
cYMin = 1000;
cYMax = 0;
if not self._fErrorBarY:
else:
else:
if cSeriesNames > 0:
if True:
# oSubPlot.axis('off');
#oSubPlot.grid(True, 'major', axis = 'none');
#oSubPlot.grid(True, 'both', axis = 'none');
"""
Line graph with an errorbar for the Y axis.
"""
"""
Mini rate graph.
"""
"""
oData must be a WuiHlpGraphDataTableEx like object, but only aoSeries,
aoSeries[].aoXValues, and aoSeries[].aoYValues will be used. The
values are expected to be a percentage, i.e. values between 0 and 100.
"""
# hacking
#self.setWidth(512);
#self.setHeight(128);
# end
# Disable all the normal axis.
# Use the zero axis instead.
sColor = 'green';
sColor = 'yellow';
else:
sColor = 'red';
oAxis.set_xticklabels([]);
#oAxis.set_yticklabels([]);