You can do this with Google Charts.
Assuming you have a bunch of numbers that don't necessarily match the same scale, you can just create a simple function to compare each row of numbers and adjust according to the ratio between them:
function drawVisualization() {
// add data in number form
var data = google.visualization.arrayToDataTable([
['X', 'Andrew', 'Peter'],
[100, 100, 100],
[200, 35, 65],
[400, 64, 144],
[1000, 30, 70],
[3000, 400, 1600],
]);
// adjust data
for(var i = 0; i < data.getNumberOfRows(); i++){
var valA = data.getValue(i, 1);
var valB = data.getValue(i, 2);
var valTotal = valA + valB;
data.setValue(i, 1, valA/valTotal);
data.setValue(i, 2, valB/valTotal);
};
// Create and draw the visualization.
var ac = new google.visualization.AreaChart(document.getElementById('visualization'));
ac.draw(data, {
isStacked: true,
vAxis: {format: "0%",},
width: 600,
height: 400,
});
}
This is what it ends up looking like (I really dumbed down your data, so the line isn't smoothed -- unfortunately area charts do not currently allow smoothing of the line along the lines of the curveType
option for Line Charts):