-
Notifications
You must be signed in to change notification settings - Fork 0
/
googleLineChart.js
32 lines (26 loc) · 1.01 KB
/
googleLineChart.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/** @author Marijus Gudiskis [email protected]*/
google.charts.load('current', {'packages':['line']});//loads the graph
/** displays the graph when called with specif size*/
function drawChart() {
//creates x and y axis and names them
var data = new google.visualization.DataTable();
data.addColumn('number', 'Num of itarations');
data.addColumn('number', 'Cost');
data.addRows(loss);//add the loss array which holds how the network is preforming
//gives the chart a name and changes its size
var options = {
chart: {
title: 'The Cost of the network',
},
width: window.innerWidth*0.4,
height: window.innerHeight*0.2
};
//crates the chart
var chart = new google.charts.Line(document.getElementById('line_top_x'));
//remove goggles error when the loss array is empty
google.visualization.events.addListener(chart, 'error', function (googleError) {
google.visualization.errors.removeError(googleError.id);
});
//shows the chart
chart.draw(data, google.charts.Line.convertOptions(options));
}