if grouped: last_value = None for obj in data["datasets"]: if obj["stack"] == last_value: obj["first_of_stack"] = "" else: obj["first_of_stack"] = True last_value = obj["stack"] data["datasets"].append( { "data": labels, "label": el.name, "backgroundColor": el.color, "info": ..., "date": f"{report_month:02d}/{str(report_year)[-2:]}", "stack": f"Report {report_pk}", "first_of_stack": "", } )
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter