const t=`
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
  <head>
    <meta charset="UTF-8">
    <script src="/iframeJs/echarts.min.js"><\/script>
    <script src="/iframeJs/echarts-gl.min.js"><\/script>
    <script src="/iframeJs/jquery.min.js"><\/script>
  </head>
  <body style="height: 100%; margin: 0">
      <div id="container" style="height: 100%"></div>
      <script>

        try {
        let dom = document.getElementById("container");
        let myChart = echarts.init(dom, 'null', {
          renderer: "canvas",
          useDirtyRect: false,
        });
        let option;
       option = {
        backgroundColor: "transparent",
        tooltip: {
          show: true,
        },
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: "bar",
          },
        ],
      };
        // 初始化
        myChart.setOption(option);

        // 动态获取数据
        function getData() {
          $.ajax({
            type: "post",
            async: true, // 异步请求
            url: "http://8.129.212.181:2222/charts/getValues", //请求发送到TestServlet处
            data: {
              count: 7,
            },
            dataType: "json", // 返回数据形式为json
            success: function (res) {
              //请求成功
              if (res.code === 200) {
                option.series[0].data = res.data;
                myChart.clear();
                myChart.setOption(option);
              }
            },
            error: function (errorMsg) {
              console.log(errorMsg);
            },
          });
        }
        window.addEventListener("resize", myChart.resize);
        // 定时器
        // setInterval(getData, 60000);

        } catch(e) {
          // alert('请检查代码是否正确！')
          console.error(e.name, e.message)
        }
      <\/script>
  </body>
</html>
`;export{t as c};
