Browse Source

src/tooltip total row cleanup

pull/1834/head
Dakota St. Laurent 9 years ago
parent
commit
14603daa22
  1. 7
      src/tooltip.js

7
src/tooltip.js

@ -77,11 +77,14 @@ c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaul
if (config.tooltip_total_show) { if (config.tooltip_total_show) {
totalValue = 0; totalValue = 0;
for (i = 0; i < d.length; i++) { for (i = 0; i < d.length; i++) {
if (! (d[i] && (d[i].value || d[i].value === 0))) { continue; }
totalValue += d[i].value; totalValue += d[i].value;
} }
totalValue = totalValueFormat(totalValue); totalValue = totalValueFormat(totalValue);
text += "<tr><td class='name'><strong>" + totalName + "</strong></td>"; text += "<tr>";
text += "<td class='value'>" + totalValue + "</td></tr>"; text += "<td class='name'><strong>" + totalName + "</strong></td>";
text += "<td class='value'>" + totalValue + "</td>";
text += "</tr>";
} }
return text + "</table>"; return text + "</table>";
}; };

Loading…
Cancel
Save