class

Opal::UI::PieChart

Inherits Opal::UI::Element < Opal::UI::Themable < Reference < Object

Renders interactive 2D circular or donut PieCharts with slices, percentage breakdowns, TrueColor fills, and legend keys.

Constructors

new(slices : Array(PieSlice) = [] of PieSlice, title : String | Nil = nil, donut : Bool = false, inner_radius_ratio : Float64 = 0.42)
Source

Class methods

to_string(slices : Array(PieSlice), title : String | Nil = nil, donut : Bool = false, width : Int32 | Nil = nil, height : Int32 = 12, inner_radius_ratio : Float64 = 0.42, color : Bool | Nil = nil, theme : Theme | Nil = nil) : String

Class convenience method returning styled pie chart string

Source
to_string(raw_slices : Array(Tuple(String, Float64)), title : String | Nil = nil, donut : Bool = false, width : Int32 | Nil = nil, height : Int32 = 12, inner_radius_ratio : Float64 = 0.42, color : Bool | Nil = nil, theme : Theme | Nil = nil) : String

Overload accepting tuples of {label, value}

Source

Instance methods

add(label : String, value : Float64, color : Color | Symbol | String = :cyan, formatted_value : String | Nil = nil) : Nil
Source
donut=(donut : Bool)
Source
donut?
Source
inner_radius_ratio
Source
inner_radius_ratio=(inner_radius_ratio : Float64)
Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
slices
Source
title
Source
total_value
Source