Apache ECharts Basic Example

echarts-basic-example-template

HTML

<!DOCTYPE html>
<html>

  <head>
    <title>Apache ECharts Basic Example</title>
    <meta charset="UTF-8" />
  </head>

  <body>
    <div id="chart-container">
    </div>
    <script src="https://cdn.jsdelivr.net/npm/echarts@6.1/dist/echarts.min.js">
    </script>
  </body>

</html>

CSS

* {
  margin: 0;
  padding: 0;
}

#chart-container {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

JavaScript

const chart = echarts.init(document.getElementById("chart-container"));

chart.setOption({
  xAxis: {
    data: [0, 10]
  },
  yAxis: {
    type: "value"
  },
    series: {
        name: "Test",
        type: "line",
        data: [
            6.35,
            3.06
        ],
        markLine: {
            data: [
                {
                    "yAxis": 1
                },
                {},
                {
                    "yAxis": 3
                },
            ]
        }
    }
});

window.addEventListner('resize', chart.resize);