123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view style="height: 350upx">
- <l-echart ref="detailedChart"></l-echart>
- </view>
- </template>
- <script setup>
- import * as echarts from "echarts";
- import { onLoad, onShow, onHide, onLaunch, onResize } from "@dcloudio/uni-app";
- import { defineComponent, ref, onMounted, nextTick } from "vue";
- const props = defineProps({
- xAxisDataList: {
- type: Object,
- default: null,
- },
- seriesDataList: {
- type: Object,
- default: null,
- },
- });
- let myChart;
- const detailedChart = ref(null);
- let option = {
- tooltip: {
- trigger: "axis",
- },
- legend: {
- show: false,
- // data: ["邮件营销"],
- },
- grid: {
- top: "8%",
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- axisLabel: {
- color: "rgba(0,0,0,0.2)",
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: "rgba(0,0,0,0.1)",
- },
- },
- axisTick: {
- show: false,
- },
- data: props.xAxisDataList,
- },
- yAxis: {
- type: "value",
- axisLabel: {
- color: "rgba(0,0,0,0.2)",
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: "rgba(0,0,0,0.1)",
- },
- },
- splitLine: {
- lineStyle: {
- color: "rgba(0,0,0,0.1)",
- },
- },
- },
- series: [
- {
- name: "指数",
- type: "line",
- stack: "总量",
- smooth: true,
- itemStyle: {
- color: "rgba(73, 185, 245, 1)",
- },
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(73, 185, 245, 1)",
- },
- {
- offset: 1,
- color: "rgba(73, 185, 245, 0.3)",
- },
- ]),
- },
- data: props.seriesDataList,
- },
- ],
- };
- function initEcharts() {
- myChart = detailedChart.value;
- myChart.init(echarts, (myChart) => {
- myChart.setOption(option);
- });
- }
- onLoad(() => {
- nextTick(() => {
- initEcharts();
- });
- });
- onResize(() => {
- myChart.resize();
- });
- </script>
|