web/dashboards/garage/js/garage.js
// Update each of the graphs in sequence
Update each of the graphs in sequence
Update each of the graphs in sequence
function updateGraphs() {
  console.log("Updating graphs at", new Date().toLocaleTimeString());
  getJson(baseUrl + MINUTE_OF_HOUR_ROUTE, function(response) {
    if (response) {
      let minuteofhour = response;
      const trace1 = {
        x: minuteofhour.x,
        y: minuteofhour.y,
        type: "scatter",
        market: {
          opacity: 0.7,
          color: "rgb(49,130,189)"
        }
      };
      const data = [trace1];
      const layout = {
        xaxis: {
          tickangle: -45
        }
      };
      Plotly.newPlot("linechart", data, layout, { showSendToCloud: true });
      getJson(baseUrl + ZONE_BY_TIME_ROUTE, function(response) {
        if (response) {
          let zonebytime = response;
          var data = [
            {
              z: zonebytime.z,
              x: zonebytime.x,
              y: zonebytime.y,
              type: "heatmap"
            }
          ];
          var layout = {
            xaxis: {
              tickangle: -45
            }
          };
          Plotly.newPlot("heatmap", data, layout, { showSendToCloud: true});
         }
      });
    }
  });
}
function updateGraphs ( ) { console . log ( "Updating graphs at" , new Date ( ) . toLocaleTimeString ( ) ) ; getJson ( baseUrl + MINUTE_OF_HOUR_ROUTE , function ( response ) { if ( response ) { let minuteofhour = response ; const trace1 = { x : minuteofhour . x , y : minuteofhour . y , type : "scatter" , market : { opacity : 0.7 , color : "rgb(49,130,189)" } } ; const data = [ trace1 ] ; const layout = { xaxis : { tickangle : - 45 } } ; Plotly . newPlot ( "linechart" , data , layout , { showSendToCloud : true } ) ; getJson ( baseUrl + ZONE_BY_TIME_ROUTE , function ( response ) { if ( response ) { let zonebytime = response ; var data = [ { z : zonebytime . z , x : zonebytime . x , y : zonebytime . y , type : "heatmap" } ] ; var layout = { xaxis : { tickangle : - 45 } } ; Plotly . newPlot ( "heatmap" , data , layout , { showSendToCloud : true } ) ; } } ) ; } } ) ; }
Update each of the graphs in sequence
Update each of the graphs in sequence
// Hour of Day graph // Zone by Time graph