score:1
Accepted answer
I think you should reshape your data so that it fits better into the Crossfilter paradigm. The following should get you what you want:
var data = [{"_1000_1249":0,"_1250_1499":2},{"_1000_1249":1,"_1250_1499":2},{"_1000_1249":2,"_1250_1499":3}]
var updatedData = []
for(var i=0; i < data.length; i++) {
for(key in data[i]) {
updatedData.push({
key: key,
value: data[i][key]
})
}
}
var cf = crossfilter(updatedData)
var dimension = cf.dimension(function(d) { return d.key; })
var group = dimension.group().reduceSum(function(d) { return d.value; })
console.log(group.all())
If you want to experiment, this is in a JSFiddle here: https://jsfiddle.net/esjewett/1d853fwj/3/
Source: stackoverflow.com
Related Query
- How to create one group with multiple dimension on dc.js
- How can I properly aggregate / group multiple line graphs into one overall graph with d3.js when the x-values aren't matching exactly?
- How to set multiple attributes with one value function?
- How to create stacked row chart with one row with dc.js?
- How can I create a doughnut chart with rounded edges only on one end of each segment?
- How to group multiple values in nested D3 to create multiple rollup sum chart ?
- How to create multiple pie charts with D3 from a single array with multiple objects?
- how create a circle group a organization circle image and connect with curve line with D3.js?
- How to create a tooltip for multiple points in a scatterplot with d3
- How do I create a D3 graph with multiple time series already in variables (i.e. not using d3.tsv())?
- How to create multiple adjacent nodes per data element with d3.js selections
- How to create a bar chart with C3 that doesn't group all columns in the same set
- How to Create/Show Multiple Iterations of Charts with the same data in One Area with Buttons using D3.js
- How to select multiple selectors with selectAll?
- How to use D3 selectAll with multiple class names
- D3: update data with multiple elements in a group
- How do I create a continuous Github-like calendar with Cal-Heatmap?
- How to create floor plans that work nice with mobile and desktop browsers?
- D3: How to create a circular flow / Sankey diagram with 2 arcs
- How to create a reusable component in D3 with an API that manipulates each instance of the component?
- How to create a horizontal legend with d3.js
- How to group by multiple keys at the same time using D3?
- How to move elements along with svg group
- How to replace a d3js nest function with group and rollup
- How To Move (Drag and Drop) multiple Shapes with D3
- How can D3 select multiple shapes with shared attributes from a group?
- d3 set multiple attributes with one function
- How can I make convex hulls of multiple group network nodes in D3.js
- How to create slow simultaneous transitions of multiple attributes in force directed graphs?
- In D3, how can I create multiple elements for each data element based on value in data?
More Query from same tag
- D3.js mouseover event should reach also the inner area of the circle
- d3 js redraw graph add existing nodes again
- How to give a fixed height to a d3js sankey chart left side nodes
- How to force the nvd3 chart timespan to stretch the width of the chart?
- Clustering of SVG Elements in d3.js yields unexpected results
- Why isn't D3 transition working
- Interactive Plot of Pandas Data-frame Color coding based on a group from a Column
- D3 heatmap color range updating with slider
- Bar Chart with Counts in dc.js
- Cubic line graph not graphing correctly?
- How to use hover and add text over node in d3 force simulation
- d3 svg clipping mask on circle arc
- d3 treat text and circle as one object
- Draw a zig-zagging circle with d3 / svg
- How do I connect two arcs with a line in this d3.js visual
- How to create stretchable svg shapes
- d3 customize tick line (based on nextSibling)
- Looping through array of objects within multiple objects and accessing values in D3 using underscore
- How to draw circles with radii given in kilometers accurately on world map
- How to find angle of rotation to make an SVG arc "stand up" with css3d
- change Vertical stacked bar to horizontal stacked Bar d3.js
- Properly display bin width in barChart using dc.js and crossfilter.js
- D3.js: Zooming the x-axis and data with mouse wheel scroll
- Select only the X value of nodes data with D3
- D3.js multi-series line chart using csv file
- nodes without edges escaping the graph in D3 v4
- How to add filled sections to SVG circles using d3.js
- d3.js - circle pack layout with nested g nodes
- Remove Specific svg in d3
- D3: Sunburst chart with root node on the outside ring