0
從D3移動到Highcharts,這是躲避我。我有一個相當複雜的對象,它包含一個clickthrough
對象,需要在功能訪問上點點擊在系列。我使用數據和名稱創建了系列數組,只需進行小型轉換,但我需要將此對象附加到數據點。不知道如何。連接對象Highcharts單擊事件
快速例子。原始數據:
[
{
"key": "Super Cool Thing",
"format": ".2f",
"values": [
{
"label": "01",
"value": 9.5,
"format": ".2f",
"order": 0,
"tooltip": "numerator = 133, denominator = 14",
"clickthrough": {
"output_format": "json",
"metrics": "",
"options": {
"columns": [
{
"order": 1,
"display_as": "Brand",
"format": "{0}",
"name": "brand",
"data_type": "string"
},
{
"order": 2,
"display_as": "Last Submit Time (Month)",
"format": "%m",
"name": "last-submit-time-month",
"data_type": "datetime"
},
{
"order": 3,
"display_as": "Agent Things",
"format": "{0}",
"name": "agent-thing-values",
"data_type": "string"
}
]
},
"cut_y": "brand",
"type": "",
"filter": { },
"cut_x": "last-submit-time-month"
},
"metrics": [
{
"name": "Agent - Feel Appreciated Mean",
"slug": "qcustomersatr4-mean"
}
]
}
]
}
]
通過(超快速POC)本功能運行:
for(let i = 0; i < data.length; i++){
var values = [];
var xcuts = [];
data[i].values.forEach(val => {
values.push(val.value);
xcuts.push(val.label);
});
chart.addSeries({
name: data[i].key,
data: values
})
chart.xAxis[0].setCategories(xcuts);
}
而這一切工作正常。但我需要的clickthrough
對象,以便我可以這樣做:
plotOptions: {
series: {
allowPointSelect: true,
cursor: 'pointer',
point: {
events: {
click: function (event) {
console.log('CLICKTHROUGH DATA HERE');
console.log(event.point);
}
}
}
},
},
我不能確定如何將一系列數據格式包括附加的數據是在事件後的功能上下行訪問。我現在通過d3做到這一點,這很好,但我正在用Highcharts方法來做同樣的事情。看來我不能隨意添加我想要的任何系列或數據,所以這可能嗎?