Algoteka
Log in to submit your own samples!

Plot a Line Graph

Problem by oml1111
# Tech tags Title Creator Created date
1 0
Chart.js
2022-12-16 04:23
2 0
Plotly.js
2022-12-16 03:45
View all samples for this language (2 verified and 0 unverified)

Solution | Javascript | Plotly.js |

By oml1111 |
0 likes

Renders the following interactive line graph:
Plotly.js line graph

Code

plotly.html

<head>
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>

<body>
    <div id="plotDiv"></div>
    <script src="plotly_code.js"></script>
</body>

plotly_code.js

var line = {
  x: [1, 2, 3, 5],
  y: [2, 5, 4, 6],
  type: 'scatter'
};

var data = [line];

Plotly.newPlot('plotDiv', data);

Further reading

Line Charts in JavaScript - plotly.com

References

functions
Plotly.newPlot plotly.com

Problem Description

Render a line graph. Include a picture of the line graph in the specification.

View sample discussion (0 comments)
View problem discussion (0 comments)