ljgx opened a new issue, #21129:
URL: https://github.com/apache/echarts/issues/21129

   ### Version
   
   5.3.3
   
   ### Link to Minimal Reproduction
   
   https://github.com/ecomfe/echarts-for-weixin/issues/962
   
   ### Steps to Reproduce
   
   报错内容
   
   <img width="606" height="230" alt="Image" 
src="https://github.com/user-attachments/assets/b8a65678-9adb-48af-bdc7-c1faa4124322";
 />
   
   wxml
   ```
   <button bind:tap="setChartData">改变图表参数</button>
   <view class="chart-fa-view">
     <ec-canvas id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ec 
}}"></ec-canvas>
   </view>
   ```
   
   wxss
   ```
   .chart-fa-view {
     width: 100%;
     height: 566rpx;
   }
   #mychart-dom-line {
     width: 100%;
     height: 566rpx;
   }
   ```
   js
   ```
   import * as echarts from "../../ec-canvas/echarts";
   
   const app = getApp();
   let customChart = null;
   function initChart(canvas, width, height, dpr) {
     const chart = echarts.init(canvas, null, {
       width: width,
       height: height,
       devicePixelRatio: dpr, // new
     });
     canvas.setChart(chart);
   
     var option = {
       title: {
         text: "测试下面legend的红色区域不应被裁剪",
         left: "center",
       },
       legend: {
         data: ["A", "B", "C"],
         top: 50,
         left: "center",
         backgroundColor: "red",
         z: 100,
       },
       grid: {
         containLabel: true,
       },
       tooltip: {
         show: true,
         trigger: "axis",
       },
       xAxis: {
         type: "category",
         boundaryGap: false,
         axisTick: {
           show: false,
         },
         axisLabel: {
           color: "#86909C",
         },
         // show: false
       },
       yAxis: {
         x: "center",
         name: "",
         type: "value",
         splitLine: {
           lineStyle: {
             color: "#ccc",
             type: "dashed",
           },
         },
         // show: false
       },
       dataset: {
         source: [
           ["时间", "A", "B"],
           ["周一", 43.3, 85.8],
           ["周二", 83.1, 73.4],
           ["周三", 86.4, 65.2],
           ["周四", 72.4, 53.9],
         ],
       },
       series: [
         {
           name: "A",
           type: "line",
           smooth: true,
         },
         {
           name: "B",
           type: "line",
           smooth: true,
         },
       ],
     };
     chart.setOption(option);
     customChart = chart;
     return chart;
   }
   function getSeries(val) {
     if (val % 2 === 0) {
       return [
         {
           name: "A",
           type: "line",
           smooth: true,
         },
         {
           name: "B",
           type: "line",
           smooth: true,
         },
       ];
     }
     return [
       {
         name: "C",
         type: "line",
         smooth: true,
       },
     ];
   }
   function getData(val) {
     if (val % 2 === 0) {
       return [
         ["时间", "A", "B"],
         ["周一", 43.3, 85.8],
         ["周二", 83.1, 73.4],
         ["周三", 86.4, 65.2],
         ["周四", 72.4, 53.9],
       ];
     }
     return [
       ["时间", "C"],
       ["周一", 90],
       ["周二", 78],
       ["周三", 51],
       ["周四", 12],
     ];
   }
   
   Page({
     onShareAppMessage: function (res) {
       return {
         title: "ECharts 可以在微信小程序中使用啦!",
         path: "/pages/index/index",
         success: function () {},
         fail: function () {},
       };
     },
     data: {
       ec: {
         onInit: initChart,
       },
       a: 0,
     },
   
     onReady() {},
     setChartData() {
       this.data.a++;
       customChart.setOption(
         {
           series: getSeries(this.data.a),
           dataset: {
             source: getData(this.data.a),
           },
         },
         true
       );
     },
   });
   ```
   
   ### Current Behavior
   
   当图表需要更换 series ,setOption 之后,图表会带上没更换之前的 serises  我setOption  设置notMerge 直接报错
   
   ### Expected Behavior
   
   设置 notMerge不报错
   
   ### Environment
   
   ```markdown
   - OS:
   - Browser:
   - Framework:
   ```
   
   ### Any additional comments?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to