Sha256: 2b6cecbdc3ea2c9612ade61e86db82a673ece1d968cac090553f6bdc9c45d214

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 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")
      {
        grid: {
          top: 80,
        },
        title: {
          text: title,
          subtext: subtitle,
        },
        toolbox: {
          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

5 entries across 5 versions & 1 rubygems

Version Path
thecore_ui_commons-3.2.8 lib/echarts/vector.rb
thecore_ui_commons-3.2.7 lib/echarts/vector.rb
thecore_ui_commons-3.2.6 lib/echarts/vector.rb
thecore_ui_commons-3.2.5 lib/echarts/vector.rb
thecore_ui_commons-3.2.4 lib/echarts/vector.rb