This demo also showcases that the data parameter can be a function that will be passed an empty google.visualization.DataTable() giving complete control over the creation of the data
function randomData(data) {
data.addColumn("number", "Hours");
data.addColumn("number", "Temp. (C)");
for (let i = 1; i <= 25; i++) {
data.addRow([i, Math.random()]);
}
return data;
}
lava.charts([
{
// label: "This prop is optional",
type: "AreaChart",
containerId: "chart_div1",
data: randomData,
options: {
legend: "none",
colors: ["red"]
}
},
{
// default label if omitted, `containerId`,
type: "BarChart",
containerId: "chart_div2",
data: randomData,
options: {
legend: "none",
colors: ["orange"]
}
},
{
type: "ScatterChart",
containerId: "chart_div3",
data: randomData,
options: {
legend: "none",
colors: ["grey"]
}
}
]);
lava.draw();
<div id="chart_div1"></div>
<div id="chart_div2"></div>
<div id="chart_div3"></div>