抓数据的问题,Now的时候希望抓出25个数据但只能抓出20个,求解答

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Direction</title>
  <link rel="stylesheet" href="index.css">
  <!-- <script src="path/to/chartjs/dist/chart.js"></script> -->
  <script src="https://cdn.jsdelivr.net/npm/chart.js@3.7.1/dist/chart.min.js"></script>
</head>

<body onload="loadingTable('1')">
  <div id="nav">
    <ul>
      <li class="center">
        <a href="index.html" target="_top">Measurements</a>
      </li>
      <li class="center">
        <a href="temperatures.html" target="_top">Temperatures</a>

      <li class="center">
        <a href="direction.html" target="_top">Direction</a>
      </li>
      <li class="center dropdown">
        <a href="#" target="_top">allType</a>
        <div class="center_dropdown">
          <a href="allType1.html" target="_top">rain</a>
          <a href="allType2.html" target="_top">wind_speed</a>
          <a href="allType3.html" target="_top">wind_direction</a>
          <a href="allType4.html" target="_top">light</a>
          <a href="allType5.html" target="_top">Temperature</a>
        </div>
      </li>
      <li class="center">
        <a href="message.html" target="_top">Info</a>
      </li>
      <li class="center">
        <div id="timer">
          <div id="time_year"></div>
          <div id="time_clock"></div>
          <div id="time_weekday"></div>
        </div>
      </li>

    </ul>

  </div>
  <div class="control">
    <select name="select" id="select" onchange="loadingTable(this.value)">
      <option value="1">Now</option>
      <option value="23">24 hours</option>
      <option value="47">48 hours</option>
      <option value="71">72 hours</option>
      <option value="167">1 week</option>
    </select>
  </div>
  <table id="myTable" cellspacing="0">
    <tr>
      <th>number</th>
      <th>time</th>
      <th>value</th>

    </tr>
  </table>
  <canvas id="myChart" height="400"></canvas>
  <script src="getData.js"></script>
  <script>
    let myChart = null;
    function loadingTable(timeID) {

      let table = document.getElementById('myTable').firstElementChild
      let getSource = 'http://webapi19sa-1.course.tamk.cloud/v1/weather/wind_direction/';
      let sourceID;
      if (timeID == 1) {
        sourceID = getSource;
      }
      else {
        sourceID = getSource + timeID;
      }
      console.log(sourceID);
      let direction = getDate(sourceID);

      const ctx = document.getElementById('myChart').getContext('2d');
      if (myChart != null) {
        myChart.destroy();
      }
      renderTable(direction, table);
      createChart(ctx, direction);

    }


    function renderTable(direction, table) {
      direction.forEach((ele, ii) => {
        let val = null;
        let text = null;
        let tr = document.createElement('tr')
        for (let i = 0; i < 3; i++) {
          let td = document.createElement('td')
          let val = i == 0 ? ii + 1 : i == 1 ? ele.date_time.replace('T', ' ').slice(0, 18) : i == 2 ? ele.wind_direction : 'null'
          let text = document.createTextNode(val)
          td.appendChild(text)
          tr.appendChild(td)
        }
        table.appendChild(tr)
      });
    }

    function createChart(ctx, direction) {
      if (myChart != null) {
        myChart.destroy();
      }
      myChart = new Chart(ctx, {
        type: 'bar',
        data: {
          labels: direction.map(item => item.date_time.slice(11, 19)),
          datasets: [{
            label: 'direction',
            data: direction.map(item => item.wind_direction),
            backgroundColor: [
              'rgba(255, 99, 132, 0.2)',
              'rgba(54, 162, 235, 0.2)',
              'rgba(255, 206, 86, 0.2)',
              'rgba(75, 192, 192, 0.2)',
              'rgba(153, 102, 255, 0.2)',
              'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
              'rgba(255, 99, 132, 1)',
              'rgba(54, 162, 235, 1)',
              'rgba(255, 206, 86, 1)',
              'rgba(75, 192, 192, 1)',
              'rgba(153, 102, 255, 1)',
              'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 1
          }]
        },
        options: {
          scales: {
            y: {
              beginAtZero: true
            }
          }
        }
      });
    }

    function displayTime() {

      var date = new Date();
      var hour = date.getHours();
      var min = date.getMinutes();
      var sec = date.getSeconds();

      var timestr_year = date.getFullYear() + "."
        + (date.getMonth() + 1) + "."
        + date.getDate() + "";
      var timestr_clock = date.getHours() + ":"
        + date.getMinutes() + "."
        + date.getSeconds() + "";

      var weekday_num = date.getDay() + 1;
      var weekday_str;
      switch (weekday_num) {
        case 0:
          weekday_str = "Mon";
          break;
        case 1:
          weekday_str = "Tue";
          break;
        case 2:
          weekday_str = "Wed";
          break;
        case 3:
          weekday_str = "Thu";
          break;
        case 4:
          weekday_str = "Fir";
          break;
        case 5:
          weekday_str = "Sat";
          break;
        case 6:
          weekday_str = "Sun";
          break;
        default:
          break;
      }

      document.getElementById("time_year").innerHTML = timestr_year;
      document.getElementById("time_clock").innerHTML = timestr_clock;
      document.getElementById("time_weekday").innerHTML = timestr_weekday;


      var imgHour = document.getElementById('clock_hour');
      var imgMin = document.getElementById('clock_minute');
      var imgSec = document.getElementById('clock_second');
      imgHour.style.transform = 'rotate(' + hour * 30 + 'deg)';
      imgMin.style.transform = 'rotate(' + min * 6 + 'deg)';
      imgSec.style.transform = 'rotate(' + sec * 6 + 'deg)';


    }
    intervalTime = setInterval(displayTime, 1000);
  </script>
</body>

</html>

now这个接口就只返回20条数据。。没有返回25条,没法获取

img


数据不叠加清空下原表格的内容


        function loadingTable(timeID) {

            let table = document.getElementById('myTable').firstElementChild
            let getSource = 'http://webapi19sa-1.course.tamk.cloud/v1/weather/wind_direction/';
            let sourceID;
            if (timeID == 1) {
                sourceID = getSource;
            }
            else {
                sourceID = getSource + timeID;
            }
            console.log(sourceID);
            let direction = getDate(sourceID);

            const ctx = document.getElementById('myChart').getContext('2d');
            if (myChart != null) {
                myChart.destroy();
            }
            table.innerHTML = '<tr><th>number</th><th>time</th><th>value</th></tr>';////////////清除表格数据,只留表头 

            renderTable(direction, table);
            createChart(ctx, direction);

        }

img


有其他问题可以继续交流~