New file |
| | |
| | | export const chartFontsize = (res) => { |
| | | let clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; |
| | | if (!clientWidth) return; |
| | | let fontSize = clientWidth / 1920; |
| | | return res * fontSize; |
| | | } |
| | |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | //引入提示框 |
| | | import "echarts/lib/component/tooltip"; |
| | | //引入chart字体自适应 |
| | | import { |
| | | chartFontsize |
| | | } from '@/assets/js/chartFontsize' |
| | | export default { |
| | | name: "abeamProChart", |
| | | chart: "", |
| | |
| | | this.$options.chart.setOption(opt); |
| | | }, |
| | | setData(sendData) { |
| | | this.$options.chartData = sendData; |
| | | let dataColor = sendData.color; |
| | | let bgColor = sendData.bgColor; |
| | | let yData = sendData.yData; |
| | |
| | | axisLabel: { |
| | | show: true, |
| | | textStyle: { |
| | | color: '#fff' |
| | | color: '#fff', |
| | | fontSize: chartFontsize(12), |
| | | }, |
| | | }, |
| | | splitLine: { |
| | |
| | | axisLabel: { |
| | | show: true, |
| | | textStyle: { |
| | | color: '#fff' |
| | | color: '#fff', |
| | | fontSize: chartFontsize(12), |
| | | }, |
| | | }, |
| | | splitLine: { |
| | |
| | | normal: { |
| | | show: true, |
| | | position: 'insideRight', |
| | | fontSize: 20, |
| | | fontSize: chartFontsize(20), |
| | | color: '#021750' |
| | | } |
| | | }, |
| | |
| | | }, |
| | | resize() { |
| | | this.$options.chart.resize(); |
| | | this.setData(this.$options.chartData); |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | //引入提示框 |
| | | import "echarts/lib/component/tooltip"; |
| | | //引入chart字体自适应 |
| | | import { |
| | | chartFontsize |
| | | } from '@/assets/js/chartFontsize' |
| | | const pieImg = require('../../assets/images/rectifier-img.png'); |
| | | export default { |
| | | name: "imgPieChart", |
| | |
| | | this.$options.chart.setOption(opt); |
| | | }, |
| | | setData(sendData) { |
| | | this.$options.chartData = sendData |
| | | this.$options.chartData = sendData; |
| | | let imgWidth = this.$refs.chart.clientWidth * 0.14; |
| | | let imgheight = imgWidth / 0.82; |
| | | let centerx = this.$refs.chart.clientWidth / 2; |
| | |
| | | rich: { |
| | | yellow: { |
| | | color: "#f67f21", |
| | | fontSize: 16, |
| | | fontSize: chartFontsize(16), |
| | | fontWeight: '600', |
| | | padding: [4, 0, 0, 0], |
| | | padding: [chartFontsize(4), 0, 0, 0], |
| | | align: 'center' |
| | | }, |
| | | white: { |
| | | color: "#ffffff", |
| | | align: 'center', |
| | | fontSize: 12, |
| | | padding: 4 |
| | | fontSize: chartFontsize(12), |
| | | padding: chartFontsize(4) |
| | | }, |
| | | hr: { |
| | | borderColor: '#007ed3', |
| | |
| | | }, |
| | | resize() { |
| | | this.$options.chart.resize(); |
| | | this.setData(this.$options.chartData) |
| | | this.setData(this.$options.chartData); |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | |
| | | import { |
| | | chartFontsize |
| | | } from '@/assets/js/chartFontsize' |
| | | export default { |
| | | name: "latticeBar", |
| | | chart: "", |
| | | chartData: [], |
| | | props: { |
| | | id: { |
| | | require: true, |
| | |
| | | this.$options.chart.setOption(opt); |
| | | }, |
| | | setData(sendData) { |
| | | this.$options.chartData = sendData; |
| | | let option = { |
| | | tooltip: { |
| | | trigger: 'axis', |
| | |
| | | }, |
| | | axisLabel: { |
| | | color: '#FFFFFF', |
| | | fontSize: 12, |
| | | fontSize: chartFontsize(12), |
| | | interval: 0 |
| | | } |
| | | }], |
| | |
| | | }, |
| | | axisLabel: { |
| | | textStyle: { |
| | | color: '#FFFFFF' |
| | | color: '#FFFFFF', |
| | | fontSize: chartFontsize(12), |
| | | }, |
| | | }, |
| | | }], |
| | |
| | | }, |
| | | resize() { |
| | | this.$options.chart.resize(); |
| | | this.setData(this.$options.chartData); |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | //引入提示框 |
| | | import "echarts/lib/component/tooltip"; |
| | | //引入chart字体自适应 |
| | | import { |
| | | chartFontsize |
| | | } from '@/assets/js/chartFontsize' |
| | | export default { |
| | | name: "prossPieChart", |
| | | chart: "", |
| | | chartData: [], |
| | | props: { |
| | | id: { |
| | | require: true, |
| | |
| | | this.$options.chart.setOption(opt); |
| | | }, |
| | | setData(sendData) { |
| | | this.$options.chartData = sendData; |
| | | let color = sendData.color; |
| | | let data = sendData.data; |
| | | let text; |
| | |
| | | textStyle: { |
| | | rich: { |
| | | a: { |
| | | fontSize: 16, |
| | | fontSize: chartFontsize(16), |
| | | color: '#ffffff' |
| | | }, |
| | | } |
| | |
| | | normal: { |
| | | show: true, |
| | | position: "center", |
| | | fontSize: 14, |
| | | fontSize: chartFontsize(24), |
| | | fontWeight: '600', |
| | | color: '#ffffff' |
| | | } |
| | |
| | | }, |
| | | resize() { |
| | | this.$options.chart.resize(); |
| | | } |
| | | this.setData(this.$options.chartData); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | // 基于准备好的dom,初始化echarts实例 |
| | |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | //引入提示框 |
| | | import "echarts/lib/component/tooltip"; |
| | | //引入chart字体自适应 |
| | | import { |
| | | chartFontsize |
| | | } from '@/assets/js/chartFontsize' |
| | | export default { |
| | | name: "triangleBarChart", |
| | | chart: "", |
| | |
| | | this.$options.chart.setOption(opt); |
| | | }, |
| | | setData(sendData) { |
| | | this.$options.chartData = sendData; |
| | | let inData = [] |
| | | sendData.data.map(item => { |
| | | inData.push(item - 10); |
| | |
| | | }, |
| | | axisLabel: { |
| | | color: '#FFFFFF', |
| | | fontSize: 12, |
| | | fontSize: chartFontsize(12), |
| | | interval: 0 |
| | | } |
| | | }, { |
| | |
| | | }, |
| | | axisLabel: { |
| | | color: '#FFFFFF', |
| | | fontSize: 12, |
| | | fontSize: chartFontsize(12), |
| | | interval: 0 |
| | | } |
| | | }], |
| | |
| | | }, |
| | | axisLabel: { |
| | | textStyle: { |
| | | color: '#FFFFFF' |
| | | color: '#FFFFFF', |
| | | fontSize: chartFontsize(12) |
| | | }, |
| | | }, |
| | | }], |
| | |
| | | }, |
| | | resize() { |
| | | this.$options.chart.resize(); |
| | | this.setData(this.$options.chartData); |
| | | } |
| | | }, |
| | | mounted() { |