Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lines): lines series shouldn't disappear after setOption({}). (#12836) #12850

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/chart/lines/LinesSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ var LinesSeries = SeriesModel.extend({
},

mergeOption: function (option) {
// The input data may be null/undefined.
option.data = option.data || [];

compatEc2(option);

Expand Down Expand Up @@ -333,4 +331,4 @@ var LinesSeries = SeriesModel.extend({
}
});

export default LinesSeries;
export default LinesSeries;
103 changes: 103 additions & 0 deletions test/lines-mergeOption.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->


<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="lib/esl.js"></script>
<script src="lib/config.js"></script>
<script src="lib/facePrint.js"></script>
<script src="lib/testHelper.js"></script>
<link rel="stylesheet" href="lib/reset.css" />
</head>
<body>
<style>
.test-title {
background: #146402;
color: #fff;
}
</style>


<div id="main0"></div>

<script>

// See <https://github.com/apache/incubator-echarts/issues/12836>

var chart;
var myChart;
var option;

require([
'echarts'
], function (echarts) {
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: [
{
scale: true,
},
],
series: [
{
data: [1320, 1800],
type: 'line'
},
{
type: 'lines',
coordinateSystem: 'cartesian2d',
data: [{
coords: [
['Tue', 1500],
['Thu', 1800]
]
}, {
coords: [
['Fri', 1600],
['Sat', 1400]
]
}]
}
]
};

chart = myChart = testHelper.create(echarts, 'main0', {
title: ['lines series should not disappear after `chart.setOption({})`'],
option: option,
info: option,
button: {
text: 'Click to setOption({})',
onClick: function () {
myChart.setOption({});
}
}
});
});

</script>

</body>
</html>