Commit b5c8ae12 authored by Kjetil Thuen's avatar Kjetil Thuen

Manhandled Nesstar data into something useable

parent a940a0a5
......@@ -64,11 +64,20 @@ prepareFuncFactory = (callback) ->
valuesByYear = lodash.groupBy saneValueStore, (cell) ->
parseInt(cell.tid)
valuesByYearAndGender = lodash.mapValues valuesByYear, (cells) ->
lodash.groupBy cells, (cell) ->
parseInt(cell.Kjnn)
valuesByYearAndBirthYear = lodash.mapValues valuesByYear, (years) ->
lodash.groupBy years, (cell) ->
parseInt(cell.tid) - parseInt(cell.alder)
callback valuesByYearAndGender
flattenedValuesByYearAndBirthYear =
lodash.mapValues valuesByYearAndBirthYear, (years) ->
lodash.map years, (birthYear) ->
{
birthyear: parseInt(birthYear[0].tid) - parseInt(birthYear[0].alder)
rvalue: birthYear[0].value
lvalue: birthYear[1].value
}
callback flattenedValuesByYearAndBirthYear
prepareDataForTimeBar
......
......@@ -46,7 +46,7 @@ updateChart = (containerId, frameNum) ->
data = valuesFromFrame containerId, frameNum
chart = d3.select containerId + " svg.chart"
valuepoints = chart.selectAll "g.valuepoint"
.data data, (d) -> d.lvalue + "," + d.rvalue
.data data, (d) -> d.birthyear
valuepoints.transition()
.ease "linear"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment