I'm new to google charts and can't seem to figure out how i would do something of the following:
I want to make a data table that has my xcord,ycord,legendlabel. I'm trying the following:
var data = google.visualization.arrayToDataTable([]);
data.addColumn("number","reps");
data.addColumn("number","weight");
data.addColumn("string","legendlabel")
data.addColumn("string","workoutname");
data.addRows([[150, 10,"workoutA"],
[300, 2,"workoutB"], //format [xcord,ycord,legendlabel]
]);
However, it isn't working obviously because we have two different types, number and string.
Is there a way i can specify the xcord, ycord then have a label for this point, then if there are multiple labels that are the same it forms a line graph?
Thanks in advance guys!
With a line chart each data line has to have a value for every point on the domain or else the line will be broken, What you want is a scatter chart
Then data for you graph should look something like this:
var data = google.visualization.arrayToDataTable([]);
data.addColumn("number","reps");
data.addColumn("number","workout1");
data.addColumn("number","workout2");
data.addRows([
[150, 10, null],
[300, null, 2,]
]);
you will want to set the lineWidth to see the trending curve
chart.draw(data, {
lineWidth: 2,
vAxis: {title: "reps"},
hAxis: {title: "weight"}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.