Bug 1435320 - Specify a default empty object for the Chart.js table header. r?Honza
So it doesn't break if one isn't supplied.
Also document the header argument.
MozReview-Commit-ID: 8UAVztN12Gw
--- a/devtools/client/shared/widgets/Chart.js
+++ b/devtools/client/shared/widgets/Chart.js
@@ -317,25 +317,32 @@ function createPieChart(document, { data
* label1: value => l10n.getFormatStr("...", value)
* }
* - totals: an object specifying for which rows in the `data` array
* the sum of their cells is to be displayed in the chart;
* e.g: {
* label1: total => l10n.getFormatStr("...", total), // 5
* label2: total => l10n.getFormatStr("...", total), // 9
* }
+ * - header: an object specifying strings to use for table column
+ * headers
+ * e.g. {
+ * label1: l10n.getStr(...),
+ * label2: l10n.getStr(...),
+ * }
* @return TableChart
* A table chart proxy instance, which emits the following events:
* - "mouseover", when the mouse enters a row
* - "mouseout", when the mouse leaves a row
* - "click", when the mouse clicks a row
*/
function createTableChart(document, { title, data, strings, totals, header }) {
strings = strings || {};
totals = totals || {};
+ header = header || {};
let isPlaceholder = false;
// If there's no data available, display an empty placeholder.
if (!data) {
data = loadingTableChartData();
isPlaceholder = true;
}
if (!data.length) {