Class: Shadcn::Chart::Bar::Component
- Inherits:
-
Cartesian::Component
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Cartesian::Component
- Shadcn::Chart::Bar::Component
- Defined in:
- app/components/shadcn/chart/bar/component.rb
Overview
Upstream's "Bar Chart" and "Bar Chart - Stacked", drawn on the server.
chart.(data: { "January" => { desktop: 186, mobile: 80 } })
data: is a Hash of category to a Hash of series to number — one
each_with_object away from group(:month, :platform).sum(:visits).
Constant Summary collapse
- RADIUS =
radius={4}, which upstream's bar examples pass at the call site in the docs. Nothing of recharts is vendored here, so unlike a class string this is checked against the rendered example and not againstvendor/. 4
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#stacked ⇒ Object
readonly
Returns the value of attribute stacked.
Attributes inherited from Cartesian::Component
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
-
#initialize(stacked: false, **attributes) ⇒ Component
constructor
stacked:lives here and not on the frame because it is a bar's question.
Methods inherited from Cartesian::Component
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #element_attributes, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(stacked: false, **attributes) ⇒ Component
stacked: lives here and not on the frame because it is a bar's
question. A stacked line would need cumulative points, and Plot
does not compute them — so the option is absent where it would lie.
26 27 28 29 |
# File 'app/components/shadcn/chart/bar/component.rb', line 26 def initialize(stacked: false, **attributes) @stacked = stacked super(**attributes) end |
Instance Attribute Details
#stacked ⇒ Object (readonly)
Returns the value of attribute stacked.
21 22 23 |
# File 'app/components/shadcn/chart/bar/component.rb', line 21 def stacked @stacked end |