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/11/08 04:20:38 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #16947: feat(axis): provide splitLine.showMinLine and splitLine.showMaxLine. …

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


##########
src/component/axis/CartesianAxisView.ts:
##########
@@ -135,6 +136,30 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
             tickModel: splitLineModel
         });
 
+        const axisScale = axis.scale as IntervalScale;
+        if (ticksCoords.length > 2 && axisScale.getInterval) {

Review Comment:
   What if `ticksCoords.length` is `2` but the data range is not equal to the ticks' values?



##########
src/component/axis/CartesianAxisView.ts:
##########
@@ -135,6 +136,30 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
             tickModel: splitLineModel
         });
 
+        const axisScale = axis.scale as IntervalScale;
+        if (ticksCoords.length > 2 && axisScale.getInterval) {
+            const interval = axisScale.getInterval() || null;
+
+            const showMinLine = splitLineModel.get('showMinLine');
+            if (showMinLine === false
+                || (showMinLine === 'auto'
+                    && ticksCoords[1].tickValue - ticksCoords[0].tickValue < interval

Review Comment:
   Have you tested the case when `axis.inverse` is `true`? `ticksCoords[1].tickValue` may be smaller than `ticksCoords[0].tickValue` in this case.



##########
test/axis-interval.html:
##########
@@ -534,8 +540,68 @@ <h1>Test xAxis.axisTick.interval</h1>
 
 
 
+    <script>
+
+        require([

Review Comment:
   Please add more test cases to test boundary situations. You may start with the cases in my above questions.



##########
test/axis-interval.html:
##########
@@ -534,8 +540,68 @@ <h1>Test xAxis.axisTick.interval</h1>
 
 
 
+    <script>
+
+        require([

Review Comment:
   Please add more test cases to test boundary situations. You may start with the cases in my above questions.



##########
src/component/axis/CartesianAxisView.ts:
##########
@@ -135,6 +136,30 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
             tickModel: splitLineModel
         });
 
+        const axisScale = axis.scale as IntervalScale;
+        if (ticksCoords.length > 2 && axisScale.getInterval) {
+            const interval = axisScale.getInterval() || null;

Review Comment:
   What is `|| null` for?



##########
src/component/axis/CartesianAxisView.ts:
##########
@@ -135,6 +136,30 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
             tickModel: splitLineModel
         });
 
+        const axisScale = axis.scale as IntervalScale;
+        if (ticksCoords.length > 2 && axisScale.getInterval) {
+            const interval = axisScale.getInterval() || null;
+
+            const showMinLine = splitLineModel.get('showMinLine');
+            if (showMinLine === false

Review Comment:
   `!showMinLine` should be better.



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