Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
gráfico dinámico de Google, no se pueden agregar nuevos datos

Llamo a las funciones updateChart(d) a través de ajax y paso nuevos datos.

 <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> var chart; var dataTable; var options; var i = 1; google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { dataTable = google.visualization.arrayToDataTable([ ['Amplitude', 'time'], ['0', 0] ]); options = { title: '', curveType: 'function', legend: { position: 'bottom' } }; chart = new google.visualization.LineChart(document.getElementById('curve_chart')); chart.draw(dataTable, options); } function updateChart(d) { i++; dataTable.setValue(i, d); // Вот тут chart.draw(dataTable, options); } </script>

Cuando trato de agregar el siguiente valor para el gráfico, arroja un error:

 Uncaught Error: Invalid row index 2. Should be in the range [0-0]

No encontré ninguna solución en Internet (Esto es para un robot, jura que no hay suficiente texto).

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

function updateChart(d) { i++; console.log(i+"======"+d); //data.setValue(i,1,d); data.addRow([String(i), Number(d)]); chart.draw(data, options); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!