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(line): axis pointer highlights data outside of chart #11360 #11548

Merged
merged 2 commits into from
Nov 6, 2019
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
5 changes: 5 additions & 0 deletions src/chart/line/LineView.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ export default ChartView.extend({
clipShapeForSymbol.r1 += 0.5;
}
}
this._clipShapeForSymbol = clipShapeForSymbol;
// Initialization animation or coordinate system changed
if (
!(polyline && prevCoordSys.type === coordSys.type && step === this._step)
Expand Down Expand Up @@ -521,6 +522,10 @@ export default ChartView.extend({
// Null data
return;
}
// fix #11360: should't draw symbol outside clipShapeForSymbol
if (this._clipShapeForSymbol && !this._clipShapeForSymbol.contain(pt[0], pt[1])) {
return;
}
symbol = new SymbolClz(data, dataIndex);
symbol.position = pt;
symbol.setZ(
Expand Down
61 changes: 61 additions & 0 deletions test/clip.html
Original file line number Diff line number Diff line change
Expand Up @@ -1330,5 +1330,66 @@
});
});
</script>



<div class="chart" id="line-highlight-point"></div>
<script>
require([
'echarts'
], function (echarts) {
var option = {
grid: {
top: 130,
bottom: 80
},
dataZoom: [{
type: 'slider',
show: true
},
{
type: 'inside'
}
],
xAxis: {
type: 'category',
name: 'x',
splitLine: {
show: false
},
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
axisPointer: {
show: 'true'
},
},
yAxis: {
name: 'y',
max: 20
},
tooltip: {
trigger: 'item'
},
series: [{
name: 'B',
type: 'line',
clip: true,
data: [1, 2, 4, 8, 16, 32, 64, 128, 256]
}]
};
var chart = testHelper.create(echarts, 'line-highlight-point', {
title: 'Line Clip on emphasis',
option: option,
height: 400,
buttons: makeToggleChartButtons(function (clip) {
chart.setOption({
series: [{
clip: clip
}]
})
})
});
})
</script>

</body>
</html>