import echarts from 'echarts' /** * @description 生成echarts 渐变色 */ export const generateLineGraphic = (startColor, endColor) => { return new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: startColor }, { offset: 1, color: endColor } ]) } /** * 生成分析图hover dom */ export const generateDiagramsHoveDom = (options) => { return `
${options[0].value}
` } /** * @description 获取地图的hover item元素 * @param {*} title * @param {*} value * @returns */ export const getMapDataItem = (title, value = 0) => { return `
  • ${title} ${value}
  • ` } /** * @description */ export const generateMapHoveDom = (options) => { let currentData = options.data if (currentData && typeof currentData.value === 'string') { currentData = JSON.parse(currentData.value) } else { currentData = [{}, {}, {}, {}] } return `

    ${options.name}

    ` } /** * @description 生成默认的统计数据 */ export const getDefaultBarData = () => { const res = {} for (let i = 1; i <= 12; i++) { res[i] = 0 } return res }