xkKevin opened a new issue #12584:
URL: https://github.com/apache/incubator-echarts/issues/12584
### Version
4.7.0
### Steps to reproduce
复制我的代码运行之后,点击dataview,进行相应编辑
### What is expected?
1. 点击dataview编辑interval的值为20,刷新之后x轴应该为[0,20,40,60,80,100,120,140,160,180,200]
2. 删除myChart.clear();这一行代码,点击dataview,在textarea中增加一行:tomorrow,150
刷新之后图形应该有8条柱子
3. 加上myChart.clear(); 这一行代码,虽然可以解决2中的问题,但是会报错:Uncaught DOMException: Failed
to execute 'removeChild' on 'Node': The node to be removed is not a child of
this node. 而且加上这一行代码之后,用dataview对数据做修改,刷新后不能使用restore功能了,点击“恢复”会出现空白,什么图都没有!
### What is actually happening?
1. 实际刷新之后x轴是[0,20,200]
2. 实际刷新之后还是只有7条柱子,原先的Mon数据不见了
3. 加上clear后台会报错,而且不能使用restore
---
```
// my code
option = {
toolbox: {
feature: {
dataView: {
readOnly: false,
optionToContent: function(opt) {
console.log(opt);
let xAxis_max = opt.xAxis[0].max ? opt.xAxis[0].max
: "";
let xAxis_interval = opt.xAxis[0].interval ?
opt.xAxis[0].interval : "";
let data_len = opt.series[0].data.length;
var table = `<h5>table data</h5>
<textarea rows='${data_len}' style="width: 100%">`;
for (let i =0;i<data_len;i ){
table = "\n" opt.yAxis[0].data[i] ","
opt.series[0].data[i];
}
table = `</textarea><h5>option config</h5>
max: <input type="text"
value="${xAxis_max}"><br>
interval: <input type="text"
value="${xAxis_interval}">`;
return table
},
contentToOption: function(html, opt) {
let content =
$(html).children("textarea").val().split("\n");
let handle_data = {data:[],yAxis:[]};
content.slice(1).forEach(function(x, index){
let data = x.split(',');
handle_data.yAxis.push(data[0]);
handle_data.data.push(data[1]);
});
opt.series[0].data = handle_data.data;
opt.yAxis[0].data = handle_data.yAxis;
let inputs = $(html).children("input");
if (inputs.eq(0).val()){
opt.xAxis[0].max = inputs.eq(0).val();
}
if (inputs.eq(1).val()){
opt.xAxis[0].interval = inputs.eq(1).val();
}
myChart.clear();
return opt;
}
},
restore: {},
saveAsImage: {
name: name
}
}
},
yAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
xAxis: {
type: 'value',
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar'
}]
};
```
<!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]