| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (config.$cache) { |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | |
| | | let _valfield = 'value' |
| | | let _typefield = 'key' |
| | | let colorIndex = 0 |
| | | let barcolors = {} |
| | | |
| | | if (plot.datatype === 'statistics') { |
| | | _valfield = plot.InfoValue |
| | |
| | | if (plot.enabled === 'true') { |
| | | this.customrender(data) |
| | | return |
| | | } |
| | | |
| | | if (plot.barcolors && plot.barcolors.length > 0 && plot.Yaxis.length === 1) { |
| | | data.forEach((item, i) => { |
| | | if (plot.barcolors[i]) { |
| | | barcolors[item[plot.Xaxis]] = plot.barcolors[i].color |
| | | } |
| | | }) |
| | | } else { |
| | | barcolors = null |
| | | } |
| | | |
| | | const ds = new DataSet() |
| | |
| | | |
| | | if (plot.$colors) { |
| | | let limit = chartColors.length |
| | | _chart.color(_typefield, (key) => { |
| | | if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | |
| | | if (barcolors) { |
| | | _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { |
| | | if (barcolors[label]) { |
| | | return barcolors[label] |
| | | } else if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | | _chart.color(`${_typefield}`, (key) => { |
| | | if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | _chart.color(_typefield) |
| | | } |
| | |
| | | |
| | | if (plot.$colors) { |
| | | let limit = chartColors.length |
| | | _chart.color(_typefield, (key) => { |
| | | if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | if (barcolors) { |
| | | _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { |
| | | if (barcolors[label]) { |
| | | return barcolors[label] |
| | | } else if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | | _chart.color(`${_typefield}`, (key) => { |
| | | if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | _chart.color(_typefield) |
| | | } |
| | |
| | | let menu = null |
| | | |
| | | if (plot.menus && plot.menus.length > 0) { |
| | | let s = data[plot.menuType] || '' |
| | | let s = data[plot.menuType] + '' |
| | | plot.menus.forEach(m => { |
| | | if (s !== m.sign) return |
| | | menu = m |