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 2020/04/02 20:07:39 UTC

[GitHub] [incubator-echarts] 100pah opened a new issue #12374: visualMap piecewise not work on dimension x/y in some kind of configurations

100pah opened a new issue #12374: visualMap piecewise not work on dimension x/y in some kind of configurations
URL: https://github.com/apache/incubator-echarts/issues/12374
 
 
   ### Version
   4.7.0
   
   ### Steps to reproduce
   
   This option does not work and throws an error.
   ```js
   option = {
       xAxis: { type: 'time' },
       yAxis: { type: 'value' },
       visualMap: {
           type: 'piecewise',
           show: false,
           dimension: 0,
           pieces: [{
               lte:  new Date('2020-04-01T01:00'),
               color: 'blue'
           }, {
               gt:  new Date('2020-04-01T01:00'),
               color: 'red'
           }]
       },
       tooltip:{ trigger: "axis" },
       series: [{
           type: 'line',
           data: [
               ['2020-04-01T00:00', 200],
               ['2020-04-01T01:00', 400],
               ['2020-04-01T02:00', 650],
               ['2020-04-01T03:00', 500]
           ]
       }]
   };
   ```
   
   This option works (which is the expected result):
   ```js
   option = {
       xAxis: { type: 'time' },
       yAxis: { type: 'value' },
       visualMap: {
           type: 'piecewise',
           show: false,
           dimension: 0,
           pieces: [{
               gt:  new Date('2020-04-01T00:00'),
               lte:  new Date('2020-04-01T01:00'),
               color: 'blue'
           }, {
               gt:  new Date('2020-04-01T01:00'),
               lte:  new Date('2020-04-01T04:00'),
               color: 'red'
           }]
       },
       tooltip:{ trigger: "axis" },
       series: [{
           type: 'line',
           data: [
               ['2020-04-01T00:00', 200],
               ['2020-04-01T01:00', 400],
               ['2020-04-01T02:00', 650],
               ['2020-04-01T03:00', 500]
           ]
       }]
   };
   ```
   But users are not easy to know they should config `visualMap` like that.
   
   ### What is expected?
   Make the previous option work.
   
   ### What is actually happening?
   It not works and throws an error.
   
   
   ### Related issue
   
   #12366
   
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [incubator-echarts] echarts-bot[bot] commented on issue #12374: visualMap piecewise not work on dimension x/y in some kind of configurations

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #12374: visualMap piecewise not work on dimension x/y in some kind of configurations
URL: https://github.com/apache/incubator-echarts/issues/12374#issuecomment-608076250
 
 
   Hi! We've received your issue and please be patient to get responded. 🎉
   The average response time is expected to be within one day for weekdays.
   
   In the meanwhile, please make sure that **you have posted enough image to demo your request**. You may also check out the [API](http://echarts.apache.org/api.html) and [chart option](http://echarts.apache.org/option.html) to get the answer.
   
   If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.
   
   If you are interested in the project, you may also subscribe our [mail list](https://echarts.apache.org/en/maillist.html).
   
   Have a nice day! 🍵

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] drumslave-git commented on issue #12374: visualMap piecewise not work on dimension x/y in some kind of configurations

Posted by GitBox <gi...@apache.org>.
drumslave-git commented on issue #12374:
URL: https://github.com/apache/echarts/issues/12374#issuecomment-905502628


   Still actual for me in echarts 4.9.0. Dont know what happened with #11847, but based on that I did my own dirty hack fix
   
   ```
   import VisualMapModel from 'echarts/lib/component/visualMap/VisualMapModel';
   import OriginPiecewiseModel from 'echarts/src/component/visualMap/PiecewiseModel';
   import * as zrUtil from 'zrender/src/core/util';
   
   const PiecewiseModel = OriginPiecewiseModel.prototype;
   const originGetVisualMeta =  OriginPiecewiseModel.prototype.getVisualMeta;
   
   PiecewiseModel.getVisualMeta = function (getColorVisual){
       const {stops, outerColors} = originGetVisualMeta.call(this, getColorVisual);
       // stop needs to have something
       if (!stops.length) {
           // get value axis
           const visualMapModel = this;
           const pieceList = this._pieceList.slice();
           const cartesian = visualMapModel.ecModel.getComponent('series').coordinateSystem;
           const baseAxis = cartesian.getBaseAxis();
           const valueAxis = cartesian.getOtherAxis(baseAxis);
           const extent = valueAxis.scale.getExtent();
           zrUtil.each(pieceList, function (piece) {
               for (let i = 0; i < piece.interval.length; i++) {
                   // Because CanvasRenderingContext2D doesn't support Infinity
                   // So set stop value to axis end.
                   let value = piece.interval[i] === -Infinity
                       ? extent[0]
                       : piece.interval[i] === Infinity
                           ? extent[1]
                           : piece.interval[i];
                   stops.push({
                       value: value,
                       color: piece.visual.color
                   });
               }
           });
       }
   
       return {stops, outerColors};
   };
   
   VisualMapModel.extend(PiecewiseModel);
   ```
   
   Use  
   `import './PiecewiseModel';`  
   after  
   `import echarts from 'echarts';`


-- 
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] [incubator-echarts] susiwen8 commented on issue #12374: visualMap piecewise not work on dimension x/y in some kind of configurations

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on issue #12374:
URL: https://github.com/apache/incubator-echarts/issues/12374#issuecomment-652964933


   Relate to #5801, 
   PR #11847 might fix this, but need some modification


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

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