/* * @Author: your name * @Date: 2021-10-12 11:16:44 * @LastEditTime: 2021-10-29 20:16:33 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/src/views/BrandInsight/popularEvents/opt.js */ // import * as echarts from "echarts"; // const data = [ // [['24:00',37.5,100000000,'A7','车展'],['16:00',11.46,100000000,'A5','车展'],['12:00',16,100000000,'A4','车展'],['08:00',16.92,100000000,'A3','车展'],['04:00',22.5,100000000,'A2','车展'],['00:00',11.11,100000000,'A1','车展']], // [['24:00',48.21,150000000,'B7','新车上市'],['20:00',50,150000000,'B6','新车上市'],['16:00',67.7,150000000,'B5','新车上市'],['12:00',31,150000000,'B4','新车上市'],['08:00',43.85,150000000,'B3','新车上市'],['04:00',39.17,150000000,'B2','新车上市'],['00:00',46.67,150000000,'B1','新车上市']], // [['24:00',10.71,200000000,'C7','3-5年经验'],['20:00',50,200000000,'C6','3-5年经验'],['16:00',14.58,200000000,'C5','3-5年经验'],['12:00',37,200000000,'C4','3-5年经验'],['08:00',24.62,200000000,'C3','3-5年经验'],['04:00',28.33,200000000,'C2','3-5年经验'],['00:00',31.11,200000000,'C1','3-5年经验']], // [['24:00',3.57,250000000,'D7','5-7年经验'],['16:00',5.21,250000000,'D5','5-7年经验'],['12:00',12,250000000,'D4','5-7年经验'],['08:00',12.31,250000000,'D3','5-7年经验'],['04:00',6.67,250000000,'D2','5-7年经验'],['00:00',11.11,250000000,'D1','5-7年经验']], // [['12:00',4,300000000,'E4','7-10年经验'],['08:00',0.77,300000000,'E3','7-10年经验'],['04:00',0.83,300000000,'E2','7-10年经验']], // [['16:00',1.04,350000000,'F5','10年以上经验'],['08:00',1.54,350000000,'F3','10年以上经验'],['04:00',2.5,350000000,'F2','10年以上经验']], // ]; // import moment from "moment"; import { bigNumberTransform } from "@/utils/gol/dataTool" function createData(obj = {}) { let arr = []; for (let key in obj) { let o = { name: key, data: obj[key], type: 'scatter', symbolSize: function (data) { return data[2] } } arr.push(o) } return arr } export default function createOpt(ds = {}) { const data = createData(ds) return { title: { show: false, text: '12345' }, legend: { y: 'top', x: 16, icon: 'roundRect', textStyle: { //图例文字的样式 color: '#fff' } }, grid: { left: 16, right: '5%', bottom: 10, top: 42, containLabel: true }, tooltip: { trigger: "item", backgroundColor: "#08182F", color: "#fff", borderColor: "#3373CC", textStyle: { color: "#fff", //设置文字颜色 }, extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;", formatter: (p) => { let data = p.data; return `${data[5]}-${data[3]}
${data[4]}
${data[0]}
影响力:${data[2]}`; } }, xAxis: { type: 'time', boundaryGap: false, axisTick: { show: false, }, axisLine: { show: false, lineStyle: { color: "#fff", }, }, splitLine: { show: false }, // data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'], axisLabel : { // formatter: (value) => { // var str= moment.utc(value).format('HH:mm'); // // let str = value.substring(10,16) // return str; // } }, }, yAxis: { type: 'value', axisLine: { show: false, lineStyle: { color: "#fff", }, }, axisLabel: { formatter: (value) => { let str = bigNumberTransform(value); return str; } }, splitLine: { lineStyle: { type: "dashed", // y轴分割线类型 color: "#012b4b", }, }, }, series: data }; }