Open elisechant opened 7 years ago
maybe something like:
class BubbleDatasetController {
constructor(data) {
this._data = [];
this.setData(data);
return this;
}
getData() {
return this._data;
}
setData(data) {
if (data && data.length > 0) {
this._data = this.transform(data).map(d => {
// data points
return {
x: this.deriveX(),
y: this.deriveY(),
z: this.deriveZ(),
color: this.deriveColor(),
}
});
}
return this._data;
}
transform(data) {
return data;
}
deriveX() {
throw new Error('Must define deriveX.');
}
deriveY() {
throw new Error('Must define deriveY.');
}
deriveZ() {
throw new Error('Must define deriveZ.');
}
deriveColor() {
throw new Error('Must define deriveColor.');
}
}
class SpecificBubbleDatasetController extends BubbleDatasetController {
deriveX() {
return '';
}
deriveY() {
return '';
}
deriveZ() {
return '';
}
deriveColor() {
return '';
}
}
export default SpecificBubbleDatasetController;
Currently datavizkit only draws charts, where the application consuming it manages the data rehydration.
Proposed features:
Proposed shape:
controllers.line