I'm currently trying to get better in JavaScript and I decided challenging myself into making a website where you can track a stock portfolio. I have managed to get the chart I want with Chart.js and HTML/CSS, but the challenge now is to have it pull information about stock prices in "real-time". So the problem I'm facing is that I want to change my chart to be based on price information available online instead of having to update it myself by writing a new datapoint every time I want to update it! Underneath is the code I'm using for the chart!
<script src="Chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"> .
</script>
<script>
var ctx = document.getElementById("portChart").getContext("2d");
var chart = new Chart(ctx, {
width: 200,
height: 200,
type: "line",
data: {
labels: ["October", "November", "December", "January", "February", "March", "April"],
datasets: [{
label: "My First Portfolio",
backgroundColor: "white",
borderColor: "black",
fill: false,
data: [100, 93, 94, 100, 110, 111, 116],
}, {
label: "OSEBX",
backgroundColor: "white",
borderColor: "red",
fill: false,
data: [100, 101, 101, 105, 100, 103, 105],
}
]
},
options: {}
});
</script>
Sorry for the really noob question, but I'm kinda stuck so I really appreciate any input regarding which way to proceed!