JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PivotTable.js</title>
<!-- external libs from cdnjs -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.71/jquery.csv-0.71.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.19.0/pivot.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.19.0/pivot.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.19.0/d3_renderers.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.19.0/c3_renderers.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.19.0/export_renderers.min.js"></script>
</head>
<body>
<div id="output" style="display: none;">,id,link
0,1,<a>Google</a>
0,2,<a>Google link</a>
</div>
</body>
</html>
CSS
body {
font-family: Verdana;
}
.node {
border: solid 1px white;
font: 10px sans-serif;
line-height: 12px;
overflow: hidden;
position: absolute;
text-indent: 2px;
}
.c3-line,
.c3-focused {
stroke-width: 3px !important;
}
.c3-bar {
stroke: white !important;
stroke-width: 1;
}
.c3 text {
font-size: 12px;
color: grey;
}
.tick line {
stroke: white;
}
.c3-axis path {
stroke: grey;
}
.c3-circle {
opacity: 1 !important;
}
.c3-xgrid-focus {
visibility: hidden !important;
}
JavaScript
/*Copied pivotTableRenderer from pivot.js, edited line 116*/
var $, __hasProp = {}.hasOwnProperty;
$ = jQuery;
var pivotTableRenderer2 = function(pivotData, opts) {
var aggregator, c, colAttrs, colKey, colKeys, defaults, i, j, r, result, rowAttrs, rowKey, rowKeys, spanSize, td, th, totalAggregator, tr, txt, val, x;
defaults = {
localeStrings: {
totals: "Totals"
}
};
opts = $.extend(defaults, opts);
colAttrs = pivotData.colAttrs;
rowAttrs = pivotData.rowAttrs;
rowKeys = pivotData.getRowKeys();
colKeys = pivotData.getColKeys();
result = document.createElement("table");
result.className = "pvtTable";
spanSize = function(arr, i, j) {
var len, noDraw, stop, x, _i, _j;
if (i !== 0) {
noDraw = true;
for (x = _i = 0; 0 <= j ? _i <= j : _i >= j; x = 0 <= j ? ++_i : --_i) {
if (arr[i - 1][x] !== arr[i][x]) {
noDraw = false;
}
}
if (noDraw) {
return -1;
}
}
len = 0;
while (i + len < arr.length) {
stop = false;
for (x = _j = 0; 0 <= j ? _j <= j : _j >= j; x = 0 <= j ? ++_j : --_j) {
if (arr[i][x] !== arr[i + len][x]) {
stop = true;
}
}
if (stop) {
break;
}
len++;
}
return len;
};
for (j in colAttrs) {
if (!__hasProp.call(colAttrs, j)) continue;
c = colAttrs[j];
tr = document.createElement("tr");
if (parseInt(j) === 0 && rowAttrs.length !== 0) {
th = document.createElement("th");
th.setAttribute("colspan", rowAttrs.length);
th.setAttribute("rowspan", colAttrs.length);
tr.appendChild(th);
}
th = document.createElement("th");
th.className = "pvtAxisLabel";
th.textContent = c;
tr.appendChild(th);
for (i in colKeys) {
if (!__hasProp.call(colKeys, i)) continue;
colKey = colKeys[i];
x = spanSize(colKeys, parseInt(i), parseInt(j));
if (x !== -1) {
th = document.createElement("th");
...