Sha256: 02a5fd4e3f405dfd27cce295c1d9d40065ca61de9e63d1d6e614e277e4b88f65

Contents?: true

Size: 1.72 KB

Versions: 6

Compression:

Stored size: 1.72 KB

Contents

module Echarts
  module Vector
    def self.get_config(x, value, min, max, lower_bound, upper_bound, title, subtitle, xLabel, yLabel, color_min = "limegreen", color_max = "tomato", color_generic = "dodgerblue")
      # Rails.logger.debug("X: #{x.inspect}")
      {
        grid: {
          top: 80,
        },
        title: {
          text: title,
          subtext: subtitle,
        },
        toolbox: {
          top: 'middle',
          right: 5,
          orient: "vertical",
          feature: {
            saveAsImage: {},
            dataView: {},
            dataZoom: {},
            restore: {},
          },
        },
        tooltip: {
          trigger: "axis",
        },
        xAxis: {
          type: "category",
          data: x,
          name: xLabel,
        },
        yAxis: {
          type: "value",
          name: yLabel,
          min: lower_bound,
          max: upper_bound,
        },
        series: [
          {
            name: "Values",
            data: value,
            type: "line",
            smooth: true,
            # stack: 'Total',
            itemStyle: { color: color_generic },
            markLine: {
              data: [
                # Min  line (create an array repeating the min value for each x value)
                {
                  name: "Min Reference",
                  yAxis: min,
                  lineStyle: { color: color_min },
                },
                # Max line (create an array repeating the max value for each x value)
                {
                  name: "Max Reference",
                  yAxis: max,
                  lineStyle: { color: color_max },
                },
              ],
            },
          },
        ],
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thecore_ui_commons-3.2.15 lib/echarts/vector.rb
thecore_ui_commons-3.2.14 lib/echarts/vector.rb
thecore_ui_commons-3.2.13 lib/echarts/vector.rb
thecore_ui_commons-3.2.12 lib/echarts/vector.rb
thecore_ui_commons-3.2.11 lib/echarts/vector.rb
thecore_ui_commons-3.2.10 lib/echarts/vector.rb