Button
Here goes a brief description of your widget
Config
this._config = {
height: {
name: 'Chart Height',
description: 'Height of the chart.',
type: 'number',
value: 100
},
width: {
name: 'Chart Width'
description: 'Width of the chart.',
type: 'number',
value: 100
},
shouldValidate: {
description: 'Flag for turning off data validation.',
type: 'boolean',
value: true
},
chartName: {
description: 'Name of chart for Reporting.',
type: 'string',
value: 'Button'
}
};
Data Definition
_Chart._newDataDefinition = {
'Label': {
type: 'string',
validate: function (d) { return this.accessor(d) !== undefined; },
accessor: function (line) { return String(line[0]); },
},
'Value': {
type: 'number',
validate: function (d) { return !isNaN(this.accessor(d)) && this.accessor(d) >= 0; },
accessor: function (line) { return Number(line[1]); },
}
};
Create Widget
var data = [
[1,2,3],
[4,5,6],
[7,8,9]
];
var chart = d3.select("#vis")
.append("svg")
.append("g")
.attr("transform", "translate(50,50)")
.chart("Button")
.width(250)
.height(250);
chart._notifier.showMessage(true);
chart.draw(data);