ECharts 折线图显示折线点数据并自定义折线点数据,同时不显示折线点

    科技2026-03-15  3

    1 使用详解

    (1)series.lable.show

    说明:显示折线点数据。

    (2)series.label.formatter

    说明:自定义折线点数据。

    (3)series.symbolSize

    说明:设置折线点大小。

    2 原始效果图

    3 实现代码

    <body> <!-- 为ECharts准备一个具备大小(宽高)的Dom --> <div id="main" style="width: 600px;height:400px;"></div> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); // 指定图表的配置项和数据 var option = { tooltip: {}, legend: { data:['占比'] }, xAxis: { data: ["1月","2月","3月","4月","5月","6月"] }, yAxis: {}, series: [{ name: '占比', type: 'line', smooth:true, data: [5, 20, 36, 10, 10, 20], label:{ show:true, formatter:function(data){ return data.value+'%'; } }, symbolSize:1 }] } // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); </script> </body>

    4 最终效果图

    Processed: 0.015, SQL: 9