/** | |
* @desc plots one | |
* @param array values - array of values | |
* @param string name - name of the plot | |
* @param string xoutput - x name | |
* @param string youtput - y name | |
*/ | |
function singlePlot(values, name, xoutput, youtput) | |
{ | |
tfvis.render.scatterplot( | |
{name: name}, | |
{values}, | |
{ | |
xoutput: xoutput, | |
youtput: youtput, | |
height: 300 | |
} | |
); | |
} | |
/** | |
* @desc plots one | |
* @param json data - complete json that contains wine quality data | |
*/ | |
function displayDataFunction(data){ | |
let displayData = data.map(d => ({ | |
x: d.alcohol, | |
y: d.quality, | |
})); | |
singlePlot(displayData, 'Alchocol v Quality', 'Alchocol', 'Quality') | |
displayData = data.map(d => ({ | |
x: d.chlorides, | |
y: d.quality, | |
})); | |
singlePlot(displayData, 'Chlorides v Quality', 'Chlorides', 'Quality') | |
displayData = data.map(d => ({ | |
x: d.citric_acid, | |
y: d.quality, | |
})); | |
singlePlot(displayData, 'Citric Acid v Quality', 'Citric Acid', 'Quality') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment