mirror of https://github.com/snachodog/mybuddy.git
fix lint
This commit is contained in:
parent
8c34075696
commit
37b3205cf8
|
@ -7,6 +7,7 @@ import plotly.graph_objs as go
|
||||||
|
|
||||||
from reports import utils
|
from reports import utils
|
||||||
|
|
||||||
|
|
||||||
def feeding_amounts(instances):
|
def feeding_amounts(instances):
|
||||||
"""
|
"""
|
||||||
Create a graph showing daily feeding amounts over time.
|
Create a graph showing daily feeding amounts over time.
|
||||||
|
@ -43,7 +44,7 @@ def feeding_amounts(instances):
|
||||||
# sum each feeding type for graph
|
# sum each feeding type for graph
|
||||||
amounts_array = []
|
amounts_array = []
|
||||||
for i in range(total_idx):
|
for i in range(total_idx):
|
||||||
amounts_array.append([round(amount, 2) for amount in totals_list[i].values()])
|
amounts_array.append([round(a, 2) for a in totals_list[i].values()])
|
||||||
|
|
||||||
traces = []
|
traces = []
|
||||||
for i in range(total_idx-1):
|
for i in range(total_idx-1):
|
||||||
|
@ -64,7 +65,6 @@ def feeding_amounts(instances):
|
||||||
text=amounts_array[total_idx-1]
|
text=amounts_array[total_idx-1]
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
layout_args = utils.default_graph_layout_options()
|
layout_args = utils.default_graph_layout_options()
|
||||||
layout_args['title'] = _('<b>Total Feeding Amounts</b>')
|
layout_args['title'] = _('<b>Total Feeding Amounts</b>')
|
||||||
layout_args['xaxis']['title'] = _('Date')
|
layout_args['xaxis']['title'] = _('Date')
|
||||||
|
@ -76,5 +76,7 @@ def feeding_amounts(instances):
|
||||||
'layout': go.Layout(**layout_args)
|
'layout': go.Layout(**layout_args)
|
||||||
})
|
})
|
||||||
fig.update_layout(barmode='stack')
|
fig.update_layout(barmode='stack')
|
||||||
|
fig.update_yaxes(automargin=True)
|
||||||
|
fig.update_xaxes(automargin=True)
|
||||||
output = plotly.plot(fig, output_type='div', include_plotlyjs=False)
|
output = plotly.plot(fig, output_type='div', include_plotlyjs=False)
|
||||||
return utils.split_graph_output(output)
|
return utils.split_graph_output(output)
|
||||||
|
|
Loading…
Reference in New Issue