@domoinc/base-widget
Version:
BaseWidget - Domo Widget
54 lines (45 loc) • 1.03 kB
JavaScript
//Setup some fake data
var data = [
[],
[],
[]
];
//Initialze the widget
var chart = d3.select("#vis")
.append("svg")
.attr({
height: '500px',
width: '500px'
})
.append("g")
.chart("BaseWidget")
.c({
width: 250,
height: 250
});
/*----------------------------------------------------------------------------------
//Add theme fun
----------------------------------------------------------------------------------*/
chart._config.change = {
value: 1,
theme: 'changeIt'
};
chart._config.fun = {
value: 2,
theme: 'booya'
};
var newTheme = {
"name": "Dark Bold",
"domoDefinedTheme": true,
"config": {
changeIt: 10,
junk: 10,
booya: 222
}
};
console.log(chart._config.change.value === 1, ':Btrue'); // Before
console.log(chart._config.fun.value === 2, ':Btrue'); // Before
chart.applyTheme(newTheme);
console.log(chart._config.change.value === 10, ':Atrue'); // After
console.log(chart._config.fun.value === 222, ':Atrue'); // After
//END theme fun