我有一个Highcharts的词云。此处已经为图表显示了表格。但是,代替名称和权重的是其显示类别和广告中的出现次数。在这里我需要在表格标题中显示名称和权重。任何人都可以帮我。这是下面的代码。
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/wordcloud.js"></script>
<div class="chart-outer">
<div id="container"></div>
<!-- data table is inserted here -->
</div>
<script src="https://code.highcharts.com/modules/exporting.js"></script><!-- at bottom -->
<script src="https://code.highcharts.com/modules/export-data.js"></script><!-- at bottom -->
var data = [{
name: 'Lorem',
weight: 100
}, {
name: 'Ipsum',
weight: 50
}, {
name: 'Dolor',
weight: 41
}];
Highcharts.chart('container', {
series: [{
type: 'wordcloud',
data: data,
name: 'Occurrences'
}],
exporting: {
showTable: true
}
});
答案 0 :(得分:0)
对我来说,您要完成的工作并不明显,但我认为您想将表标题分别从“类别”和“出现次数”替换为“名称”和“重量”。
如果是这样,此配置可能对您有用:JSFiddle
exporting: {
showTable: true,
tableCaption: 'Data table',
csv: {
// This function is called for each column header.
columnHeaderFormatter: function (item, key) {
if (!item || item instanceof Highcharts.Axis) {
return 'Name';
}
// Item is not axis, now we are working with series.
return 'Weight';
}
}
}