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/01/06 07:40:34 UTC

[GitHub] [incubator-echarts] ahking opened a new issue #13955: 时间轴设置时间间隔,5.0和之前版本不一致的问题

ahking opened a new issue #13955:
URL: https://github.com/apache/incubator-echarts/issues/13955


   `option = {
         tooltip: {
               trigger: 'axis',        
               formatter: function (params, ticket, callback) {
                   var dataValue = params[0].value + "";
                   var dataArray = dataValue.split(',');
                   var date = new Date(dataArray[0].replace("-", "/"));
   
                   var dataValue_peichan = params[1].value + "";
                   var dataArray_peichan = dataValue_peichan.split(',');
   
                   return (date.getMonth() + 1) + '/' + date.getDate() + ':' + dataArray[1] + '<br />配产:' + dataArray_peichan[1] + '(' + (dataArray[1] - dataArray_peichan[1]) + ')';
   
                   //return dataArray[0] + ':' + dataArray[1];
                   //console.log(params);
   
               }
           },
           grid: { top: 15, bottom: 20, left: 40, right: 20 },
       xAxis: {
           type: 'time',
           boundaryGap: false,
           interval: 15 * 24 * 3600 * 1000,
           //data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            axisLabel: {
                   formatter: function (value, index) {
                       // 格式化成月/日,只在第一个刻度加空格,防止挡住纵坐标刻度值
                       var date = new Date(value);
                       var texts;
                       if (index === 0) {
                           texts = ['       ' + (date.getMonth() + 1), date.getDate()];
                       }
                       else {
                           texts = [(date.getMonth() + 1), date.getDate()];
                       }
                       console.log(texts);
                       //return texts;
                       return texts.join('/');
                   },
                   margin: 4
               },
               axisTick: { show: false }
       },
       yAxis: {
           type: 'value',
            min: 'dataMin',
            max: 'dataMax'
       },
        series: [{
               name: '计量油量',
               type: 'line',
               lineStyle: {
                   normal: {
                       width: 1.6,
                       color: 'red'
                   }
               },
               animation: false,
               symbol: 'circle',
               symbolSize: 2,
               showAllSymbol: true,
               itemStyle: {
                   normal: {
                       label: {
                           show: true,
                           formatter: function (params, ticket, callback) {
                               //格式化展现(标签+值)
                               //return params.dataIndex;
                               if (params.dataIndex == 45) {
                                   return params.value2;
                               }
                               else {
                                   return "";
                               }
   
                           },
                           textStyle: { color: 'gray' }
                       }
                   }
               },
               data: [["2020-11-22", 5364], ["2020-11-23", 5387], ["2020-11-24", 5397], ["2020-11-25", 5356], ["2020-11-26", 5383], ["2020-11-27", 5410], ["2020-11-28", 5406], ["2020-11-29", 5399], ["2020-11-30", 5384], ["2020-12-01", 5374], ["2020-12-02", 5385], ["2020-12-03", 5407], ["2020-12-04", 5410], ["2020-12-05", 5405], ["2020-12-06", 5412], ["2020-12-07", 5400], ["2020-12-08", 5383], ["2020-12-09", 5400], ["2020-12-10", 5414], ["2020-12-11", 5412], ["2020-12-12", 5406], ["2020-12-13", 5396], ["2020-12-14", 5361], ["2020-12-15", 5367], ["2020-12-16", 5353], ["2020-12-17", 5339], ["2020-12-18", 5351], ["2020-12-19", 5357], ["2020-12-20", 5368], ["2020-12-21", 5367], ["2020-12-22", 5373], ["2020-12-23", 5379], ["2020-12-24", 5373], ["2020-12-25", 5361], ["2020-12-26", 5345], ["2020-12-27", 5345], ["2020-12-28", 5329], ["2020-12-29", 5319], ["2020-12-30", 5302], ["2020-12-31", 5290], ["2021-01-01", 5301], ["2021-01-02", 5316], ["2021-01-03", 5320], ["2021-01-04", 5327], ["2021-0
 1-05", 5327], ["2021-01-06", 5337]]
               //data: [3, 5, 36, 10, 20, 15, 7, 20, 15, 7]
           },
           {
               name: '配产',
               type: 'line',
               lineStyle: {
                   normal: {
                       width: 1.6,
                       color: 'blue'
                   }
               },
               animation: false,
               symbol: 'none',
               symbolSize: 1,
               showAllSymbol: false,
               /*
               label: {
                   normal: {
                       formatter: function (params) {
                           //var date = new Date(params.name);
                           //return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' : ' + params.value[1];
                           return '666';
                       }
                   }
               },*/
               data: [["2020-11-22", 5500], ["2020-11-23", 5500], ["2020-11-24", 5500], ["2020-11-25", 5500], ["2020-11-26", 5500], ["2020-11-27", 5500], ["2020-11-28", 5500], ["2020-11-29", 5500], ["2020-11-30", 5500], ["2020-12-01", 5455], ["2020-12-02", 5455], ["2020-12-03", 5455], ["2020-12-04", 5455], ["2020-12-05", 5455], ["2020-12-06", 5455], ["2020-12-07", 5455], ["2020-12-08", 5455], ["2020-12-09", 5455], ["2020-12-10", 5455], ["2020-12-11", 5455], ["2020-12-12", 5455], ["2020-12-13", 5455], ["2020-12-14", 5455], ["2020-12-15", 5455], ["2020-12-16", 5455], ["2020-12-17", 5455], ["2020-12-18", 5455], ["2020-12-19", 5455], ["2020-12-20", 5455], ["2020-12-21", 5455], ["2020-12-22", 5455], ["2020-12-23", 5455], ["2020-12-24", 5455], ["2020-12-25", 5455], ["2020-12-26", 5455], ["2020-12-27", 5455], ["2020-12-28", 5455], ["2020-12-29", 5455], ["2020-12-30", 5455], ["2020-12-31", 5455], ["2021-01-01", 5452], ["2021-01-02", 5452], ["2021-01-03", 5452], ["2021-01-04", 5452], ["2021-0
 1-05", 5452], ["2021-01-06", 5452]]
               //data: [3, 5, 36, 10, 20, 15, 7, 20, 15, 7]
           }]
   };
   `
   5.0之前版本能够按15天间隔,显示坐标纵线,首尾都显示横坐标标签
   5.0之后的版本按照5天间隔,不显示坐标纵线,逢一号显示数据,首尾不显示横坐标标签,感觉自己做了很多默认设置,不能实现想要的效果,该如何更改?


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


