Sha256: d6aed2d53097cd35918cb7a548975b906ae562a8486d1b2f5e0144c9b7f74263

Contents?: true

Size: 1.93 KB

Versions: 523

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbGauge
    class Gauge < Playbook::KitBase
      prop :chart_data, type: Playbook::Props::Array,
                        default: [{ name: "Name", value: 0 }]
      prop :custom_options, default: {}
      prop :style, type: Playbook::Props::Enum,
                   values: %w[solidgauge],
                   default: "solidgauge"
      prop :title, type: Playbook::Props::String, default: ""
      prop :prefix, type: Playbook::Props::String, default: ""
      prop :suffix, type: Playbook::Props::String, default: ""
      prop :height, type: Playbook::Props::String, default: nil
      prop :tooltip_html, default: '<span style="font-weight: bold; color:{point.color};">●</span>
                                      {point.name}: ' + '<b>{point.y}
                                    </b>'
      prop :full_circle, type: Playbook::Props::Boolean, default: false
      prop :show_labels, type: Playbook::Props::Boolean, default: false
      prop :disable_animation, type: Playbook::Props::Boolean, default: false
      prop :min, type: Playbook::Props::Numeric, default: 0
      prop :max, type: Playbook::Props::Numeric, default: 100
      prop :colors, type: Playbook::Props::Array, default: []

      def standard_options
        {
          id: id,
          chartData: chart_data,
          circumference: full_circle ? [0, 360] : [-100, 100],
          dark: dark ? "dark" : "",
          disableAnimation: disable_animation,
          height: height,
          min: min,
          max: max,
          title: title,
          suffix: suffix,
          prefix: prefix,
          showLabels: show_labels,
          style: style,
          tooltipHtml: tooltip_html,
          type: style,
          colors: colors,
        }
      end

      def chart_options
        standard_options.deep_merge(custom_options)
      end

      def classname
        generate_classname("pb_gauge_kit")
      end
    end
  end
end

Version data entries

523 entries across 523 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.6 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.12.0.pre.rc.5 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 app/pb_kits/playbook/pb_gauge/gauge.rb