Google图表-晚上8点至凌晨6点(xAxis)-工作日

时间:2019-12-13 16:02:06

标签: javascript charts google-visualization google-timeline-chart

我在编程方面相对较新。我有一个算法,可以在几小时内为我提供创建图表所需的输出。 (https://docs.google.com/spreadsheets/d/1AwC3Mk7TyeRKOm9lutMrv9EclrQ-WfsCakiiQrQhg4A/edit?usp=sharing) 您可以在这里查看我的代码:https://jsfiddle.net/wc907hxu/1/ 是否有办法使它从上午8点开始到下午6点(工作日),然后在第二天恢复? 如果可以帮助我或发送类似情况,那就太好了,谢谢!


    <html>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

<script type="text/javascript">
  google.charts.load("current", {packages:["timeline"]});
  google.charts.setOnLoadCallback(drawChart);
  function drawChart() {


    var container = document.getElementById('example3.1');
    var chart = new google.visualization.Timeline(container);
    var dataTable = new google.visualization.DataTable();
         dataTable.addColumn({ type: 'string', id: 'President' });
        dataTable.addColumn({ type: 'string', id: 'President2' });
        dataTable.addColumn({ type: 'date', id: 'Start' });
        dataTable.addColumn({ type: 'date', id: 'End' });
        dataTable.addRows([

['Repuxagem 1001 ', '20194053 ', new Date(0,0,0,0,0,0),new Date(0,0,0,0,0,14400) ],
['Estampagem Topo ', '20194053 ', new Date(0,0,0,0,0,14400),new Date(0,0,0,0,0,118800) ],
['Estampagem Lado ', '20194053 ', new Date(0,0,0,0,0,14400),new Date(0,0,0,0,0,118800) ],
['Recartilhado 1005 ', '20194053 ', new Date(0,0,0,0,0,118800),new Date(0,0,0,0,0,133200) ],
['Recartilhado 3001 ', '20194054 ', new Date(0,0,0,0,0,25200),new Date(0,0,0,0,0,32400) ],
['Calf 2 ', '20194054 ', new Date(0,0,0,0,0,61200),new Date(0,0,0,0,0,75600) ],
['Recartilhado 3005 ', '20194054 ', new Date(0,0,0,0,0,75600),new Date(0,0,0,0,0,82800) ],
['Repuxagem 1001 ', '20194063 ', new Date(0,0,0,0,0,25200),new Date(0,0,0,0,0,39600) ],
['Calf2 ', '20194063 ', new Date(0,0,0,0,0,39600),new Date(0,0,0,0,0,61200) ],
['Recartilhado 3005 ', '20194063 ', new Date(0,0,0,0,0,61200),new Date(0,0,0,0,0,75600) ],
['Repuxagem 1001 ', '20194206 ', new Date(0,0,0,0,0,39600),new Date(0,0,0,0,0,50400) ],
['Impressão Topo ', '20194206 ', new Date(0,0,0,0,0,39600),new Date(0,0,0,0,0,50400) ],
['Calf1 ', '20194206 ', new Date(0,0,0,0,0,54000),new Date(0,0,0,0,0,72000) ],
['Recartilhado 1005 ', '20194206 ', new Date(0,0,0,0,0,72000),new Date(0,0,0,0,0,82800) ],
['Repuxagem 2001 ', '20194315 ', new Date(0,0,0,0,0,32400),new Date(0,0,0,0,0,43200) ],
['Recartilhado 2005 ', '20194315 ', new Date(0,0,0,0,0,32400),new Date(0,0,0,0,0,46800) ],
['Repuxagem 2001 ', '20194316 ', new Date(0,0,0,0,0,28800),new Date(0,0,0,0,0,32400) ],
['Calf1 ', '20194316 ', new Date(0,0,0,0,0,72000),new Date(0,0,0,0,0,75600) ],
['Recartilhado 2005 ', '20194316 ', new Date(0,0,0,0,0,75600),new Date(0,0,0,0,0,79200) ],
['Recartilhado 3001 ', '20194351 ', new Date(0,0,0,0,0,32400),new Date(0,0,0,0,0,39600) ],
['Recartilhado 3005 ', '20194351 ', new Date(0,0,0,0,0,32400),new Date(0,0,0,0,0,39600) ],
['Repuxagem 1001 ', '20194361 ', new Date(0,0,0,0,0,104400),new Date(0,0,0,0,0,118800) ],
['Calf1 ', '20194361 ', new Date(0,0,0,0,0,176400),new Date(0,0,0,0,0,198000) ],
['Recartilhado 1005 ', '20194361 ', new Date(0,0,0,0,0,198000),new Date(0,0,0,0,0,212400) ],
['Recartilhado 3001 ', '20194435 ', new Date(0,0,0,0,0,108000),new Date(0,0,0,0,0,111600) ],
['Recartilhado 3005 ', '20194435 ', new Date(0,0,0,0,0,108000),new Date(0,0,0,0,0,111600) ],
['Repuxagem 2001 ', '20194172 ', new Date(0,0,0,0,0,3600),new Date(0,0,0,0,0,18000) ],
['Calf2 ', '20194172 ', new Date(0,0,0,0,0,18000),new Date(0,0,0,0,0,39600) ],
['Recartilhado 3005 ', '20194172 ', new Date(0,0,0,0,0,39600),new Date(0,0,0,0,0,54000) ],
['265 ', '20194172 ', new Date(0,0,0,0,0,54000),new Date(0,0,0,0,0,154800) ],
['Recartilhado 1005 ', '20194172 ', new Date(0,0,0,0,0,154800),new Date(0,0,0,0,0,169200) ],
['Repuxagem 2001 ', '20194223 ', new Date(0,0,0,0,0,18000),new Date(0,0,0,0,0,28800) ],
['Calf1 ', '20194223 ', new Date(0,0,0,0,0,39600),new Date(0,0,0,0,0,54000) ],
['Recartilhado 2005 ', '20194223 ', new Date(0,0,0,0,0,54000),new Date(0,0,0,0,0,64800) ],






  ]);





    chart.draw(dataTable);
  }
</script>
<div id="example3.1" style="height: 1200px; width:4000px;"></div>
</html>

0 个答案:

没有答案