This is a basic Ordinal Bar Chart
barChart01
.dimension(ageGroupDimension)
.group(ageGroupDimension.group())
.width($(barChart01.anchor()).parent().width())
.height(200)
.x(d3.scaleBand())
.xUnits(dc.units.ordinal)
.yAxisLabel("Count")
.xAxisLabel("Age Bracket");
This is a basic Numerical Bar Chart
barChart02
.dimension(ageDimension)
.group(ageGroup)
.width($(barChart02.anchor()).parent().width())
.height(200)
.x(d3.scaleLinear().domain([15, 70]))
.yAxisLabel("Count")
.xAxisLabel("Age");
barChart03
.dimension(ageGroupDimension)
.group(ageGroupDimension.group())
.width($(barChart01.anchor()).parent().width()/2)
.height(200)
.x(d3.scaleBand())
.xUnits(dc.units.ordinal)
.yAxisLabel("Count")
.xAxisLabel("Age Bracket")
.barPadding(.5);
barChart04
.dimension(ageGroupDimension)
.group(ageGroupDimension.group())
.width($(barChart01.anchor()).parent().width()/2)
.height(200)
.x(d3.scaleBand())
.xUnits(dc.units.ordinal)
.yAxisLabel("Count")
.xAxisLabel("Age Bracket")
.gap(20);
barChart05
.dimension(genderDimension)
.group(genderGroup)
.width($(barChart05.anchor()).parent().width())
.height(200)
.yAxisLabel("Count")
.xAxisLabel("Sex")
.x(d3.scaleOrdinal())
.xUnits(dc.units.ordinal)
.gap(50);
barChart06
.dimension(genderDimension)
.group(genderGroup)
.width($(barChart06.anchor()).parent().width())
.height(200)
.yAxisLabel("Count")
.xAxisLabel("Sex")
.x(d3.scaleOrdinal())
.xUnits(dc.units.ordinal)
.barPadding(0.1)
.outerPadding(2);
barChart07
.dimension(ageDimension)
.group(ageDimensionGroup)
.width($(barChart07.anchor()).parent().width())
.height(200)
.x(d3.scaleLinear().domain([17, 71]))
.yAxisLabel("Count")
.xAxisLabel("Age")
.centerBar(true);
barChart08
.dimension(ageDimension)
.group(ageDimensionGroup)
.width($(barChart08.anchor()).parent().width())
.height(200)
.x(d3.scaleLinear().domain([17, 71]))
.yAxisLabel("Count")
.xAxisLabel("Age")
.centerBar(true)
.round(function(n) { return Math.floor(n) + 0.5; })
.alwaysUseRounding(true);
barChart09
.dimension(genderDimension)
.group(genderGroup)
.width($(barChart09.anchor()).parent().width())
.height(200)
.x(d3.scaleBand())
.xUnits(dc.units.ordinal)
.y(d3.scaleLinear().domain([0, 600]))
.on('renderlet', chart => {
...
})
.on('postRedraw', function (chart, filter) {
let chartBars = chart.selectAll('.bar')._groups[0];
});
barChart10
.dimension(genderDimension)
.group(genderGroup)
.width($(barChart10.anchor()).parent().width())
.height(200)
.x(d3.scaleBand())
.xUnits(dc.units.ordinal)
.y(d3.scaleLinear().domain([0, 600]))
.label(function (d) {
let all = ndx.groupAll().reduceCount().value();
return d.data.value + " of " + all;});