Waterfall#
Note
Requires the highcharts-more module (loaded by default):
easychart.config.scripts.append("https://code.highcharts.com/highcharts-more.js")
easychart.config.save()
See section on extensions for more details.
import easychart
data = [10, 30, {"isIntermediateSum": True}, -4, -8, {"isSum": True}]
chart = easychart.new("waterfall", legend=False)
chart.categories = [
"Opening stocks",
"Production",
"Total domestic supply",
"Net exports",
"Consumption",
"Closing stocks",
]
chart.plot(data)
chart
Customizing colors#
import easychart
data = [
{"y": 120000, "color": "#059669"},
{"y": 569000, "color": "#059669"},
{"y": 231000, "color": "#059669"},
{"isIntermediateSum": True},
{"y": -342000, "color": "#ef4444"},
{"y": -233000, "color": "#ef4444"},
{"isSum": True},
]
chart = easychart.new("waterfall")
chart.categories = [
"Services revenues",
"Product revenues",
"Licensing revenues",
"Total revenues",
"Fixed costs",
"Variable costs",
"Profit (loss)",
]
chart.plot(data, labels="{point.y:,:0f}", legend=False)
chart