Home > other >  Angular - Errors when filling a Highcharts network graph with an array
Angular - Errors when filling a Highcharts network graph with an array

Time:11-27

I try to fill a network graph made with the JS Highcharts library (see an example in that enter image description here

Now I want to fill it by using that array :

var myArray3 = [['Test 1', 'Test2'], ['Test 1', 'Test 3']];

So I write in the data part...

data : [myArray3]

... which gives a strange network graph.. I should have 3 nodes and two lines which is not the case. What's more, as you can see, I get the couples (Test1,Test2)/ (Test1,Test3) instead of Test1, Test2 and Test3.
enter image description here

How could I do to make my graph work with the data taken from my array myArray3 ?

Any help would be greatly appreciated !

CodePudding user response:

You wrapped your myArray3 unnecessarily in the brackets. The below will work:

var myArray3 = [['Test 1', 'Test2'], ['Test 1', 'Test 3']];
...
data : myArray3

https://jsfiddle.net/0rnfdjaz/6/

  • Related