def get_chart(self, records, garden): records = records.filter(volume__isnull=False) df = pd.DataFrame.from_records(records.values('volume', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['volume'] return line_fill(qdf.cumsum(), make_chart_name('rainwater_line', garden), ylabel='GALLONS', shape='short')
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('weight', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['weight'] qdf = qdf.apply(lambda x: to_preferred_weight_units(x, garden, force_large_units=True).magnitude) units = preferred_weight_units(garden, large=True) return line_fill(qdf.cumsum(), make_chart_name('landfilldiversion_weight_line', garden), ylabel=units.upper(), shape='short')
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('volume', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['volume'] qdf = qdf.apply(lambda x: to_preferred_volume_units( garden, cubic_meters=x, force_large_units=True).magnitude) units = preferred_volume_units(garden, large=True) return line_fill(qdf.cumsum(), make_chart_name('compost_volume_line', garden), ylabel=units.upper(), shape='short')
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('weight', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['weight'] qdf = qdf.apply(lambda x: to_preferred_weight_units( x, garden, force_large_units=True).magnitude) units = preferred_weight_units(garden, large=True) return line_fill(qdf.cumsum(), make_chart_name('landfilldiversion_weight_line', garden), ylabel=units.upper(), shape='short')
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('volume', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['volume'] qdf = qdf.apply(lambda x: to_preferred_volume_units(garden, cubic_meters=x, force_large_units=True).magnitude) units = preferred_volume_units(garden, large=True) return line_fill(qdf.cumsum(), make_chart_name('compost_volume_line', garden), ylabel=units.upper(), shape='short')