I got that solved. I just forgot the new. It was something to the effect of "Cannot call setColumns on undefined".
I do need help however on figuring out why it seems the values being used for the calculations are the column numbers instead of the column values.
var view = new google.visualization.DataView(non_grouped);
/* Non_grouped Columns
0 - Date, 1 - Shift, 2-Press, 3- Mold,
4 - Downtime, 5 - Scheduled, 6 - Uptime,
7 - Target, 8- Scrapped, 9- Made
*/
view.setColumns([0,1,2,3,
{calc: getAvail(4,6), type: 'number'},
{calc: getPerf(9,7,6), type: 'number'},
{calc: getQual(9, 8), type: 'number'},
{calc: getOEE(4,7,6,9,8), type: 'number'}]);
/* View Columns
0 - Date, , 1 - Shift, 2 - Press, 3 - Mold
4 - Availability, 5 - Performance, 6 - Quality, 7 - OEE
*/
showThis = new google.visualization.data.group(view, [0],
[{column: 4, aggregation: google.visualization.data.avg, type: 'number'},
{column: 5, aggregation: google.visualization.data.avg, type: 'number'},
{column: 6, aggregation: google.visualization.data.avg, type: 'number'},
{column: 7, aggregation: google.visualization.data.avg, type: 'number'}]);
var chart = new google.visualization.LineChart(document.getElementById('chart-oee'));
chart.draw(showThis, options);
$(curTab).show();
}
});
}
function getAvail(d,u){
return u/(u+d);
}
function getPerf(p,t,u){
return (p*t)/u;
}
function getQual(p, s){
return (p-s)/p;
}
function getOEE(d,t,u,p,s){
var avail = getAvail(d,u);
var perf = getPerf(p,t,u);
var qual = getQual(p,s);
return avail*perf*qual;