R
R
Roman Kuzmenko2016-09-07 22:52:23
JavaScript
Roman Kuzmenko, 2016-09-07 22:52:23

How to make two charts on one field in Chart.js?

There is angularjs + chart.js
We draw a graph of the exchange rate, from the base we get the time and what the exchange rate is at a given time + the last two values ​​for yesterday. It is necessary to display two values ​​for yesterday on one graph, and then separating the remaining values ​​for today with a "space". The graph is linear.
I now get solid lines.
An example as I would like (or should I use another library?!):
fa46cf1ad0f041ebb3557e07bdac7ac2.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepanya, 2016-09-19
@Stepanya

As I understood from the documentation, you need to do something like this

var chartInstance = new Chart(ctx, {
    type: 'line',
    data: [
      {}, // dataset 1
      {} // dataset 2
    },
    options: {
        responsive: false
    }
});

N
Nicholas, 2016-09-08
@healqq

With d3.js it is definitely possible, but there it is more time consuming. Well, svg will be a plus with d3, and as I understand it, canvas.
I suspect that in order to separate with a space in chart.js, you need to transfer different datasets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question