Sha256: bfb4825cc38cf477827180159f1ada69ed88c98b217d04ed53ab40209de74dfa

Contents?: true

Size: 1.54 KB

Versions: 123

Compression:

Stored size: 1.54 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

      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,
        }
      end

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

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.6.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.5.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.4.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.3.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.2.1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.2.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.1.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.0.pre.alphafonts app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.1 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-10.0.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-9.19.0.pre.alpha.pre.fonts2 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-9.19.0 app/pb_kits/playbook/pb_bar_graph/bar_graph.rb
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/pb_bar_graph/bar_graph.rb