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/06/10 07:13:40 UTC

[GitHub] [echarts] AndyGeng123 opened a new issue #15122: x轴为时间轴, step: 'end' 类型的面积曲线图, 是否能让提示框不进行四舍五入,显示下一个时间点的内容?

AndyGeng123 opened a new issue #15122:
URL: https://github.com/apache/echarts/issues/15122


   ### What problem does this feature solve?
   以下为HTML内容, 
   数据内容如下,数值代表每一分钟范围的统计值, 当前的echarts效果是,当鼠标指向梯形面积图横线或内容时, 一旦指向后半部分,即超过横线的50%时,提示框会显示到下一个序列值的内容。
   由于每个点是1分钟的时间范围,和业务逻辑不符。
   预期效果:当鼠标指向某个梯形横线的任意内容时,提示框一直显示它本身的内容,而不是超过50%范围,就显示下一个序列值。
       ['2021/01/02 00:00:00', 10.00],
       ['2021/01/02 00:01:00', 20.00],
       ['2021/01/02 00:02:00', 90.00],
       ['2021/01/02 00:03:00', 40.00],
       ['2021/01/02 00:04:00', 70.00]
   
   <!DOCTYPE html>
   <html style='height: 100%' lang='en'>
   <head> <meta charset='utf-8'> </head>
   <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/echarts/5.1.2/echarts.min.js'></script>
   <script type='text/javascript'>
   	var chart_option = {
           backgroundColor: 'rgba(128, 128, 128, 0.1)',
           tooltip: { trigger: 'axis', position: function (pt) { return [pt[0], '10%']; } },
   		legend: { data: ['统计值'] },
           xAxis: { type: 'time', boundaryGap: false },
           yAxis: { type: 'value', boundaryGap: [0, '20%'] },
           dataset: { source: [] },
           series: [
               { name: '统计值', type: 'line', areaStyle: {}, step: 'end', encode: { x: 0, y: 1 } },
           ]
       };
   </script>
   <body style='height: 100%;'>
   	<div id='container1' style='height: 100%'></div>
   </body>
   <script type='text/javascript'>
       var mychart1 = echarts.init(document.getElementById('container1'));
       window.onresize = mychart1.resize;
       chart_option.dataset.source = [
               ['2021/01/02 00:00:00', 10.00],
               ['2021/01/02 00:01:00', 20.00],
               ['2021/01/02 00:02:00', 90.00],
               ['2021/01/02 00:03:00', 40.00],
               ['2021/01/02 00:04:00', 70.00]
           ];
       mychart1.setOption(chart_option);
   
   </script>
   </html>
   
   ### What does the proposed API look like?
   貌似echarts对时间轴的时间,做了4舍5入,是否能在tooltip里加入一个选项,禁止4舍5入。
   noRound: true,
   
   var chart_option = {
           backgroundColor: 'rgba(128, 128, 128, 0.1)',
           tooltip: { trigger: 'axis',
                    noRound: true,
                    position: function (pt) { return [pt[0], '10%']; } },
   	legend: { data: ['统计值'] },
           xAxis: { type: 'time', boundaryGap: false },
           yAxis: { type: 'value', boundaryGap: [0, '20%'] },
           dataset: { source: [] },
           series: [
               { name: '统计值', type: 'line', areaStyle: {}, step: 'end', encode: { x: 0, y: 1 } },
           ]
       };
   
   <!-- This issue is generated by echarts-issue-helper. 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



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


[GitHub] [echarts] echarts-bot[bot] commented on issue #15122: x轴为时间轴, step: 'end' 类型的面积曲线图, 是否能让提示框不进行四舍五入,显示下一个时间点的内容?

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






-- 
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] [echarts] AndyGeng123 edited a comment on issue #15122: x轴为时间轴, step: 'end' 类型的面积曲线图, 是否能让提示框不进行四舍五入,显示下一个时间点的内容?

