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 2021/07/25 14:12:42 UTC

[GitHub] [echarts] susiwen8 opened a new pull request #15411: Time axis shadow

susiwen8 opened a new pull request #15411:
URL: https://github.com/apache/echarts/pull/15411


   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   `time` axis `bandWith`calculation  is different from others. 
   
   
   ### Fixed issues
   
   Close #9843 
   
   
   ## Details
   
   <img width="1294" alt="Screen Shot 2021-07-25 at 10 10 23 PM" src="https://user-images.githubusercontent.com/20318608/126902139-697de879-fc85-44ec-8d78-823bfdb7c9ed.png">
   
   No shadow appear for `time` axis
   
   
   
   ### After: How is it fixed in this PR?
   
   <img width="707" alt="Screen Shot 2021-07-25 at 10 09 59 PM" src="https://user-images.githubusercontent.com/20318608/126902151-6f765324-11cb-47d4-8189-8005c4122aad.png">
   
   
   
   ## Misc
   
   <!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
   
   - [ ] The API has been changed (apache/echarts-doc#xxx).
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   
   test/axis-interval2.html
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   


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


[GitHub] [echarts] susiwen8 commented on a change in pull request #15411: Time axis shadow

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #15411:
URL: https://github.com/apache/echarts/pull/15411#discussion_r676587661



##########
File path: src/coord/Axis.ts
##########
@@ -246,7 +247,13 @@ class Axis {
         const axisExtent = this._extent;
         const dataExtent = this.scale.getExtent();
 
-        let len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0);
+        let len = 0;
+        if (this.scale.type === 'time') {
+            len = Math.ceil((dataExtent[1] - dataExtent[0]) / (this.scale as TimeScale)._approxInterval);

Review comment:
       > does this change means the getExtent of time axis returns a result that is not expected?
   
   No, `getExtent` returns perfectly. Nothing wrong about that.  The problem here is `dataExtent` could be extremely larger that `axisExtent` since `time dataExtent` are timestamps.  that leads `Math.abs(size) / len` to almost 0
   
   For example in this case: dataExtent is `505854800.9370117`
   
   We should treat `time axis` as `category axis`  to calcule how many section on axis. @Ovilia 




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


[GitHub] [echarts] Ovilia commented on a change in pull request #15411: Time axis shadow

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #15411:
URL: https://github.com/apache/echarts/pull/15411#discussion_r676256788



##########
File path: src/coord/Axis.ts
##########
@@ -246,7 +247,13 @@ class Axis {
         const axisExtent = this._extent;
         const dataExtent = this.scale.getExtent();
 
-        let len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0);
+        let len = 0;
+        if (this.scale.type === 'time') {
+            len = Math.ceil((dataExtent[1] - dataExtent[0]) / (this.scale as TimeScale)._approxInterval);

Review comment:
       From the engineering point of view, it may not be a good idea to check the type of scale in Axis. I didn't dive into the code but does this change means the `getExtent` of time axis returns a result that is not expected? If so, should we change the logic inside time scale? For example, does other functions have bug with time axis when calling `getExtent`?




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


[GitHub] [echarts] echarts-bot[bot] commented on pull request #15411: Time axis shadow

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #15411:
URL: https://github.com/apache/echarts/pull/15411#issuecomment-886208118


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
   
   The pull request is marked to be `PR: author is committer` because you are a committer of this project.


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


[GitHub] [echarts] susiwen8 commented on a change in pull request #15411: Time axis shadow

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #15411:
URL: https://github.com/apache/echarts/pull/15411#discussion_r676587661



##########
File path: src/coord/Axis.ts
##########
@@ -246,7 +247,13 @@ class Axis {
         const axisExtent = this._extent;
         const dataExtent = this.scale.getExtent();
 
-        let len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0);
+        let len = 0;
+        if (this.scale.type === 'time') {
+            len = Math.ceil((dataExtent[1] - dataExtent[0]) / (this.scale as TimeScale)._approxInterval);

Review comment:
       > does this change means the getExtent of time axis returns a result that is not expected?
   
   No, `getExtent` returns perfectly. Nothing wrong about that.  The problem here is `dataExtent` could be extremely larger that `axisExtent` since `time dataExtent` are timestamps. 
   
   For example in this case: `505854800.9370117`
   
   We should treat `time axis` as `category axis`  to calcule how many section on axis. @Ovilia 




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