Reputation: 1986
I need help creating a bar chart, just a normal bar chart.
I have 5 objects, each with their own 10 fields. I want to create a side-by-side bar layout where the x axis labels are the 10 fields. Above the ith field should be a rectangle for each 5 object with each height corresponding to that objects data for that field. Each object has its own distinctive color.
I've spend 4+ hours and I've got nothing. Google reveals nothing that helps. Note: the rectangles of the bar chart should be vertical.
Edit: I'm not getting a lot of help. The answers have been unhelpful, though no fault of the authors. So here's my situation. I'm reading a JSON. The format of the JSON
[
...
{
"RowID":85,
"Name":"Tormore",
"B":2,
"S":2,
"S2":1,
"M":0,
"T":"0",
"H":1,
"S":0,
"W":1,
"N":2,
"Malty":1,
"Fruity":0,
"Floral":0
}
...
]
There are a total of 86 JSON pieces of data. That is, there 86 RowID's. I need to only work with 5. There needs to be 5 colors or however many rowID's I want to work with. The x-axis are the "B", "S" ... "Floral" from the JSON. So there should be "clumps" of 5 bars (colored corresponding to "Name") for each "B", ... "Floral" piece of data. The end goal is to make it easy for the user to visually compare 5 things according to their attributes.
I cannot make this work with the given examples. I've been working on this for at least 6 hours. I'm at my wits end.
Upvotes: 1
Views: 612
Reputation: 5015
It is tough to interpret questions at times...I thought the user might want a grouped bar chart :-) Anyways, I borrowed this graph from Mike and cooked up this UPDATED fiddle with appropriate variable names. If that is what you want, you can add more fields and objects and, of course, change the values appropriately. (The color scale may have to be touched as well.)
Some of the fake data:
var data = [
{"Field":"Field1","Object1":"2704659","Object2":"4499890"},
{"Field":"Field2","Object1":"2027307","Object2":"3277946"},
...
Upvotes: 1