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/09/23 03:34:41 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_r978241152


##########
src/component/axis/CartesianAxisView.ts:
##########
@@ -135,6 +139,37 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
             tickModel: splitLineModel
         });
 
+        if (ticksCoords.length > 2 && (axis.scale as any).getInterval instanceof Function) {
+            const interval = (axis.scale as IntervalScale).getInterval() || null;
+            const precision = (axis.scale as IntervalScale).getIntervalPrecision instanceof Function
+                ? (axis.scale as IntervalScale).getIntervalPrecision()
+                : null;
+
+            const showMinLine = splitLineModel.get('showMinLine');
+            if (showMinLine === false
+                || (showMinLine === 'auto'
+                    && roundNumber(

Review Comment:
   Using `roundNumber` to check if it is added as the *nice* extent is not accurate.



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

Review Comment:
   Create a new variable for `axis.scale as IntervalScale`



##########
src/coord/axisCommonTypes.ts:
##########
@@ -244,6 +244,10 @@ interface MinorTickOption {
 
 interface SplitLineOption {
     show?: boolean,
+    // null/undefined (true) | true | false | 'auto' (true when nick tick only)
+    showMinLine?: boolean | 'auto',
+    // null/undefined (true) | true | false | 'auto' (true when nick tick only)

Review Comment:
   `null/undefined` is not necessary and they should not have a default value defined here. Instead, the default value should be defined in `axisDefault.ts`.



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

Review Comment:
   `instanceof Function` can be omitted. If `getInterval` is not null, we can expect it to be a function.



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