Powered by AppSignal & Oban Pro

Multi Funnelarea

19_multi_funnelarea.livemd

Multi Funnelarea

Mix.install([
  {:plotly_ex, "~> 0.3"},
  {:kino, "~> 0.18"}
])

Section

Multiple Funnelarea traces are positioned via domain: %{x: [...], y: [...]}. scalegroup: links traces so their funnel widths scale relative to each other — traces in "first" share one scale, "second" another. title: %{position:, text:} labels each panel.

alias Plotly.{Figure, Funnelarea}

Figure.new()
|> Figure.add_trace(
  Funnelarea.new(
    scalegroup: "first",
    values: [500, 450, 340, 230, 220, 110],
    textinfo: "value",
    title: %{position: "top center", text: "Sales for Sale Person A in U.S."},
    domain: %{x: [0, 0.5], y: [0, 0.5]}
  )
)
|> Figure.add_trace(
  Funnelarea.new(
    scalegroup: "first",
    values: [600, 500, 400, 300, 200, 100],
    textinfo: "value",
    title: %{position: "top center", text: "Sales of Sale Person B in Canada"},
    domain: %{x: [0, 0.5], y: [0.55, 1]}
  )
)
|> Figure.add_trace(
  Funnelarea.new(
    scalegroup: "second",
    values: [510, 480, 440, 330, 220, 100],
    textinfo: "value",
    title: %{position: "top left", text: "Sales of Sale Person A in Canada"},
    domain: %{x: [0.55, 1], y: [0, 0.5]}
  )
)
|> Figure.add_trace(
  Funnelarea.new(
    scalegroup: "second",
    values: [360, 250, 240, 130, 120, 60],
    textinfo: "value",
    title: %{position: "top left", text: "Sales of Sale Person B in U.S."},
    domain: %{x: [0.55, 1], y: [0.55, 1]}
  )
)
|> Figure.update_layout(width: 600)
|> Plotly.show()