@domoinc/notifier
v2.2.4
Published
Notifier - Domo Widget
Downloads
52
Readme
Notifier
This component notifies the user if bad data is passed into a widget.
Config
this._config = {
height: { // Name of config Item
name: 'Chart Height', // [Optional] - This is the human readable name for this config item in Title Case. It should only be set if this is something that an end user would want to configure.
description: 'Height of the chart.', // Human readable description.
type: 'number', // [Optional] - Value type. Will be used for UI elements in future.
value: 100 // Default value for item
},
width: {
name: 'Chart Width'
description: 'Width of the chart.',
type: 'number',
value: 100
},
chartName: {
description: 'Name of chart for Reporting.',
type: 'string',
value: 'Notifier'
}
};
Interface
//----------------------------------------------------------------------------------
// Notifier Interface
//
// In trumping order:
//
// WARNs are always consoled, NO_DATE trumps DISCARDED_VALID_DATA,
// SAMPLE_DATA trumps NO_DATA, and FAIL trumps all.
//----------------------------------------------------------------------------------
//ChartName, MessageType, 'Custom Message', 'Column Names, ...', [[Data], ...]
chart.appendMessage('Notifier', 'WARN', 'Warning: Invalid Data', "Schema", [[Bad Data],...]);
chart.appendMessage("Notifier", "DISCARDED_VALID_DATA", "Why", "Schema", [[Discarded Data], ...]);
chart.appendMessage("Notifier", "NO_DATA", "No Data", "", []);
chart.appendMessage("Notifier", "SAMPLE_DATA", "Sample Data", "", []);
chart.appendMessage('Notifier', 'FAIL', 'O, Something Went Wrong!', "", []);
Create Widget
//Initialze the widget
var chart = d3.select("#vis")
.append("svg")
.attr({
"width":800,
"height":800
})
.append("g")
.attr("transform", "translate(50,50)")
.chart("Notifier")
.config({
'width':250,
'height':function(){return 250;}
});
//Render the chart with data
//ChartName, MessageType, 'Custom Message', 'Column Names, ...', [[Bad Data], ...]
chart.appendMessage("Notifier", "NO_DATA", "No Data", "", []);
chart.appendMessage("Notifier", "SAMPLE_DATA", "No Data", "", []);
chart.appendMessage('Notifier', 'WARN', 'Warning', "", []);
chart.appendMessage('Notifier', 'FAIL', 'O, Something Went Wrong!', "", []);
//var allMessages = {};
// allMessages.warningMessages = [{chartName:"Notifier", type:"WARN", message:"Warning", expectedDataFormat:"", data:[]}];
// allMessages.failMessages = [{chartName:"Notifier", type:"FAIL", message:"Fail", expectedDataFormat:"", data:[]}];
// allMessages.noDataMessages = [{chartName:"Notifier", type:"NO_DATA", message:"No Data", expectedDataFormat:"", data:[]}];
// allMessages.sampleDataMessages = [{chartName:"Notifier", type:"SAMPLE_DATA", message:"Sample Data", expectedDataFormat:"", data:[]}];
//chart.appendMessages(allMessages);
chart.showMessage(true);
chart.draw();
//chart.clearMessages();
//chart.draw();