Sha256: 987e6c62a775a26cf3d430a808702bc0c9c5470159d666b3d3ffada31436112d

Contents?: true

Size: 1.52 KB

Versions: 51

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbLineGraph
    class LineGraph
      include Playbook::Props

      partial "pb_line_graph/line_graph"

      prop :axis_title
      prop :chart_data, type: Playbook::Props::Array,
                        default: []
      prop :gradient, type: Playbook::Props::Boolean,
                      default: false
      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
        gradient ? "area" : "line"
      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_line_graph")
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.16.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.15.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.15.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.14.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.11.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.11.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.10.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.9.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.8.4 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.8.3 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.8.2 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.8.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.8.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.7.0.pre.alpha1 app/pb_kits/playbook/pb_line_graph/line_graph.rb