本文整理汇总了Python中reportlab.graphics.charts.barcharts.VerticalBarChart.bars方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalBarChart.bars方法的具体用法?Python VerticalBarChart.bars怎么用?Python VerticalBarChart.bars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.graphics.charts.barcharts.VerticalBarChart
的用法示例。
在下文中一共展示了VerticalBarChart.bars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw
# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import bars [as 别名]
def draw(self, cur_drawing, start_x, start_y, end_x, end_y):
"""Draw a bar chart with the info in the specified range."""
bar_chart = VerticalBarChart()
if self.chart_title:
self._draw_title(cur_drawing, self.chart_title,
start_x, start_y, end_x, end_y)
# set the position of the bar chart
x_start, x_end, y_start, y_end = self._determine_position(start_x,
start_y,
end_x,
end_y)
bar_chart.x = x_start
bar_chart.y = y_start
bar_chart.width = abs(x_start - x_end)
bar_chart.height = abs(y_start - y_end)
# set the information in the bar chart
bar_chart.data = self.display_info
bar_chart.valueAxis.valueMin = min(self.display_info[0])
bar_chart.valueAxis.valueMax = max(self.display_info[0])
for data_set in self.display_info[1:]:
if min(data_set) < bar_chart.valueAxis.valueMin:
bar_chart.valueAxis.valueMin = min(data_set)
if max(data_set) > bar_chart.valueAxis.valueMax:
bar_chart.valueAxis.valueMax = max(data_set)
# set other formatting options
if len(self.display_info) == 1:
bar_chart.groupSpacing = 0
style = TypedPropertyCollection(BarChartProperties)
style.strokeWidth = 0
style.strokeColor = colors.green
style[0].fillColor = colors.green
bar_chart.bars = style
# set the labels
# XXX labels don't work yet
# bar_chart.valueAxis.title = self.x_axis_title
# bar_chart.categoryAxis.title = self.y_axis_title
cur_drawing.add(bar_chart)