Basic Pie Chart
Mix.install([
{:plotly_ex, "~> 0.3"},
{:kino, "~> 0.18"}
])
Section
Create a pie chart with Pie.new(labels:, values:). Plotly automatically
calculates the percentage for each slice.
alias Plotly.{Figure, Pie}
Figure.new()
|> Figure.add_trace(
Pie.new(
labels: ["Residential", "Non-Residential", "Utility"],
values: [19, 26, 55]
)
)
|> Figure.update_layout(
title: "Basic Pie Chart",
height: 400,
width: 500
)
|> Plotly.show()