You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "rjyunis (via GitHub)" <gi...@apache.org> on 2023/03/28 23:57:24 UTC

[GitHub] [echarts] rjyunis opened a new issue, #18439: Create a continuous VisualMap with log distribution [Feature]

rjyunis opened a new issue, #18439:
URL: https://github.com/apache/echarts/issues/18439

   ### What problem does this feature solve?
   
   When creating a series of type "heatmap", it would be nice to have a continuous VisualMap distributed on a log scale. Currently it can only be distributed linearly. 
   
   It is possible to achieve similar results by taking the log of all the series data, but in doing so you lose the physical meaning behind the numbers.
   
   An analogous example in python is the difference between [numpy.linspace()](https://numpy.org/doc/stable/reference/generated/numpy.linspace.html#numpy.linspace), and [numpy.geomspace()](https://numpy.org/doc/stable/reference/generated/numpy.geomspace.html#numpy.geomspace).
   
   I propose having a VisualMap option called "scaling", which defaults to "linear", but can be set to "log".
   
   ### What does the proposed API look like?
   
   ```
   option = {
     series: [{
       type: "heatmap",
       //...
     }],
     visualMap: {
       type: "continuous",
       scaling: "log" // use the logic from numpy.geomspace()
     }
   };
   ```


-- 
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.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 issue #18439: [Feature] Create a continuous VisualMap with log distribution

Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia commented on issue #18439:
URL: https://github.com/apache/echarts/issues/18439#issuecomment-1491220785

   I think this could be a useful feature but the community is mainly working on the project in their spare time so if you would like to make a pull request to implement this, it should save much of your waiting time. Thanks!


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


Re: [I] [Feature] Create a continuous VisualMap with log distribution [echarts]

Posted by "YiHui-Liu (via GitHub)" <gi...@apache.org>.
YiHui-Liu commented on issue #18439:
URL: https://github.com/apache/echarts/issues/18439#issuecomment-3529240840

   There is a way to achieve:
   ```js
   let processedData = rawData.map(item => {
       const safeValue = Math.max(1, item.value);
       return {
           name: item.name,
           value: Math.log10(safeValue),
           origin: safeValue
       };
   });
   ...
   tooltip: {
       formatter: function (params) {
           if (params.data && params.data.origin !== undefined)
               return params.name + ': ' + params.data.origin;
           return params.name;
       }
   },
   ...
   visualMap: {
       formatter: (value) => Math.round(Math.pow(10, value)),
   },
   ...
   series: [{
       data: processedData
   }]
   ```
   
   <img width="832" height="436" alt="Image" src="https://github.com/user-attachments/assets/7f2f6d68-ea67-4041-8e21-17b0fe1d7937" />


-- 
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] rjyunis commented on issue #18439: [Feature] Create a continuous VisualMap with log distribution

Posted by "rjyunis (via GitHub)" <gi...@apache.org>.
rjyunis commented on issue #18439:
URL: https://github.com/apache/echarts/issues/18439#issuecomment-1490719467

   Alternatively, can we apply the VisualMap to a non-physical dimension? For example, can I set `dimension: 3 //fourth column` and "hide" the values that are being tracked for the colors there?


-- 
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] rjyunis commented on issue #18439: [Feature] Create a continuous VisualMap with log distribution

Posted by "rjyunis (via GitHub)" <gi...@apache.org>.
rjyunis commented on issue #18439:
URL: https://github.com/apache/echarts/issues/18439#issuecomment-1488018086

   Workaround I have discovered:
   
   Take the log of the Z data, then 
   ```
   visualMap: {
     formatter: function (value){ return Math.E**value }
   },
   //...
   tooltip:{
     "valueFormatter": (value) => Math.E**value
   }
   ```
   
   This is messy, but it will get the job done for a basic heatmap where the values aren't shown except on the tooltop and visualMap.


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