K
K
Kafkae2019-05-02 13:27:11
JavaScript
Kafkae, 2019-05-02 13:27:11

How to sort out the necessary data in the graph?

Hello!
5cac45b5b4a7338526091.png
How to sort data into xAxis in Highcharts? so that there are not only 4 items from the array, but everything, in this case, strings, but there may be not only strings

const data = [
  ["custom окт", 100, "custom 12", 120, "custom 121", 500],
  ["число фу", 140, "custom 12", 150, "custom 555", 300],
  ["20 custom", 200, "custom 22", 222, "555 окт", 400],
  ["еще число бу", 80, "custom 11", 0, "555 окт", 600]
];

https://codesandbox.io/s/qxzokx6wp6
I did this but it's not correct5cac5b83d7f2442631813.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-05-02
@rockon404

items.reduce((acc, arr) => acc.concat(arr.filter(el => typeof el === 'string')), []);

or:
items.reduce((acc, arr) => [...acc, ...arr.filter(el => typeof el === 'string')], []);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question