Charts (RGraph)

You are here:

RGraph is a JavaScript library that can make a wide variety of chart types and graphs on a website. We use this library as one of our basic charting libraries (alongside jQuery Sparklines). Currently only canvas based charts can be created.

CHART / CHART_RGRAPH function

To show an RGraph chart in your spreadsheet you can use a function CHART or CHART_RGRAPH. The syntax for both functions is similar, except that CHART_RGRAPH doesn’t require argument library:

=CHART(xvalues, yvalues, library, type, options)

=CHART_RGRAPH(xvalues, yvalues, type, options)

The arguments meaning:

xvalues – a sequence of numbers (1, 2, 3, 4, …) or cell addresses (A1, A2, A3, …) or a range (A1:A20) specifying labels on x-axis,

yvalues – a sequence of numbers (1, 2, 3, 4, …) or cell addresses (A1, A2, A3, …) or a range (A1:A20) specifying values on y-axis,

library – “rgraph” (with quotes, single or double) specifying library,

type – “line”, “bar”, “pie”, … (with quotes) specifying type of the chart,

options – library specific options, like thickness of the line or bar, shadow etc. Currently the full specification can be found on the library’s website. Options are not mandatory and the field can be left blank. If the value of option is set to be TRUE or FALSE, it needs to be given with quotes (“TRUE” or “true”). The same applies to the colours (“blue”).

A couple of examples:

=CHART(['Olaf','Katy','Frank','Mary','Barbara','Lee','John'],[84,76,79,84,86,52,53],"rgraph","line",[{width:500,height:300}])
=CHART([1,2,3,4,5,6,7],{bar:[[84,76,79,84,86,52,53],[34,96,39,54,76,62,23]],line:[[84,76,79,84,86,52,53],[34,96,39,54,76,62,23]]},"rgraph","combined_line_bar",[{width:500,height:300,bar:{width:500,height:300},line:{fillColor:"red"}}])

Insert chart

The process of adding charts can be eased by using ‘Insert chart’ option from the menu or toolbar. Currently, there are 21 types of RGraph charts that can be used:

Line, Bar, Horizontal Rar, Combined Line & Bar, Pie, Rose, Radar, Bipolar, Fuel, Funnel, Gantt, Gauge, Horizontal Progress, Vertical Progress, Odometer, Meter, Radial Scatter, Scatter, Semicircular Progress, Thermometer, Waterfall.

User can specify main features of the chart, specific for chosen type. A special field ‘Options’, can be used to specify additional features like colours, position of individual chart elements, etc. The options are chart type specific and can be found at RGraph reference page.