I'm working on incorporating a simple animated bar-chart into my webpage using the D3 (v7) library. This is part of a Django project, so the data for the chart is coming from my views.py file. However, when I try to display the chart, only part of it shows up on the page. The x and y axis lines along with the labels are visible, but there's an error message that says:
Error: <rect> attribute height: Expected length, "NaN".
Below is the relevant section from my HTML template:
<div id="chart-container"></div>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script type="text/javascript">
const data = JSON.parse('{{ assign_levels|safe }}');
// Rest of the JavaScript code for generating the chart here...
</script>
Additionally, here is the data input for the chart:
[["Class", 36], ["School - cluster", 6], ["Individual", 20], ["N", 1], ["School - multi-site", 9], ["Not provided/ not available", 4], ["Region or district", 1]]
I'm perplexed by the error message regarding the "NaN" height value because I've clearly set the height to an absolute value like 500 pixels in the code.