Contex.SimplePie (ContEx v0.4.0) View Source
Generates a simple pie chart from an array of tuples like {"Cat", 10.0}.
Usage:
SimplePie.new([{"Cat", 10.0}, {"Dog", 20.0}, {"Hamster", 5.0}])
|> QuickPie.colours(["aa0000", "00aa00", "0000aa"]) # Optional - only if you don't like the defaults
|> QuickPipe.draw() # Emits svg pie chartThe colours are using default from Contex.CategoryColourScale.new/1 by names in tuples.
The size defaults to 50 pixels high and wide. You can override by updating
:height directly in the SimplePie struct before call draw/1.
The height and width of pie chart is always same, therefor set only height is enough.
Link to this section Summary
Functions
Update the colour palette used for the slices.
Renders the SimplePie to svg, including the svg wrapper, as a string or improper string list that is marked safe.
Create a new SimplePie struct from list of tuples.
Link to this section Types
Specs
Link to this section Functions
Specs
colours(t(), Contex.CategoryColourScale.colour_palette()) :: t()
Update the colour palette used for the slices.
Specs
Renders the SimplePie to svg, including the svg wrapper, as a string or improper string list that is marked safe.
Specs
Create a new SimplePie struct from list of tuples.