Sha256: 306079632a13b8df34b4b0c6ee6407ee130a2caf72d22a2113c0b3af29059ec2

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 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: {},
            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

1 entries across 1 versions & 1 rubygems

Version Path
thecore_ui_commons-3.2.3 lib/echarts/vector.rb