[image: sss.png]
Hello, im reading 2 variables over Labview named var_x and var_z then
drawing chart on their values. I cant manage to draw blue (var_x) line as
picture show.
there is code if anyone can help me and change it:
google.charts.load('current', {'packages':['corechart']});
var numbersFromLabView = [];
var time = [];
$('.viewbutton').click(function() {
// Zovi api poziv i dohvati podatke svako 2 sec
$('#portfolio').addClass('hidden');
$('#element-di-zivi-aplikacija').removeClass('hidden');
setInterval(getDataFromLabView, 2000);
});
function getDataFromLabView() {
var jsonData = $.ajax({
url: 'projectXHTTP',
dataType: 'json',
success: function (jsonArray) {
var zadnjiBroj = jsonArray[0];
var zadnjiBrojy = jsonArray[1];
drawChart(zadnjiBroj, zadnjiBrojy );
$(document.querySelector('.current-number')) .text(zadnjiBroj);
$(document.querySelector('.current-numbery')) .text(zadnjiBrojy);
}
});
}
function drawChart(number,number) {
var data = new google.visualization.DataTable();
moment.locale('hr');
time.push(moment());
numbersFromLabView.push(number);
data.addColumn('string', 'Time of Day');
data.addColumn('number', 'var_x');
data.addColumn('number', 'var_y');
numbersFromLabView.forEach((number, key) => {
// za svaki broj koji dohvati ubaci njega i vrijeme u data Objekt
data.addRow([time[key].format('LTS'), number, number]);
});
var options = {
background: 'transparent',
title: 'Numeric values from LabView on time scale',
height: '500px',
width: '100%',
hAxis: {
title: 'Vrijeme',
},
vAxis: {
title: 'STRUJA_I',
}
}
var chart = new google.visualization.LineChart(document.querySelector(
'#chart_div'));
chart.draw(data, data, options);
}
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/e048b4bc-77f7-459d-9ef8-edc863515ce9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.