Sha256: a33b7ea9aea87e26e0f7b69cf1a350c6c666af45d3b98030405c417ca948a946

Contents?: true

Size: 1.76 KB

Versions: 3

Compression:

Stored size: 1.76 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 :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 chart_options
        {
          id:,
          chartData: chart_data,
          circumference: full_circle ? [0, 360] : [-100, 100],
          dark: dark ? "dark" : "",
          disableAnimation: disable_animation,
          height:,
          min:,
          max:,
          title:,
          suffix:,
          prefix:,
          showLabels: show_labels,
          style:,
          tooltipHtml: tooltip_html,
          type: style,
          colors:,
        }
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-13.21.0.pre.alpha.PLAY12582516 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582515 app/pb_kits/playbook/pb_gauge/gauge.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582514 app/pb_kits/playbook/pb_gauge/gauge.rb