You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/10/14 04:03:54 UTC
[echarts] 01/01: fix(axis): fix that line & bar charts render
abnormally when `yAxis.max` is set to be a value less than the min value of
the series data.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch fix-yaxis-max
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 052d8ce93eafdccc4ef3d7293c6d50246d574efb
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Oct 14 11:55:46 2021 +0800
fix(axis): fix that line & bar charts render abnormally when `yAxis.max` is set to be a value less than the min value of the series data.
---
src/coord/scaleRawExtentInfo.ts | 5 -----
test/axis-filter-extent2.html | 42 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/src/coord/scaleRawExtentInfo.ts b/src/coord/scaleRawExtentInfo.ts
index 45d2dc7..bdc87ea 100644
--- a/src/coord/scaleRawExtentInfo.ts
+++ b/src/coord/scaleRawExtentInfo.ts
@@ -201,11 +201,6 @@ export class ScaleRawExtentInfo {
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);
- if (min > max) {
- min = NaN;
- max = NaN;
- }
-
const isBlank = eqNaN(min)
|| eqNaN(max)
|| (isOrdinal && !axisDataLen);
diff --git a/test/axis-filter-extent2.html b/test/axis-filter-extent2.html
index 72bd533..32286e5 100644
--- a/test/axis-filter-extent2.html
+++ b/test/axis-filter-extent2.html
@@ -37,7 +37,7 @@ under the License.
<div id="main-stack-extreme"></div>
-
+ <div id="main2"></div>
<script>
require(['echarts'], function (echarts) {
@@ -152,6 +152,46 @@ under the License.
});
</script>
+ <script>
+ require(['echarts'], function (echarts) {
+
+ var option = option = {
+ xAxis: {
+ type: 'category',
+ data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+ },
+ yAxis: {
+ type: 'value',
+ // it works
+ // max: 820
+ // less than the min value of data
+ max: 500
+ },
+ series: [
+ {
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
+ type: 'line'
+ },
+ {
+ data: [820, 932, 901, 934, 1290, 1330, 1320],
+ type: 'bar'
+ }
+ ]
+ };
+
+ var chart = testHelper.create(echarts, 'main2', {
+ title: [
+ 'The **line** series should be **invisible**',
+ 'The **bar** series should be **partly visible**',
+ 'The y-axis should be shown',
+ 'The max value of y-axis should be 500'
+ ],
+ option: option,
+ height: 300
+ });
+ });
+ </script>
+
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org