Charts

You are here:

TotalSheets uses 3-rd party JavaScript libraries to show any graphical results. All visualizations are carried our for each cell individually. As for the charting libraries, currently there are two supported libraries:

RGraph

jQuery Sparklines

To add a chart to a cell, CHART function can be used. The full syntax is as follows:

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

The arguments are described below:

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” or “sparklines” (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([1,2,3,4,5,6,7,8,9,10],[12,6,21,45,32,11,35,65,43,26],"sparklines","line",[{height:60,width:300,lineWidth:3,fillColor:"blue"}])
=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"}}])

Additionally to CHART function, there are two functions that can be used as a replacement:

– CHART_RGRAPH, with the syntax:

=CHART_RGRAPH(xvalues, yvalues, type, options)

– CHART_SPARKLINES, with the syntax:

=CHART_SPARKLINES(xvalues, yvalues, type, options)

As you can see, the only difference is lack of library argument.

The process of adding charts can be eased by using ‘Insert chart’ option from the menu or toolbar.

Use can choose library from the top select option. More information how to use ‘Insert chart’ option can be found in the library specific article:

RGrapg

jQuery Sparklines