<div id="barcat"></div>
<!-- Plotly chart will be drawn inside this DIV -->
<script>
Plotly.d3.json('http://192.168.2.11:8983/solr/first_csv_solr/select?facet.field=categories&facet=on&q=*:*&facet.pivot=categories&wt=json&omitHeader=true', function (err, rows) {
function unpack(rows, key) {
return rows.map(function (row) { return row[key]; });
}
var data = [{
x: unpack(rows, 'value'),
y: unpack(rows, 'count'),
type: 'bar',
marker: {
color: 'rgb(158,202,225)',
opacity: 0.6,
line: {
color: 'rgb(8,48,107)',
width: 0.5
}
}
}];
console.log("data")
var layout = {
height: 500,
width: 600,
// color: 'rgb(31,119,180)'
}
Plotly.newPlot('barcat', data, layout);
})
</script>
我正在获取事实计数,但是当我尝试在csv中进行转换时,它仅显示相关事件列名称。我希望将响应作为csv以便可以连接d3.js。 即使我也尝试在json中进行转换,但它不会以标准json格式显示。因为它在json响应中显示了标头
http://IP:8983/solr/first_csv_solr/select?facet.field=categories&facet=on&q=*:*&facet.pivot=categories&wt=json&omitHeader=true