You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2022/01/07 06:21:00 UTC
[echarts] branch fix-16094 created (now 639d78e)
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a change to branch fix-16094
in repository https://gitbox.apache.org/repos/asf/echarts.git.
at 639d78e fix(line): fix endLabel have error when series is filtered.
This branch includes the following new commits:
new 639d78e fix(line): fix endLabel have error when series is filtered.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 01/01: fix(line): fix endLabel have error when series is filtered.
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch fix-16094
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 639d78e704205a94acb2354e24f7aeab3773533d
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Jan 7 14:20:40 2022 +0800
fix(line): fix endLabel have error when series is filtered.
---
src/chart/line/LineView.ts | 10 +++++-
test/line-case.html | 70 ++++++++++++++++++++++++++++++++++++-
test/runTest/actions/__meta__.json | 1 +
test/runTest/actions/line-case.json | 1 +
4 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/src/chart/line/LineView.ts b/src/chart/line/LineView.ts
index 64e388b..df90a45 100644
--- a/src/chart/line/LineView.ts
+++ b/src/chart/line/LineView.ts
@@ -1155,6 +1155,13 @@ class LineView extends ChartView {
if (anyStateShowEndLabel(seriesModel)) {
const data = seriesModel.getData();
const polyline = this._polyline;
+ // series may be filtered.
+ const points = data.getLayout('points');
+ if (!points) {
+ polyline.removeTextContent();
+ this._endLabel = null;
+ return;
+ }
let endLabel = this._endLabel;
if (!endLabel) {
endLabel = this._endLabel = new graphic.Text({
@@ -1166,7 +1173,7 @@ class LineView extends ChartView {
}
// Find last non-NaN data to display data
- const dataIndex = getLastIndexNotNull(data.getLayout('points'));
+ const dataIndex = getLastIndexNotNull(points);
if (dataIndex >= 0) {
setLabelStyle(
polyline,
@@ -1214,6 +1221,7 @@ class LineView extends ChartView {
}
const points = data.getLayout('points');
+
const seriesModel = data.hostModel as LineSeriesModel;
const connectNulls = seriesModel.get('connectNulls');
const precision = endLabelModel.get('precision');
diff --git a/test/line-case.html b/test/line-case.html
index 300ca00..aa54d7c 100644
--- a/test/line-case.html
+++ b/test/line-case.html
@@ -40,6 +40,7 @@ under the License.
<div id="main0"></div>
<div id="main1"></div>
<div id="main2"></div>
+ <div id="main3"></div>
@@ -540,7 +541,74 @@ under the License.
option: option
});
});
- </script>
+ </script>
+
+ <script>
+ require([
+ 'echarts'
+ ], function (echarts) {
+ option = {
+ toolbox: {
+ top: 10,
+ left: 'center',
+ show: true,
+ orient: 'horizontal',
+ showTitle: true,
+ feature: {
+ saveAsImage: {
+ type: 'png',
+ backgroundColor: 'pink',
+ name: 'hwbtest',
+ title: '保存'
+ },
+ restore: {},
+ dataView: {},
+ dataZoom: {}
+ }
+ },
+ grid: {
+ left: '10%',
+ right: '15%',
+ bottom: '15%',
+ },
+ xAxis: {
+ type: 'category',
+ boundaryGap: false,
+ data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
+ },
+ yAxis: {
+ type: 'value'
+ },
+ series: [
+ {
+ name: '邮件营销',
+ type: 'line',
+ data: [110, 132, 101, 134, 90, 230, 210],
+ endLabel: {
+ show:true,
+ formatter: '{a}: {b}'
+ }
+ },
+ {
+ name: '销量',
+ type: 'line',
+ data: [210, 232, 201,234, 290, 240, 230],
+ endLabel: {
+ show:true,
+ formatter: '{a}: {b}'
+ }
+ }
+ ]
+ };
+ var chart = testHelper.create(echarts, 'main3', {
+ title: [
+ 'Should have no error when dataZoom on one points.',
+ 'Case from https://github.com/apache/echarts/issues/16094'
+ ],
+ option: option
+ });
+ });
+ </script>
</body>
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index 5a20cf8..ef3c045 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -118,6 +118,7 @@
"line-animation": 1,
"line-animation-update": 3,
"line-boldWhenHover": 1,
+ "line-case": 1,
"line-crash": 1,
"line-endLabel": 1,
"line-visual2": 1,
diff --git a/test/runTest/actions/line-case.json b/test/runTest/actions/line-case.json
new file mode 100644
index 0000000..318b5d1
--- /dev/null
+++ b/test/runTest/actions/line-case.json
@@ -0,0 +1 @@
+[{"name":"Action 1","ops":[{"type":"mousedown","time":264,"x":423,"y":226},{"type":"mouseup","time":353,"x":423,"y":226},{"time":354,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":426,"x":425,"y":227},{"type":"mousemove","time":626,"x":456,"y":261},{"type":"mousemove","time":826,"x":499,"y":322},{"type":"mousedown","time":936,"x":499,"y":322},{"type":"mousemove","time":1027,"x":495,"y":317},{"type":"mousemove","time":1231,"x":443,"y":252},{"type":"mouseup","time":1403," [...]
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org