I
I
Igor Pushkarsky2016-06-27 10:09:56
JavaScript
Igor Pushkarsky, 2016-06-27 10:09:56

How to update the values ​​of the axes on setData in highcharts.js?

Hello!
There was such a question, I update the data when the button is clicked, the data is updated, and the values ​​​​of the axes change 1 time and January 1 is set on the x-axis for all risks instead of numbers from the array:
Before change
After

{
  "USD": [
    ["2016-06-22", 23.17],
    ["2016-06-23", 23.78],
    ["2016-06-24", 23.17],
    ["2016-06-25", 23.78],
    ["2016-06-26", 23.17],
    ["2016-06-27", 23.78],
    ["2016-06-28", 23.17],
    ["2016-06-29", 23.78],
    ["2016-06-30", 23.17],
    ["2016-07-1", 23.78],
    ["2016-07-2", 23.17],
    ["2016-07-3", 28.78],
    ["2016-07-4", 23.78],
    ["2016-07-5", 23.17],
    ["2016-07-6", 29.78],
    ["2016-07-7", 23.17],
    ["2016-07-8", 23.78],
    ["2016-07-9", 23.17],
    ["2016-07-10", 23.78],
    ["2016-07-11", 25.17],
    ["2016-07-12", 23.78],
    ["2016-07-13", 23.17],
    ["2016-07-14", 23.78],
    ["2016-07-15", 26.17],
    ["2016-07-16", 23.78],
    ["2016-07-17", 23.17],
    ["2016-07-18", 33.78],
    ["2016-07-19", 23.17],
    ["2016-07-20", 45.78],
    ["2016-07-21", 65.17]
  ],
  "EUR": [
    ["2016-07-8", 23.78],
    ["2016-07-9", 23.17],
    ["2016-07-10", 23.78],
    ["2016-07-11", 25.17],
    ["2016-07-12", 23.78],
    ["2016-07-13", 23.17],
    ["2016-07-14", 23.78],
    ["2016-07-15", 26.17],
    ["2016-07-16", 23.78],
    ["2016-07-17", 23.17],
    ["2016-07-18", 33.78],
    ["2016-07-19", 23.17],
    ["2016-07-20", 45.78],
    ["2016-07-21", 65.17]
  ]
}

I update the data like this:
/**
   * Обновление данных на графике
   * @param data
   */
  function updateChartPoints(data) {
    chart.series[0].setData(data, false);
    chart.redraw();
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Pushkarsky, 2016-06-27
@RainMEN

The question is removed, I passed the date data to the function in the wrong format, the translation is in the form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question