Bug 1435320 - Specify a default empty object for the Chart.js table header. r?Honza draft
authorIan Moody <moz-ian@perix.co.uk>
Fri, 02 Feb 2018 17:50:09 +0000
changeset 750721 4cc6c15d5be09a8794c7ca37e163f6dbf8b63ec8
parent 748899 fd995039d89708923b5673ecebc652967d40bd4e
push id97716
push usermoz-ian@perix.co.uk
push dateFri, 02 Feb 2018 17:50:44 +0000
reviewersHonza
bugs1435320
milestone60.0a1
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
devtools/client/shared/widgets/Chart.js
--- 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) {