0

I'm making live changing graph site using Chart.js Because I'm a noob in Js and HTML, I don't know how to post value on site. I want to post with python. I'll show you my example chart code. please tell me how to post data on my pc to the server.

And data that I want to post is "data: [860,1140,1060,1060,1070,1110,1330,2210,7830,2478]".

<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<body>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>

<script>
var xValues = [100,200,300,400,500,600,700,800,900,1000];

new Chart("myChart", {
  type: "line",
  data: {
    labels: xValues,
    datasets: [{ 
      data: [860,1140,1060,1060,1070,1110,1330,2210,7830,2478],
      backgroundColor: "rgba(0,0,255,1.0)",
      borderColor: "rgba(0,0,255,0.1)",
      fill: false,
      tension:0.1
    }]
  },
  options: {
    legend: {display: false}
  }
});
</script>
Najam Ul Saqib
  • 304
  • 3
  • 12
  • use a XMLHttpRequest to send data to your server. https://www.w3schools.com/xml/xml_http.asp – sojin Sep 09 '21 at 11:12
  • Do you have live data? – Brijesh Kalkani Sep 09 '21 at 11:12
  • 1
    What do you mean by post with python? – evolutionxbox Sep 09 '21 at 11:14
  • Welcome to Stack Overflow! Visit the [help], take the [tour] to see what and [ask]. Please first ***>>>[Search for related topics on SO](https://www.google.com/search?q=python+ajax+example+site:stackoverflow.com)<<<*** and if you get stuck, post a [mcve] of your attempt, noting input and expected output using the [`[<>]`](https://meta.stackoverflow.com/questions/358992/ive-been-told-to-create-a-runnable-example-with-stack-snippets-how-do-i-do) snippet editor. – mplungjan Sep 09 '21 at 11:17

0 Answers0