[GitHub] [incubator-echarts] echarts-bot[bot] commented on issue #13955: 时间轴设置时间间隔,5.0和之前版本不一致的问题

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #13955:
URL: https://github.com/apache/incubator-echarts/issues/13955#issuecomment-755139341


   This issue is not created using [issue template](https://ecomfe.github.io/echarts-issue-helper/) so I'm going to close it. 🙊
   Sorry for this, but it helps save our maintainers' time so that more developers get helped.
   Feel free to create another issue using the issue template.
   
   If you think you have already made your point clear without the template, or your problem cannot be covered by it, you may re-open this issue again.
   
   这个 issue 未使用 [issue 模板](https://ecomfe.github.io/echarts-issue-helper/?lang=zh-cn) 创建,所以我将关闭此 issue。
   为此带来的麻烦我深表歉意,但是请理解这是为了节约社区维护者的时间,以更高效地服务社区的开发者群体。
   如果您愿意,请使用 issue 模板重新创建 issue。
   
   如果您认为虽然没有使用模板,但您已经提供了复现问题的充分描述,或者您的问题无法使用模板表达,也可以重新 open 这个 issue。


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


[GitHub] [incubator-echarts] echarts-bot[bot] closed issue #13955: 时间轴设置时间间隔,5.0和之前版本不一致的问题

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] closed issue #13955:
URL: https://github.com/apache/incubator-echarts/issues/13955


   


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