domantasjurkus
domantasjurkus

Reputation: 69

Google Charts - Change the Order of Lines drawn

I have the following array that I wish to turn into a Google line chart:

array = [
  ['Period 12', '165', '183'],
  ['Period 11', '145', '133'],
  ['Period 10', '125', '143'],
  ...
]

The 1st column represents the label on the x-axis, the 2nd is the value for the current period and the 3rd is the value for the last period.

I am using formatters for the number values so that they show a prefix ($ or £).

I push each row into Google's TableData, I set the current trend line to be bright blue and the previous one a faded blue. This is the result:

As you can see, the previous trend line is drawn 'over' the current one. I was wondering is it possible to 'flip' the order in which they're drawn?

I've tried pushing the values of the 3rd column first and then the 2nd column AND flipping the colors of the trend lines. But in that case the popups on the points show the wrong periods (light blue becomes current period and light blue - previous period) like so:

I've check and double checked this approach, but it doesn't seem to work.

Any help is appreciated!

PS: Sorry for the links, reputation doesn't allow posting images directly.

Upvotes: 1

Views: 674

Answers (1)

Martin Husted Hartvig
Martin Husted Hartvig

Reputation: 54

Don't know if you solved the problem, but I had a similar problem with the ordering. In my case having a pointSize added to the options was the problem, eventho I changed the order of the columns. Removing the pointSize solved the problem.

Upvotes: 1

Related Questions