引入
getServerData() {
var Column = {
"categories": ["运行", "故障", "待料", "维修", "保养", "停机", "离线"],
"series": [{
"name": "设备状态",
"data": [
{ "value": 1, "color": "#009036" },
{ "value": 1, "color": "#ffeb00" },
{ "value": 0, "color": "#F7B233" },
{ "value": 0, "color": "#f04864" },
{ "value": 1, "color": "#009de0" },
{ "value": 0, "color": "#6F7072" },
{ "value": 18, "color": "#aaaaaa" }
]
}]
}
this.showColumn('canvasColumn', Column)
},
showColumn(canvasId, chartData) {
canvaColumn = new uCharts({
$this: _self,
canvasId: canvasId,
type: 'column',
legend: { show: true },
fontSize: 11,
background: '#FFFFFF',
pixelRatio: _self.pixelRatio,
animation: true,
categories: chartData.categories,
series: chartData.series,
xAxis: {
disableGrid: true,
},
yAxis: {
// disableGrid: true,
},
dataLabel: true,
width: _self.cWidth * _self.pixelRatio,
height: _self.cHeight * _self.pixelRatio,
extra: {
column: {
type: 'group',
width: _self.cWidth * _self.pixelRatio * 0.45 / chartData.categories.length
}
}
});
},
touchColumn(e) {
canvaColumn.showToolTip(e, {
format: function(item, category) {
if (typeof item.data === 'object') {
return category + ':' + item.data.value
} else {
return category + ':' + item.data
}
}
});
},