Jibo_Libin
Jibo_Libin

Reputation: 119

How to use one column's value to classify data into three lines for line graph

I have a data set where column A is the algorithm, column B is the number of threads and column C is the throughput. I want to draw a line graph with number of threads as x axis and throughput as y axis. I want to draw three lines because I have three algorithms. Then I found I cannot use column one as the grouping parameter. Can anyone help?

Upvotes: 2

Views: 1441

Answers (2)

player0
player0

Reputation: 1

try:

=ARRAYFORMULA(IFERROR(QUERY({A2:A, A2:C}, 
 "select Col3,max(Col4) where Col1 is not null 
  group by Col3,Col2,Col4 pivot Col1 label Col3'x'")*1, 
 QUERY({A2:A, A2:C}, 
 "select Col3,max(Col4) where Col1 is not null 
  group by Col3,Col2,Col4 pivot Col1")))

enter image description here

Upvotes: 1

iansedano
iansedano

Reputation: 6481

Use the QUERY function.

To group terms you would have to feed the already grouped data to the chart builder. Which you can do with the QUERY function that uses SQL like language.

=QUERY(A1:C10, "select A, avg(B), avg(C) group by A")

This is what it might look like in a sheet:

enter image description here

Upvotes: 0

Related Questions