myChart.on('click', function (param) {
// alert(json.stringify(param));//這裏根據param填寫你的跳轉邏輯javascript
mes=param.dataIndex+1; // 輸出點擊柱子的index java
mes=param.data; // 輸出點擊柱子的數組json
mes=param.data[0]; // 輸出點擊柱子的具體的某個數據數組
document.getElementById('console').innerHTML = mes; //付給指定的divecharts
param 對象裏面主要含有下面屬性code
代碼片斷對象
var myChart4 = echarts.init(document.getElementById('barchart1'), theme); myChart4.setOption(option4); echarts.connect([myChart1, myChart2, myChart3, myChart4]); ObjectResize(myChart4.resize); function chartClick(param) { document.getElementById('console1').innerHTML = option3.xAxis.data[param.dataIndex] document.getElementById('console2').innerHTML = " P:" + option2.series[0].data[param.dataIndex] + " bar(abs)" document.getElementById('console3').innerHTML = " Qb:" + option3.series[0].data[param.dataIndex] + " Sm3/h" document.getElementById('console4').innerHTML = " Q:" + option3.series[1].data[param.dataIndex] + " Sm3/h" document.getElementById('console5').innerHTML = " Qb:" + option4.series[0].data[param.dataIndex] + " Sm3/h" document.getElementById('console6').innerHTML = option4.xAxis.data[param.dataIndex] document.getElementById('h-xslj').innerHTML = "小時累計供氣量" } myChart1.on('click', chartClick); myChart2.on('click', chartClick); myChart3.on('click', chartClick); myChart4.on('click', chartClick);