You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/05/06 21:27:40 UTC

[GitHub] astik opened a new issue #8294: inconsistencies between yAxis.axisLabel and yAxis.axisPointer.label formatters

astik opened a new issue #8294: inconsistencies between yAxis.axisLabel and yAxis.axisPointer.label formatters
URL: https://github.com/apache/incubator-echarts/issues/8294
 
 
   ### inconsistencies between yAxis.axisLabel and yAxis.axisPointer.label formatters with string configuration (interpolation seems to give different results)
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]: 4.x
   + Browser version [浏览器类型和版本]: tested with chrome 66.0.3359.139 and firefox 59.0.2, but i don't think it matters
   + OS Version [操作系统类型和版本]: tested with osx 10.13.3, but i don't think it matters
   
   ### Expected behaviour [期望结果]
   
   Formatter with same configuration should give the same result for both labels (yAxis.axisLabel and yAxis.axisPointer.label).
   
   ### ECharts option [ECharts配置项]
   ```javascript
   option = {
       tooltip: {
           trigger: 'axis',
   			axisPointer: {
   				type: 'cross'
   			}
       },
       xAxis: {
           type: 'category',
           data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
       },
       yAxis: {
           type: 'value',
           axisLabel: {
               formatter: '{value}'
           },
           axisPointer: {
               label:{
                   formatter: '{value}'
               }
           }
       },
       series: [
           {
               name:'A',
               type:'line',
               data:[120000.5, 132000.5, 101000.5, 134000.5, 90000.5, 230000.5, 210000.5]
           },
           {
               name:'B',
               type:'line',
               data:[220000.5, 282000.5, 201000.5, 234000.5, 290000.5, 430000.5, 410000.5]
           }
       ]
   };
   ```
   
   With this configuration, you'll end-up with :
   
   * yAxis.axisLabel will display "120000.5" for 120000.5
   * yAxis.axisPointer.label will display "120,000.5" for 120000.5
   
   To get a consistent display, you'll need to have this configuration :
   
   ```javascript
   option = {
       tooltip: {
           trigger: 'axis',
   			axisPointer: {
   				type: 'cross'
   			}
       },
       xAxis: {
           type: 'category',
           data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
       },
       yAxis: {
           type: 'value',
           axisLabel: {
               formatter: '{value}'
           },
           axisPointer: {
               label:{
                   formatter: function(a){return a.value.toFixed(2)}
               }
           }
       },
       series: [
           {
               name:'A',
               type:'line',
               data:[120000.5, 132000.5, 101000.5, 134000.5, 90000.5, 230000.5, 210000.5]
           },
           {
               name:'B',
               type:'line',
               data:[220000.5, 282000.5, 201000.5, 234000.5, 290000.5, 430000.5, 410000.5]
           }
       ]
   };
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org