coconut-graph
Advanced tools
Comparing version 1.0.11 to 1.0.12
{ | ||
"name": "coconut-graph", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Graph lib using d3 ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -46,6 +46,6 @@ var Class = require('./class.js'); | ||
} | ||
if (!('key' in plot)) { | ||
if (!plot.key) { | ||
throw 'key must be supplied.'; | ||
} | ||
if (!('axis' in plot)) { | ||
if (!plot.axis) { | ||
plot.axis = 'y'; | ||
@@ -140,3 +140,13 @@ } | ||
render: function (callback) { | ||
if (this.firstRender) { | ||
this.eachPlot(function (plot) { | ||
if (typeof plot.key === 'function') { | ||
plot.data_function = plot.key; | ||
plot.key = 'composed'; | ||
} else { | ||
plot.data_key = this.data_key(plot.key); | ||
plot.data_function = function(d) { return d[plot.data_key]; }; | ||
} | ||
}); | ||
} | ||
this.eachPlot(function(plot) { | ||
@@ -143,0 +153,0 @@ if (typeof plot.key === 'function') { |
@@ -31,2 +31,5 @@ var Class = require('./class.js'); | ||
// TODO: handle error here. | ||
if (error) { | ||
throw error; | ||
} | ||
@@ -33,0 +36,0 @@ self.load_json(response, callback); |
30438
826