Dc js - Histogram using dc js

I have the data below.

Any opportunities I can create using dc.js?

Can someone help me in creating a histogram using dc js?

I searched the entire forum, but could not get anything useful other than this.

The date:

numbers
1
10
1
twenty
35
24
26
35
12
32
35
10
1
2
32
35
36
12

Stuck on this for the last 2 days.

Please, help.

+3
source share
1 answer

http://jsfiddle.net/djmartin_umich/NmWP8/

enter image description here

1) First upload your data. In this case, I downloaded it directly, but you probably want to use d3.csv (as in the example in https://github.com/dc-js/dc.js/blob/master/web/examples/bar.html )

var experiments = [
        1,
        10,
        1,
        //other data points
        20];

2) Then create the size and cross filter group.

        var ndx = crossfilter(experiments),
        typeDimension = ndx.dimension(function (d) {
            return d;
        }),
        typeGroup = typeDimension.group().reduceCount();

3)

        var barChart = dc.barChart("#barChart");

        barChart
        .width(768)
        .height(480)
        .x(d3.scale.linear().domain([0,40]))
        .brushOn(false)
        .dimension(typeDimension)
        .group(typeGroup);

4)

    dc.renderAll();
+6

All Articles