javascript - Chart.js - Invalid scale configuration - Stack Overflow

admin2025-04-16  4

Below is the code snippet for scale configuration, which shows error on browser console.

The Error shown in console as: "Invalid scale configuration for scale: x"

Moreover, if I remove [ ] brackets for x, the chart does not load. Help me understand the error and ways to solve the same.

options: {
                responsive: true,
                maintainAspectRatio: false,
                scales: {
                    x: [{
                        type: 'time',
                        time: {
                            unit: 'hour'
                        }
                    }],
                    y: {
                        beginAtZero: true
                    }
                }
            }
转载请注明原文地址:http://anycun.com/QandA/1744808515a87909.html