【发布时间】:2021-08-19 09:40:21
【问题描述】:
我正在尝试使sparklines 饼图在JQuery Datatables 中动态呈现。我可以像这样将JQuery sparklines 饼图添加到JQuery DataTable 中:
<table id="dt-basic-example"
class="table table-bordered table-hover table-striped w-100">
<thead>
<tr>
<th>pie_chart</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sparklines" sparkType="pie" sparkHeight="50" sparkWidth="auto" values="4,6,7,7,4"> </span>
</td>
</tr>
</tbody>
</table>
$(document).ready()时如何添加同一张饼图?
我试过了,但没用:
var myData = [
{
pie_chart: '<span class="sparklines" sparkType="pie" sparkHeight="50" sparkWidth="auto" values="4,6,7,7,4"> </span>'
}
];
$(function () {
$('#dt-basic-example').dataTable({
data: myData,
columns: [
{data: 'pie_chart'}
]
});
【问题讨论】:
标签: javascript jquery dom datatables sparklines