'I want google line chart x axis to shift after 1000 data

I want the x-axis of google line chart to shift after 1000 data. Since I am a beginner in javascript, I was able to do this much. i will use this code to read sensor on raspberry pi.

    <script>
        google.charts.load("current", { packages: ["corechart", "line"] });
        google.charts.setOnLoadCallback(drawChart);

        function drawChart() {
            let data = google.visualization.arrayToDataTable([
                ["Year", "CPU Usage"],
                [0, 0],
            ]);

            let options = {
                width: 1000,
                height: 500,
                legend: "top",

            };

            let chart = new google.visualization.LineChart(document.getElementById("chart_div"));
            chart.draw(data, options);

            let index = 0;
            setInterval(function () {
                var jsonData = $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "HTTP://192.168.1.7:8000/",
                    async: false,
                }).responseJSON;

                let random_1 = jsonData["d7s_si"];

                data.addRow([index, random_1]);
                chart.draw(data, options);
                index++;
            }, 100);
        }
    </script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source