score:1
you can create multiple scaleBands, for rank_bucket, nation and group.
For each scales' range width, use the each bandwidth() of the preceding scale. For example,
var xscale_rank_bucket = d3.scaleBand()
.rangeRound([0,width])
.padding(0.2)
.domain(Array.from(rank_buckets));
var xscale_nation = d3.scaleBand()
.rangeRound([0,xscale_rank_bucket.bandwidth()])
.padding(0.1)
.domain(Array.from(nations));
You had done some of this already, but it just needed extending to the third scale.
Also, you can create multiple x-axes for nation and rank_bucket. For the nation axes, you will need one per rank_bucket, so you can add them based on a rank_bucket data join, for example:
var axisNationG = axes.selectAll(".axis-nation")
.data(Array.from(rank_buckets))
.enter()
.append("g")
.attr("transform", function(d){
return "translate(" + xscale_rank_bucket(d) + ",0)"
})
.attr("class", "x axis")
.call(axisNation)
The axes can be translated and styled to look like your mock up.
https://jsfiddle.net/yL5z1q04/5/
PS - The updated fiddle uses Sets to extract the unique values for each scale, and converts the Sets to Arrays for use in the scales and data joins.
Source: stackoverflow.com
Related Query
- Add more grouping to grouped bar chart
- How to add space between bars in a grouped bar chart in a nvd3 grouped multibar chart?
- Add Zoom to a Grouped Bar Chart that uses a scaleBand
- D3 : How to add labels top of in each bar in grouped bar chart
- D3 add data into array element inside setInterval() to draw grouped bar chart
- Add labels under every bar of the grouped bar chart on D3
- How to add tool-tips in d3 js vertically grouped bar chart
- Grouping json data to create grouped bar chart
- d3 accessing nested data in grouped bar chart
- d3.js How to add lines to a bar chart
- How to add a line on x-axis on a horizontal bar chart in d3
- Adding Error Bars to Grouped Bar Chart with D3.js
- D3 brushing on grouped bar chart
- Making a grouped bar chart using d3.js
- Making a grouped bar chart when my groups are varied sizes?
- Add labels to bar chart D3
- D3 bar chart needs to add arrow and text in particular bar
- D3: Create a grouped bar chart from json objects
- Interactive sorting of grouped bar chart in D3js
- d3 nested grouped bar chart
- Add border-radius bar chart d3
- NVD3.js: Stacked and grouped bar chart with two y-axis
- x axis labels overlapping for grouped category bar chart in d3
- D3.js : How to read data from JSON in Grouped Bar Chart
- D3.js-how to clip area outside rectangle while zooming in a grouped bar chart
- d3 convert bar chart to grouped bar chart
- Grouped bar chart with zoom and updateable data error
- How to make grouped stacked bar chart in d3js?
- How to create vertically grouped bar chart in d3.js using json data?
- D3 Grouped Bar Chart with JSON nested data
More Query from same tag
- Create points on a D3 multiline graph
- D3. Variable declaration in anonymous function
- How to structure nested nodes that need updating in d3 v4 force layout?
- How to interpolate or get color for the point/values not in specified color table range
- nvd3.js tooltip position with multiple charts
- Safari 5 on Windows 8 inverts all text-elements on SVG
- Loading shapes into d3
- d3 click to center content at position of element or click
- use d3.json instead of d3.csv to create bubble chart
- how do i customise the c3.js chart to get like this
- c3.js. Creating graphs within a loop to multiple divs with the same class/ID?
- Adding axis to the dynamic line chart in d3
- D3 - Remove padding to have graph fill the page
- How to arrange dates in a drop-down list according their natural way using D3.js
- Pie layout using multiple values within a single object
- D3 Chart Issue, Data Binding Not Working
- An alternative for d3v4 "columns" (I have to use d3v3)
- d3.js creating two elements per data point
- c3.js: axis-y label overlapped
- Use multi-tier dropdown (that uses jquery) to filter data and display d3 bar chart
- Changing fill/stroke of svg path elements in d3.js tick event shows no effect
- Aggregating Categorical Variables w/ Dimple.js
- maintaing object constancy in transistioning donut chart
- How to set color of node based on data value in D3JS
- tooltip using d3-tip not showing
- How to code a simple d3.js network graph using DIVs as nodes
- nvd3, x-axis ticks are repeating for certain months
- Make a line chart in D3.js loading data from an array
- Angular Material scrolling through the tabs clears axis in C3 chart
- Why does forceNetwork in networkd3 R display all nodes not in edgelist?