I must be missing something fundamental with dc. I have a function I wrote to draw line charts of unmunged data (I want to provide X and Y value pairs). Sometimes it works, and sometimes it doesn't, and I can't figure out what is different between when it works and not.
Below is an example that doesn't work. The axes are drawn and labelled appropriately (0-60 on Y axis), but there is no line; the graph is empty. Can someone explain what the issue is?
function makeLineChart2(div, data) {
require(["dc"], function(dc) {
var xfilter = dc.crossfilter(data);
var dimFunc = function (r) {
return r['Row'];
};
var dimension = xfilter.dimension(dimFunc);
var minX = dimFunc(dimension.bottom(1)[0]);
var maxX = dimFunc(dimension.top(1)[0]);
var group = dimension.group().reduceSum(function (d) {
return d['max_temperature'];
});
var lc = dc.lineChart('#dc-chart');
lc.dimension(dimension)
.colors(['red'])
.group(group, 'max_temperature')
.brushOn(true);
lc.width(300).height(200)
.legend(dc.legend().x(50).y(10).itemHeight(13).gap(5));
lc.x(d3.scale.linear().domain([minX, maxX]));
lc.render();
});
}
var data3 = [
{Row:8, max_temperature:36.900001525878906},
{Row:1, max_temperature:63},
{Row:3, max_temperature:39.20000076293945},
{Row:4, max_temperature:53.599998474121094},
{Row:5, max_temperature:46},
{Row:6, max_temperature:18},
{Row:7, max_temperature:54},
{Row:2, max_temperature:35.79999923706055},
{Row:9, max_temperature:43.29999923706055},
{Row:10, max_temperature:41},
{Row:11, max_temperature:54},
{Row:12, max_temperature:9},
{Row:13, max_temperature:43.70000076293945},
{Row:14, max_temperature:46.400001525878906},
{Row:15, max_temperature:39.20000076293945},
];
makeLineChart2('#dc-chart', data3);