1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 from reportlab.lib.styles import PropertySet
11 from reportlab.lib.pagesizes import A4
12 from reportlab.lib import colors
13 from reportlab.lib.styles import ParagraphStyle
14 import reportlab.lib.enums as ens
17 class TemplateStyle(PropertySet):
27 title_font='Courier-Bold',
37 class ImageStyle(PropertySet):
41 image_hAlign='CENTRE', # LEFT,CENTRE or RIGHT
42 image_vAlign='MIDDLE' # BOTTOM,MIDDLE or TOP
46 class TableStyle(PropertySet):
48 table_hAlign='CENTRE', # LEFT,CENTRE or RIGHT
49 table_vAlign='MIDDLE', # BOTTOM,MIDDLE or TOP
55 class LinePlotStyle(PropertySet):
61 strokeColor=colors.black,
63 format=('%4.2f', '%4.0f', '%3.1f'),
66 (colors.red, 'Circle', 1.5),
67 (colors.blue, 'Diamond', 1.5),
68 (colors.gold, 'Square', 1.5),
69 (colors.green, 'Triangle', 1.5),
70 (colors.pink, 'FilledCircle', 1.5),
71 (colors.lightblue, 'FilledDiamond', 1.5),
72 (colors.lightgreen, 'FilledTriangle', 1.5)
77 class LineChartStyle(PropertySet):
83 strokeColor=colors.lightgrey,
85 format=('%4.2f', '%3.1f'),
88 (colors.red, 'Circle', 1.5),
89 (colors.blue, 'Diamond', 1.5),
90 (colors.gold, 'Square', 1.5),
91 (colors.green, 'Triangle', 1.5),
92 (colors.pink, 'FilledCircle', 1.5),
93 (colors.lightblue, 'FilledDiamond', 1.5),
94 (colors.lightgreen, 'FilledTriangle', 1.5)
99 class BarChartStyle(PropertySet):
110 strokeColor=colors.lightgrey,
113 "loss": (colors.lightgreen, '%4.2f'),
114 "latency": (colors.indianred, '%4.1f'),
115 "fastlink": (colors.pink, '%4.1f'),
116 "l2switch": (colors.lightblue, '%4.1f'),
117 "kernel rdp": (colors.lightgreen, '%4.1f'),
118 "ovs": (colors.purple, '%4.1f')
120 background=colors.lightgrey,
125 tes_default = TemplateStyle(name='default')
126 is_default = ImageStyle(name='default')
127 is_traffic = ImageStyle(name='traffic',
130 image_hAlign='CENTRE')
132 ts_default = TableStyle(name='default')
133 ts_left = TableStyle(
135 table_hAlign='LEFT', # LEFT,CENTRE or RIGHT
136 table_vAlign='BOTTOM', # BOTTOM,MIDDLE or TOP
137 table_colWidths=None,
138 table_rowHeights=None
140 lps_default = LinePlotStyle(name='default')
141 lcs_default = LineChartStyle(name='default')
142 bcs_default = BarChartStyle(name='default')
143 ps_head_lv1 = ParagraphStyle(name='ps_head_lv1',
144 fontName='Courier-Bold',
145 alignment=ens.TA_CENTER, # TA_LEFT, TA_RIGHT
150 ps_head_lv2 = ParagraphStyle(name='ps_head_lv2',
156 ps_head_lv3 = ParagraphStyle(name='ps_head_lv3',
162 ps_head_lv4 = ParagraphStyle(name='ps_head_lv4',
164 fontName='Courier-Bold',
168 ps_head_lv5 = ParagraphStyle(name='ps_head_lv5',
174 ps_head_lv6 = ParagraphStyle(name='ps_head_lv6',
180 ps_head_lv7 = ParagraphStyle(name='ps_head_lv7',
186 ps_head_lv8 = ParagraphStyle(name='ps_head_lv8',
192 ps_head_lv9 = ParagraphStyle(name='ps_head_lv9',
198 ps_body = ParagraphStyle(name='ps_body',
204 ps_space = ParagraphStyle(name='ps_space',