Skip to content
Funnel

Funnel

A funnel chart.

Funnel

Usage

from dataviz_mojo import funnel
from dataviz_mojo.plot import save
from dataviz_mojo.theme import Theme

def main() raises:
    var stages: List[String] = ["Impressions", "Clicks", "Add to Cart", "Orders"]
    var counts: List[Float64] = [10000.0, 3200.0, 950.0, 400.0]

    var c = funnel(stages, counts)
    save(c, "docs/src/examples/out_funnel.svg")

Args:

  • categories: One trapezoid per entry – drawn largest-value- first regardless of the given order.
  • values: Each category’s value; every value must be non-negative, and at least one positive.
  • theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – see Theme’s docstring.
  • width: Pixel width of the returned Plot (.size()).
  • height: Pixel height of the returned Plot (.size()).
  • title: The chart’s title, shown above the plot.
  • subtitle: A secondary line shown under the title.
  • x_title: Unused – a funnel chart has no x-axis to label.
  • y_title: Unused – a funnel chart has no y-axis to label.