Я пытаюсь найти Все значения хранятся в prodFamilyRunArray. Метки оси x хранятся в метках xAxis. Когда я попытался жестко закодировать значения внутри серии и напечатать, это работает. Я приложил скриншот для дальнейшего использования.
Короче говоря, невозможно получить ссылку на массив
var xAxisLabels = [];
var prodFamilyRunArray = [];
var mapOfProdFamilyNames = new Map();
$.ajax({
type: "POST",
url: '@Url.Action("GetProductFamilyName", "Automation")',
contentType: "application/json",
data: '',
dataType: "json",
success: function (data) {
for (var i = 0; i < data.length; i++) {
prodFamilyRunArray.push(5);
xAxisLabels.push(data[i].prodFamily);
mapOfProdFamilyNames.set(xAxisLabels[i], i);
}
}
});
//getProductFamilyExecutionData
$.ajax({
type: "POST",
url: '@Url.Action("getProductFamilyExecutionData", "Automation")',
contentType: "application/json",
//data:'',
dataType: "json",
success: function (data) {
console.log(data);
for (var i = 0; i < data.length; i++) {
var ind = mapOfProdFamilyNames.get(data[i].prodFamily);
prodFamilyRunArray[i] = data[i].cnt; // make i to ind here
}
//reload
// $('#container').highcharts().redraw();
// setInterval('location.reload()', 50);
}
});
console.log(xAxisLabels);
console.log(prodFamilyRunArray);
console.log(mapOfProdFamilyNames)
Highcharts.chart('container', {
credits: {
enabled: false
},
chart: {
type: 'column',
events: {
load: function () {
var series = this.series[0];
setInterval(function () {
//y = Math.random();
//series.setData([y]);
}, 1000);
}
}
},
title: {
text: 'Manual vs Automated Executions'
},
xAxis: {
categories: xAxisLabels
},
yAxis: {
allowDecimals: false,
min: 0,
title: {
text: 'Number of Executions'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.x + '</b><br/>' +
'xyx' + ': ' + this.y + '<br/>';
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
},
series: {
dataLabels: {
enabled: true,
formatter: function () {
if (this.y > 0)
return this.y;
}
},
borderWidth: 0,
maxPointWidth: 40,
/*events: {
load: function () {
var series = this.series[0];
setInterval(function () {
y = Math.random();
series.setData([y]);
}, 1000);
}
},
events: {
load: function () {
var series = this.series[0];
setInterval(function () {
y = Math.random();
series.setData([y]);
}, 1000);
}
},*/
/* events: {
click: function (event) {
//console.log(event);
//console.log(event.point.series.name)
//console.log(event.point.category.name)
}
},*/
}
},
colors: ['#18a689', '#dd8e07', '#5cbae5', '#930a0a', '#156489', '#2a6d3c', '#f33334', '#71c989', '#3fa45b'],
series: [{
name: 'Manual',
data: prodFamilyRunArray
}]
});
![enter image description here](https://i.stack.imgur.com/4bpSo.png)