VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphbase.py@ 77922

Last change on this file since 77922 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuihlpgraphbase.py 76553 2019-01-01 01:45:53Z vboxsync $
3
4"""
5Test Manager Web-UI - Graph Helpers - Base Class.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2019 Oracle Corporation
11
12This file is part of VirtualBox Open Source Edition (OSE), as
13available from http://www.virtualbox.org. This file is free software;
14you can redistribute it and/or modify it under the terms of the GNU
15General Public License (GPL) as published by the Free Software
16Foundation, in version 2 as it comes in the "COPYING" file of the
17VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
20The contents of this file may alternatively be used under the terms
21of the Common Development and Distribution License Version 1.0
22(CDDL) only, as it comes in the "COPYING.CDDL" file of the
23VirtualBox OSE distribution, in which case the provisions of the
24CDDL are applicable instead of those of the GPL.
25
26You may elect to license modified versions of this file under the
27terms and conditions of either the GPL or the CDDL or both.
28"""
29__version__ = "$Revision: 76553 $"
30
31
32class WuiHlpGraphBase(object):
33 """
34 Base class for the Graph helpers.
35 """
36
37 ## Set of colors that can be used by child classes to color data series.
38 kasColors = \
39 [
40 '#0000ff', # Blue
41 '#00ff00', # Green
42 '#ff0000', # Red
43 '#000000', # Black
44
45 '#00ffff', # Cyan/Aqua
46 '#ff00ff', # Magenta/Fuchsia
47 '#ffff00', # Yellow
48 '#8b4513', # SaddleBrown
49
50 '#7b68ee', # MediumSlateBlue
51 '#ffc0cb', # Pink
52 '#bdb76b', # DarkKhaki
53 '#008080', # Teal
54
55 '#bc8f8f', # RosyBrown
56 '#000080', # Navy(Blue)
57 '#dc143c', # Crimson
58 '#800080', # Purple
59
60 '#daa520', # Goldenrod
61 '#40e0d0', # Turquoise
62 '#00bfff', # DeepSkyBlue
63 '#c0c0c0', # Silver
64 ];
65
66
67 def __init__(self, sId, oData, oDisp):
68 self._sId = sId;
69 self._oData = oData;
70 self._oDisp = oDisp;
71 # Graph output dimensions.
72 self._cxGraph = 1024;
73 self._cyGraph = 448;
74 self._cDpiGraph = 96;
75 # Other graph attributes
76 self._sTitle = None;
77 self._cPtFont = 8;
78
79 def headerContent(self):
80 """
81 Returns content that goes into the HTML header.
82 """
83 return '';
84
85 def renderGraph(self):
86 """
87 Renders the graph.
88 Returning HTML.
89 """
90 return '<p>renderGraph needs to be overridden by the child class!</p>';
91
92 def setTitle(self, sTitle):
93 """ Sets the graph title. """
94 self._sTitle = sTitle;
95 return True;
96
97 def setWidth(self, cx):
98 """ Sets the graph width. """
99 self._cxGraph = cx;
100 return True;
101
102 def setHeight(self, cy):
103 """ Sets the graph height. """
104 self._cyGraph = cy;
105 return True;
106
107 def setDpi(self, cDotsPerInch):
108 """ Sets the graph DPI. """
109 self._cDpiGraph = cDotsPerInch;
110 return True;
111
112 def setFontSize(self, cPtFont):
113 """ Sets the default font size. """
114 self._cPtFont = cPtFont;
115 return True;
116
117
118 @staticmethod
119 def calcSeriesColor(iSeries):
120 """ Returns a #rrggbb color code for the given series. """
121 return WuiHlpGraphBase.kasColors[iSeries % len(WuiHlpGraphBase.kasColors)];
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette