0

so here's the deal:

I have this array:

var g = {"e":[[1458642397809,104],[1458642467849,104],[1458642537847,107],[1458642607815,107]]};

I want to use this data to make a graph with highcharts, so here's my code:

$(function() {
$('#container').highcharts({
    chart: {
        defaultSeriesType: 'spline',
        zoomType:'x',
    },
    title: {
        text: 'title'
    },
    yAxis: {
        title: 'y',
        min: '0'
    },
    xAxis: {
        title: 'Date',
        type: 'datetime',
        tickPixelInterval: 150,
        maxZoom: 20 * 1000
    },
    series: [{
      name:"title",
      data: [[1458642397809,104]
    }]
  });
});

the thing is, i need to transform my array

{"e":[[1458642397809,104],[1458642467849,104],[1458642537847,107],[1458642607815,107]]};

into this

[[1458642397809,104],[1458642467849,104],[1458642537847,107],[1458642607815,107]]

i tried multiple things but none of them seems to work, so I would love to have your help

2
  • 2
    var newArr = g.e ? Commented Mar 22, 2016 at 12:59
  • Oh my god guys, I am so embarrassed right now. Sorry to have asked such a silly quesition :$ Commented Mar 22, 2016 at 13:05

1 Answer 1

1
var newArray = g.e; // [[1458642397809,104],[1458642467849,104],[1458642537847,107],[1458642607815,107]]

it will even contain the same reference, have i understood you correctly ?

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, i'm quite tired and relatively new with js, sorry for my silly question! :x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.