| | |
| | | }, |
| | | |
| | | drawGridColor(gridViews, texts, factorName) { |
| | | // new Promise((resolve, reject) => { |
| | | // gridViews.forEach((g, i) => { |
| | | // const data = parseFloat(texts[i]); |
| | | // const { color, nextColor, range, nextRange } = |
| | | // Legend.getStandardColorAndNext(factorName, data); |
| | | // const ratio = (data - range) / (nextRange - range); |
| | | // const _color = getColorBetweenTwoColors( |
| | | // color.map((v) => v * 255), |
| | | // nextColor.map((v) => v * 255), |
| | | // ratio |
| | | // ); |
| | | // resolve({ g, _color, color }); |
| | | // }); |
| | | // }).then((res) => { |
| | | // const { g, _color, color } = res; |
| | | // g.setOptions({ |
| | | // fillColor: _color, |
| | | // fillOpacity: color[3] |
| | | // }); |
| | | // }); |
| | | gridViews.forEach((g, i) => { |
| | | const data = parseFloat(texts[i]); |
| | | const { color, nextColor, range, nextRange } = |
| | |
| | | fillOpacity: color[3] |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | drawGridColorCustom(gridViews, texts) { |
| | | var max,min |
| | | texts.forEach(t => { |
| | | if (!max || t > max) { |
| | | max = t |
| | | } |
| | | if (!min || t < min) { |
| | | min = t |
| | | } |
| | | }); |
| | | gridViews.forEach((g, i) => { |
| | | const data = parseFloat(texts[i]); |
| | | const { color, nextColor, range, nextRange } = |
| | | Legend.getCustomColorAndNext(data, min, max); |
| | | const ratio = (data - range) / (nextRange - range); |
| | | |
| | | const _color = getColorBetweenTwoColors( |
| | | color.map((v) => v * 255), |
| | | nextColor.map((v) => v * 255), |
| | | ratio |
| | | ); |
| | | g.setOptions({ |
| | | fillColor: _color, |
| | | fillOpacity: color[3] |
| | | }); |
| | | }); |
| | | }, |
| | | }; |