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, # Set Upper and Lower bounds to the upper and lower bounds of the data # 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