class Opal::UI::Sparkline

Overview

Unicode block sparkline generator for visualizing numeric trends.

Defined in:

opal/ui/components/sparkline.cr

Constant Summary

BLOCKS = [' ', '▂', '▃', '▄', '▅', '▆', '▇', '█']

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Opal::UI::Element

preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32) preferred_size, render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil render

Constructor Detail

def self.new(data : Array(Float64), color : Color | Symbol | String = :cyan, title : String | Nil = nil, min : Float64 | Nil = nil, max : Float64 | Nil = nil) #

[View source]

Class Method Detail

def self.render_to_string(data : Array(Float64), color : Color | Symbol | String = Color.none) : String #

Convenience helper returning sparkline as a string


[View source]

Instance Method Detail

def color : Color #

[View source]
def data : Array(Float64) #

[View source]
def max : Float64 | Nil #

[View source]
def min : Float64 | Nil #

[View source]
def preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32) #

[View source]
def render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil #

[View source]
def title : String | Nil #

[View source]