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/08/27 07:43:32 UTC

[GitHub] maoyr opened a new issue #8955: 请问时间数据支持堆叠吗?

maoyr opened a new issue #8955: 请问时间数据支持堆叠吗?
URL: https://github.com/apache/incubator-echarts/issues/8955
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   在做甘特图,需要时间数据进行堆叠,但好像现在不支持时间数据的堆叠展示?还是我没找到对应的配置项?因为要用 dataZoom,如果把数据转换为数值的话,堆叠是正常的,但 dataZoom 就不能用了。
   
   
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:
   + Browser version [浏览器类型和版本]:
   + OS Version [操作系统类型和版本]:
   
   在官网运行下面的例子
   
   
   
   ### Expected behaviour [期望结果]
   希望时间数据可以堆叠,或者有什么方法将时间数据转换然后展示正常,并且 dataZoom 可用。
   
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   function  FormatTime(oldTime){    
       let newTime = [];
       oldTime.forEach((time)=>{
           newTime.push( new Date(time) );
       })
       return newTime ;
   }
   
   option = {
       tooltip: {
           trigger: 'axis'
       },
       xAxis: [
           {
               type: 'time'
              
           }
       ],
       yAxis: [
           {
               type: 'category',
               data: ['task1','task2','task3','task4','task5' ]
           }
       ],
        dataZoom: [ {
           type: 'slider'
       }],
       series: [
           {
               name:'计划开始时间',
               type: 'bar',
               stack: '计划',
               itemStyle: {
                   normal: {
                       borderColor: 'rgba(0,0,0,0)',
                       color: 'rgba(0,0,0,0)'
                   },
                   emphasis: {
                       borderColor: 'rgba(0,0,0,0)',
                       color: 'rgba(0,0,0,0)'
                   }
               },
               data: FormatTime ([
                   "2018/01/01", 
                   "2018/02/01", 
                   "2018/03/01", 
                   "2018/04/01", 
                   "2018/05/01"
               ])
           },
           {
               name:'计划结束时间',
               type: 'bar',
               stack: '计划',
               data: FormatTime ([
                   "2018/02/01", 
                   "2018/03/01", 
                   "2018/04/01", 
                   "2018/05/01", 
                   "2018/06/01"
               ])
           },
           {
               name:'实际开始时间',
               type: 'bar',
               stack: '实际',
               itemStyle: {
                   normal: {
                       borderColor: 'rgba(0,0,0,0)',
                       color: 'rgba(0,0,0,0)'
                   },
                   emphasis: {
                       borderColor: 'rgba(0,0,0,0)',
                       color: 'rgba(0,0,0,0)'
                   }
               },
               data: FormatTime ([
                   "2018/01/01", 
                   "2018/03/01", 
                   "2018/04/01", 
                   "2018/05/01", 
                   "2018/06/01"
               ])
           },
           {
               name:'实际结束时间',
               type: 'bar',
               stack: '实际',
               data: FormatTime ([
                   "2018/03/01", 
                   "2018/04/01", 
                   "2018/05/01", 
                   "2018/06/01", 
                   "2018/07/01"
               ])
           }
           
       ]
   };
   
   
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   
   

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