While attempting to create a group bar graph using d3.js, I encountered an error that has me stumped. As a newcomer to d3.js, I am actively working on mastering the script independently. Any guidance or assistance from the community would be greatly appreciated.
The error appears to be related to this section of the code:
y.domain([0, d3.max(data, function(s_category) {
return d3.max(s_category.values,
function(d) {
return d.count; });
})
]);
Error Details:
Uncaught TypeError: Cannot read property 'length' of undefined
Here's the complete code snippet:
In this graph, count corresponds to the y-axis, drug_c is mapped on the x-axis, and s_category plays a role in determining the groups within the bar graph.