123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <div ref="lineChart" style="width: 100%; height: 100%"></div>
- </template>
- <script>
- import * as echarts from "echarts";
- export default {
- props: ['ftrendIcoCount'],
- data() {
- return {
- };
- },
- mounted() {
- this.$nextTick(() => {
- this.initChart();
- });
- },
- beforeUnmount() {
- window.removeEventListener("resize", this.chart);
- },
- methods: {
- //次数分布折线图
- initChart() {
- var chart = echarts.init(this.$refs.lineChart);
- var option;
- // var arr = new Array();
- // for (var i = 0; i < 32; i++) {
- // arr.push(i);
- // }
- var arr=this.ftrendIcoCount[0].listDate;
- option = {
- color: ["#00F4FD", "#FD8F00"],
- tooltip: {
- trigger: "axis",
- },
- // 图列组件
- legend: {
- itemHeight: 10, //改变圆圈大小
- itemWidth: 26, //改变圆圈大小
- itemGap: 30,
- textStyle: {
- color: "#fff",
- },
- left: "10%",
- top: 0,
- },
- grid: {
- left: "0%",
- right: "0%",
- bottom: "0%",
- top: "20%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: true,
- data: arr,
- axisTick: {
- show: false, //去除刻度线
- },
- axisLabel: {
- color: "#fff", // 文本颜色
- },
- axisLine: {
- show: false, // 去除轴线
- },
- },
- yAxis: {
- type: "value",
- axisTick: {
- show: false, //去除刻度线
- },
- axisLabel: {
- color: "#fff", // 文本颜色
- },
- axisLine: {
- show: false, // 去除轴线
- },
- splitNumber: 5,
- splitLine: {
- show: true,
- lineStyle: {
- color: "rgba(255,255,255,0.1)",
- },
- },
- },
- series: [
- {
- // name: "故障数量",
- name:this.ftrendIcoCount[0].name,
- type: "line",
- smooth: false, // 曲线是否平滑显示
- data: this.ftrendIcoCount[0].list,
- // data: [
- // 24, 40, 101, 134, 90, 230, 210, 230, 120, 230, 210, 120, 230, 210,
- // 230, 120, 230, 210, 120, 120, 230, 210, 230, 120, 230, 210, 120,
- // 24, 40, 101, 134, 90, 230,
- // ],
- symbolSize: 6, //拐点圆的大小
- // symbol: 'circle',
- },
- {
- name:this.ftrendIcoCount[1].name,
- type: "line",
- smooth: false, // 曲线是否平滑显示
- data: this.ftrendIcoCount[1].list,
- // data: [
- // 30, 50, 110, 144, 110, 240, 228, 240, 130, 240, 220, 130, 110,
- // 240, 228, 240, 130, 240, 220, 130, 240, 228, 240, 130, 240, 220,
- // 130, 30, 50, 110, 144, 110, 240, 228, 240,
- // ],
- symbolSize: 6, //拐点圆的大小
- // symbol: 'circle',
- },
- ],
- };
- chart.setOption(option);
- window.addEventListener("resize", () => {
- chart.resize();
- });
- this.chart = chart;
- },
- },
- };
- </script>
|