You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/06/13 07:31:49 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #17078: feat: barSeries.startValue added

Ovilia commented on code in PR #17078:
URL: https://github.com/apache/echarts/pull/17078#discussion_r895399820


##########
test/bar-startValue.html:
##########
@@ -0,0 +1,225 @@
+<!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/simpleRequire.js"></script>
+        <script src="lib/config.js"></script>
+        <script src="lib/jquery.min.js"></script>
+        <script src="lib/facePrint.js"></script>
+        <script src="lib/testHelper.js"></script>
+        <!-- <script src="ut/lib/canteen.js"></script> -->
+        <link rel="stylesheet" href="lib/reset.css" />
+    </head>
+    <body>
+        <style>
+        </style>
+
+
+
+        <div id="main0"></div>
+        <div id="main1"></div>
+        <div id="main2"></div>
+        <div id="main3"></div>
+
+
+
+
+
+
+        <script>
+        require([
+            'echarts',
+            // 'map/js/china',
+            // './data/nutrients.json'
+        ], function (echarts) {
+            var option;
+            var startValue0 = -200;
+            var ymin = -150;
+            option = {
+                xAxis: {
+                    type: 'category',
+                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+                    axisLine: {
+                    onZero: false

Review Comment:
   Please fix the intent here



##########
src/layout/barGrid.ts:
##########
@@ -512,14 +512,20 @@ export function createProgressiveLayout(seriesType: string): StageHandler {
                     while ((dataIndex = params.next()) != null) {
                         const value = store.get(stacked ? stackedDimIdx : valueDimIdx, dataIndex);
                         const baseValue = store.get(baseDimIdx, dataIndex) as number;
-
+                        const startValue = seriesModel.get('startValue');
                         let baseCoord = valueAxisStart;
-                        let startValue;
+                        let stackStartValue;
 
+                        //If user specifies the starting value of bars, use it to adjust coordsys and update ticks

Review Comment:
   There should be a space before `If`.



##########
src/layout/barGrid.ts:
##########
@@ -512,14 +512,20 @@ export function createProgressiveLayout(seriesType: string): StageHandler {
                     while ((dataIndex = params.next()) != null) {
                         const value = store.get(stacked ? stackedDimIdx : valueDimIdx, dataIndex);
                         const baseValue = store.get(baseDimIdx, dataIndex) as number;
-
+                        const startValue = seriesModel.get('startValue');
                         let baseCoord = valueAxisStart;
-                        let startValue;
+                        let stackStartValue;
 
+                        //If user specifies the starting value of bars, use it to adjust coordsys and update ticks
+                        if (startValue) {
+                            baseCoord = valueAxis.toGlobalCoord(valueAxis.dataToCoord(startValue));

Review Comment:
   I think `min` and `max` should have the highest priority if it's provided by the user. For example, if the user set `min` to be `30` and `startValue` to be `20`, the min value shown should be `30` and behaves as if the `startValue` is provided as `20`. You can imagine the part between `20` and `30` is clipped.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org