Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
189 views
in Technique[技术] by (71.8m points)

node.js - Stacked bar chart in d3

I'm developing a simple dashboard using nodeJS and expressJS which takes data from MySQL database and builds charts with them. The fact is that I'm kind of new using d3 (especially focused into backend) and I'm unable to figure out how to build a stacked bar chart using a certain data structure.

The data I have follows this structure: { Quantity: ##, Category: "Example", Month: "YYYY-MM" }. I have thought that it would be easier if I used d3.nest() function to group data depending on the Category, in order to have data classified by Category, but I'm not sure how to put data into charts, because stacked bar chart examples I've seen have different input data structures which I'm not able to use.

In addition, since I'm using the Month data as x-axis, I've defined the scale as ScaleTime, but I've only seen bar charts using ScaleBand as x-axis, and I don′t know if this is suitable or not.

question from:https://stackoverflow.com/questions/66046070/stacked-bar-chart-in-d3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...