Sha256: cf074b1a339b4236a269c90184b0e42fd61cf3edc593203bfdbc2940e04aa7d4

Contents?: true

Size: 1.65 KB

Versions: 13

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbBarGraph
    class BarGraph < Playbook::KitBase
      prop :axis_title
      prop :chart_data, type: Playbook::Props::Array,
                        default: []
      prop :orientation, type: Playbook::Props::Enum,
                         values: %w[vertical horizontal],
                         default: "vertical"
      prop :point_start, type: Playbook::Props::Numeric
      prop :subtitle
      prop :title
      prop :x_axis_categories, type: Playbook::Props::Array,
                               default: []
      prop :y_axis_min, type: Playbook::Props::Numeric
      prop :y_axis_max, type: Playbook::Props::Numeric
      prop :legend, type: Playbook::Props::Boolean,
                    default: false
      prop :toggle_legend_click, type: Playbook::Props::Boolean,
                                 default: true
      prop :height
      prop :colors, type: Playbook::Props::Array,
                    default: []

      def chart_type
        orientation == "horizontal" ? "bar" : "column"
      end

      def chart_options
        {
          id: id,
          className: classname,
          chartData: chart_data,
          type: chart_type,
          title: title,
          subtitle: subtitle,
          axisTitle: axis_title,
          pointStart: point_start,
          xAxisCategories: x_axis_categories,
          yAxisMin: y_axis_min,
          yAxisMax: y_axis_max,
          legend: legend,
          toggleLegendClick: toggle_legend_click,
          height: height,
          colors: colors,
        }
      end

      def classname
        generate_classname("pb_bar_graph")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.20.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.19.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.18.2 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.18.1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.18.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.17.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb