<template>
    <div ref="chartDom" class="line-chart"></div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import * as echarts from "echarts";
import { lineOption } from "./chartOption.js";
import { deepClone } from "@/common/commonFun";

const chartDom = ref(null);
let myChart = null;

const initData = () => {
    const newOption = deepClone(lineOption);
    myChart.setOption(newOption);
};

onMounted(() => {
    myChart = echarts.init(chartDom.value);
    initData();
});

</script>

<style lang="scss" scoped>
.line-chart {
    width: 100%;
    height: 100%;
}
</style>