本文整理汇总了Python中pygooglechart.SimpleLineChart.chls方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleLineChart.chls方法的具体用法?Python SimpleLineChart.chls怎么用?Python SimpleLineChart.chls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygooglechart.SimpleLineChart
的用法示例。
在下文中一共展示了SimpleLineChart.chls方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _line_strip_graph
# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import chls [as 别名]
def _line_strip_graph(data, legends, axis_labels, size, steps,
type=SimpleLineChart, multiline=False, **kwargs):
if multiline:
max_values = []
min_values = []
for row in data:
max_values.append(max(row))
min_values.append(min(row))
max_y = max(max_values)
min_y = min(min_values)
else:
max_y = max(data)
min_y = min(data)
#validando si hay datos para hacer grafico
if max_y==0:
return None
chart = SimpleLineChart(size[0], size[1], y_range=[0, max_y*1.05])
if multiline:
for row in data:
chart.add_data(row)
else:
chart.add_data(data)
step = ((max_y*1.05)-(min_y*0.95))/steps
#validando en caso de el paso sea menor que uno y de cero en la conversion
if step<1:
step = 1
max_value = max_y
tope = int(round(max_value*1.05))
if tope < max_value:
tope+=2
else:
tope+=1
try:
left_axis = range(int(round(min_y*0.95)), tope, int(step))
except ValueError:
#error por que los range no soportan decimales
left_axis = range(0, 2)
left_axis[0]=''
chart.set_axis_range(Axis.LEFT, min_y, tope)
if 'units' in kwargs:
chart.set_axis_labels(Axis.LEFT, kwargs['units'])
if 'time' in kwargs:
chart.set_axis_labels(Axis.BOTTOM, kwargs['time'])
chart.set_grid(0, 25, 4, 4,)
chart.chls=4|4
#chart.fill_linear_stripes(Chart.CHART, 0, 'FFFFEF', 0.2, 'FFFFFF', 0.2)
chart.set_colours(COLORS)
if axis_labels:
chart.set_axis_labels(Axis.BOTTOM, axis_labels)
chart.set_legend(legends)
chart.set_legend_position('b')
if 'thickness' in kwargs:
if multiline:
for i in range(len(data)):
chart.set_line_style(index = i, thickness=kwargs['thickness'])
else:
chart.set_line_style(index=0, thickness=kwargs['thickness'])
return chart