Practice: rainfall + bars

Line and bar.

Line and bar. Enable Plotly under Libraries, wait until it is checked, then paste the whole editor.

Goal

Run every block and confirm the chart is visible.

document.body.innerHTML = '<div id="a" style="width:480px;height:240px"></div><div id="b" style="width:480px;height:240px"></div>';
Plotly.newPlot("a", [{ type: "bar", x: ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"], y: [21, 15, 15, 18, 12] }], { title: "Units" });
Plotly.newPlot("b", [{ type: "scatter", mode: "lines+markers", x: ["Jan", "Feb", "Mar", "Apr"], y: [48, 55, 92, 150], name: "Nairobi" }, { type: "scatter", mode: "lines+markers", x: ["Jan", "Feb", "Mar", "Apr"], y: [22, 18, 40, 80], name: "Mombasa" }], { title: "Rain" });
console.log("practice");
document.body.innerHTML = '<div id="plot" style="width:480px;height:320px"></div>';
Plotly.newPlot("plot", [{ type: "bar", x: ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"], y: [21, 15, 15, 18, 12] }], { title: "Units" });
console.log("bar");
document.body.innerHTML = '<div id="plot" style="width:480px;height:320px"></div>';
Plotly.newPlot("plot", [{ type: "scatter", mode: "lines+markers", x: ["Jan", "Feb", "Mar", "Apr"], y: [48, 55, 92, 150] }], { title: "Rain" });
console.log("line");
console.log('practice');