Sha256: d00ef3d4a4a1c69ede74d8b275433b67b0d96b566ded0d47a50885439b3fcedc

Contents?: true

Size: 1.5 KB

Versions: 73

Compression:

Stored size: 1.5 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,
          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,
        }.to_json.html_safe
      end

      def classname
        generate_classname("pb_line_graph")
      end
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.8.2.pre.alpha1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha14 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.8.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.8.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.7.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.6.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.6.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.5.2 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.5.1 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-6.5.0 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_line_graph/line_graph.rb
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_line_graph/line_graph.rb