Can setOption rewrite dataview in echart?

problem description

dataview optionToContentjsonsuccesssetOptiondataviewdataviewajax

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)
this is the Ajax part of the code, the series part can be returned successfully. But dataview did not respond and could not get

$.ajax({
type: "get",
url: "http://localhost:8080/market/some/test",//
dataType: "json",        //json
   success: function (data) {

       var arr = new Array();
       for(var i=0;i<data.length;iPP){
           arr[i]=new Array();
          arr[i][0]=data[i].open;
          arr[i][1]=data[i].close;
          arr[i][2]=data[i].min;
          arr[i][3]=data[i].max;

       }
       myChart.hideLoading();    //
       myChart.setOption({    //

           series: [{
               // 
               name: "K", //
               data: arr
           }],
           toolbox: {
               dataView: {
                   show: true,
                   readOnly: true,
                   optionToContent: function (opt) {
                       let axisData = opt.xAxis[0].data;

                       let table = "<table style="width:100%;text-align:center" class="table table-bordered table-striped"><tbody><tr>"
                           + "<td></td>"
                           + "<td></td>"
                           + "<td></td>"
                           + "<td></td>"
                           + "<td></td>"
                           + "</tr>";
                       for (let i = 0, l = axisData.length; i < l; iPP) {
                           table += "<tr>"
                               + "<td>" + axisData[i] + "</td>"
                               + "<td>" + arr[i][0] + "</td>"
                               + "<td>" + arr[i][0] + "</td>"
                               + "<td>" + arr[i][0] + "</td>"
                               + "<td>" + arr[i][0] + "</td>"
                               + "</tr>";
                       }
                       table += "</tbody></table>";
                       return table;


                   }
               },
           }
       });
   },

what result do you expect? What is the error message actually seen?

Aug.09,2021

dataView should be in feature, not directly under toolbox.


http://www.echartsjs.com/opti.
toolbox.feature.dataView

myChart.setOption({ 
    ...,
    toolbox:{
        feature:{
            dataView:...
        }
    }
})
Menu