<template>
  <div class="two-line-chart">
    <LineChart :option="option" />
  </div>
</template>

<script>
import { LineChart } from "dr-vue-echarts";
export default {
  name: "TwoLineChart",
  components: {
    [LineChart.name]: LineChart,
  },
  data() {
    return {
      option: {
        xAxis: {
          type: "category",
          splitLine: {
            show: false,
          },
          //座標軸線的設置
          axisLine: {
            lineStyle: {
              color: "gray",
              width: 2,
            },
          },
          //座標軸的刻度顏色
          axisLabel: {
            color: "black",
          },
          boundaryGap: false,
          data: this.$t("studentWeb.twoLineChart.xAxisData"),
        },
        yAxis: {
          type: "value",
          splitLine: {
            lineStyle: {
              color: "gray",
            },
          },

          //座標軸的刻度顏色
          axisLabel: {
            color: "black",
          },
        },
        grid: {
          top: "25%",
          left: "10%",
          right: "12%",
          bottom: "0%",
          containLabel: true,
        },
        tooltip: {
          trigger: "axis",
          padding: [4, 12],
          backgroundColor: "white",
          textStyle: {
            color: "black",
            fontFamily: "Ariel",
            fontWeight: "bolder",
          },
          axisPointer: {
            lineStyle: {
              color: "black",
              type: "dashed",
            },
          },

          formatter:
            localStorage.getItem('lang') == "tw"
              ? `星期{b0}：</br> 我：<span class='mytooltipHrsColor'>{c0}</span> 分鐘 </br>全年級：<span style='color:#fa6400;font-size:16pt'>{c1}</span>分鐘  `
              : `{b0}：</br> Me：<span class='mytooltipHrsColor'>{c0}</span> min </br>3rd Grade： <span style='color:#fa6400;font-size:16pt'>{c1}</span> min `, //修改tooltip模板變量
        },
        series: [
          {
            data: [90, 70, 120, 93, 180, 133, 180],
            type: "line",
            //處理線上的點點
            symbol: "roundRect",
            symbolSize: [10, 10],
            itemStyle: {
              color: "#29856C",
            },
            //處理線上的點點
            smooth: true,
            lineStyle: {
              color: "#29856C",
              width: 3,
            },
          },
          {
            data: [70, 170, 20, 103, 80, 153, 97],
            type: "line",
            //處理線上的點點
            symbol: "roundRect",
            symbolSize: [10, 10],
            itemStyle: {
              color: "#FA6400",
            },
            //處理線上的點點
            smooth: true,
            lineStyle: {
              color: "#FA6400",
              width: 3,
            },
          },
        ],
      },
    };
  },
};
</script>

<style>
</style>