Posted by GitBox <gi...@apache.org>.
AndyGeng123 edited a comment on issue #15122:
URL: https://github.com/apache/echarts/issues/15122#issuecomment-858474253


   Let me descript it in English again:
   Here is echart options:
   ```js
   	var chart_option = {
           backgroundColor: 'rgba(128, 128, 128, 0.1)',
           tooltip: { trigger: 'axis', position: function (pt) { return [pt[0], '10%']; } },
   		legend: { data: ['my_stat_val'] },
           xAxis: { type: 'time', boundaryGap: false },
           yAxis: { type: 'value', boundaryGap: [0, '20%'] },
           dataset: { source: [] },
           series: [
               { name: 'my_stat_val', type: 'line', areaStyle: {}, step: 'end', encode: { x: 0, y: 1 } },
           ]
       };
   ```
   Here is data:
   ```js
       chart_option.dataset.source = [
               ['2021/01/02 00:00:00', 10.00],
               ['2021/01/02 00:01:00', 20.00],
               ['2021/01/02 00:02:00', 90.00],
               ['2021/01/02 00:03:00', 40.00],
               ['2021/01/02 00:04:00', 70.00]
           ];
   ```
   Because each row stand for a 1 minute range, when  mouse pointer move to one area item, the "tooltip" box should show the corresponded values.
   But echarts's behave is different, tooltip box will show the next point, when the mouse pointer move to the last half of the area item.
   So I need to find a way, to implement the feature, when mouse move to any point of the area item, it should ONLY show it's value, not snap to the next value.
   
   
   ![chart](https://user-images.githubusercontent.com/85657868/121501928-41f92080-ca12-11eb-889f-22508cac0802.png)
   


-- 
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] [echarts] Wintermute79 commented on issue #15122: x轴为时间轴, step: 'end' 类型的面积曲线图, 是否能让提示框不进行四舍五入,显示下一个时间点的内容?

Posted by GitBox <gi...@apache.org>.
Wintermute79 commented on issue #15122:
URL: https://github.com/apache/echarts/issues/15122#issuecomment-1028070124


   +1


-- 
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] AndyGeng123 commented on issue #15122: x轴为时间轴, step: 'end' 类型的面积曲线图, 是否能让提示框不进行四舍五入,显示下一个时间点的内容?

Posted by GitBox <gi...@apache.org>.
AndyGeng123 commented on issue #15122:
URL: https://github.com/apache/echarts/issues/15122#issuecomment-858474253


   Let me descript it in English again:
   Here is echart options:
   	var chart_option = {
           backgroundColor: 'rgba(128, 128, 128, 0.1)',
           tooltip: { trigger: 'axis', position: function (pt) { return [pt[0], '10%']; } },
   		legend: { data: ['my_stat_val'] },
           xAxis: { type: 'time', boundaryGap: false },
           yAxis: { type: 'value', boundaryGap: [0, '20%'] },
           dataset: { source: [] },
           series: [
               { name: 'my_stat_val', type: 'line', areaStyle: {}, step: 'end', encode: { x: 0, y: 1 } },
           ]
       };
   
   Here is data:
       chart_option.dataset.source = [
               ['2021/01/02 00:00:00', 10.00],
               ['2021/01/02 00:01:00', 20.00],
               ['2021/01/02 00:02:00', 90.00],
               ['2021/01/02 00:03:00', 40.00],
               ['2021/01/02 00:04:00', 70.00]
           ];
   Because each row stand for a 1 minute range, when  mouse pointer move to one area item, the "tooltip" box should show the corresponded values.
   But echarts's behave is different, tooltip box will show the next point, when the mouse pointer move to the last half of the area item.
   So I need to find a way, to implement the feature, when mouse move to any point of the area item, it should ONLY show it's value, not snap to the next value.
   
   
   ![chart](https://user-images.githubusercontent.com/85657868/121501928-41f92080-ca12-11eb-889f-22508cac0802.png)
   


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