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/20 10:37:46 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #17044: feat: Allow user to use `interval` on time axis

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


##########
src/scale/Time.ts:
##########
@@ -202,15 +204,16 @@ class TimeScale extends IntervalScale<TimeScaleSetting> {
             extent[0] = extent[1] - ONE_DAY;
         }
 
-        this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
+        this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval, opt.interval);
     }
 
-    calcNiceTicks(approxTickNum: number, minInterval: number, maxInterval: number): void {
+    calcNiceTicks(approxTickNum: number, minInterval: number, maxInterval: number, interval: number): void {
         approxTickNum = approxTickNum || 10;
 
         const extent = this._extent;
         const span = extent[1] - extent[0];
-        this._approxInterval = span / approxTickNum;
+        //Use set interval if specified by user

Review Comment:
   Space before `Use`



##########
src/coord/axisHelper.ts:
##########
@@ -182,6 +183,8 @@ export function niceScaleExtent(
     // FIXME
     if (interval != null) {
         (scale as IntervalScale).setInterval && (scale as IntervalScale).setInterval(interval);
+        //If interval is set by user, mark it as true

Review Comment:
   Space before `If`



##########
src/scale/Time.ts:
##########
@@ -517,32 +522,43 @@ function getIntervalTicks(
                 case 'half-year':
                 case 'quarter':
                 case 'month':
-                    interval = getMonthInterval(approxInterval);
+                    //Use interval set by user if specified

Review Comment:
   Space



##########
src/scale/Interval.ts:
##########
@@ -214,8 +219,9 @@ class IntervalScale<SETTING extends Dictionary<unknown> = Dictionary<unknown>> e
 
     /**
      * @param splitNumber By default `5`.
+     * @param interval Interval Set by user, not used here but inheritated by TimeScale
      */
-    calcNiceTicks(splitNumber?: number, minInterval?: number, maxInterval?: number): void {
+    calcNiceTicks(splitNumber?: number, minInterval?: number, maxInterval?: number, interval?: number): void {

Review Comment:
   It seems `interval` is not used here?



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