How to rotate points in charts based on values from a google CHARTS

186 views
Skip to first unread message

Uwe Dornbusch

unread,
Nov 11, 2017, 4:41:24 PM11/11/17
to Google Visualization API
I have created a line chart with several columns from a google sheets table. One of the lines is wind speed. In the table there is also a column that contains wind direction. One can show the points of the line with a triangle which can be rotate.
The issue is that the table on which the charts is based updates every 30 minutes so hardcoding the direction is not possible. How do I feed the direction from the table column dynamically into the point option?
pointShape: { type: 'triangle', rotation: 180 }
Thanks !

Ray Thomas

unread,
Nov 12, 2017, 5:57:47 PM11/12/17
to Google Visualization API
I sort of got this to work, but it might not behave as you expect. One of the problems being the triangles are equilateral so it's not clear in which direction they are actually pointing.



I don't think I've fully answered your question, but it might give you a start.

Ray

Uwe Dornbusch

unread,
Nov 13, 2017, 1:08:38 PM11/13/17
to Google Visualization API
Thanks Ray,
Good hit to use a column as style!!
And you are right, the triangle is not entirely helpful, a little arrow like this https://www.wunderground.com/forecast/gb/durham?cm_ven=localwx_10day would be great.
On the cycle home I had thought that maybe converting it into an scatter chart and using the Diffchart might be a way to have a directional line or that by using a bubble chart one could either give it colour or plot the direction as a number using the ID (though not sure if the ID can appears more than once).
I had hoped this might be more straight forward but there is always room for improvement :-)
Thanks again!

Ray Thomas

unread,
Nov 13, 2017, 8:06:48 PM11/13/17
to Google Visualization API
The weather chart I found looked a little like that except for where I live and that gave me the idea for using point styles.

A quick search showed that being able to use other shapes or images in the visualizations has come up before - https://github.com/google/google-visualization-issues/issues/2420 and someone came up with an idea that may be useful to you using angular js - https://codepen.io/nbering/pen/yNZxKr

What you could do is use a single arrow image and use CSS transform: rotate(angle).
Reply all
Reply to author
Forward
0 new messages