Contents
Dimensions, Samples and Measures
In the Getting Started example, the data was defined inside the chart tag as an Object with the name “data”. The data contains two main elements: The dimensions and the values of the data cube.
data: { dimensions: [[Mon, Tue, Wed, Thu, Fri, Sat, Sun]], values: [10,20,30,80,70,50,35] }
A dimension is a list of one or more texts. Because, the data can contain more than one dimension, they are defined as a list of lists of text. The following example defines a data set with two dimensions:
data: { dimensions: [ [Mon, Tue, Wed, Thu, Fri, Sat, Sun], [Product 1, Product 2, Product 3] ], values: [ [10,20,30,80,70,50,35], [5,10,15,20,25,30,35], [1,2,3,4,5,6,7] ] }
Usually, the first dimension becomes the x-axis in the charts and the second dimension, if defined, is displayed in the legend. Some chart types, like Heat Maps, display the first dimension in the x- and the second in the y-axis.
Whenever you add an dimension to your data, you must provide more values with them. For a single dimension, the value element is only a list of numbers. For two dimensions, the value element must contain a list of lists of numbers. In the last example, the values contain 3 lists of 7 numbers, becaue the first dimension contains 7 samples and the seoncd one 3 samples.
The following examples displays the 2 dimensional data in a Line Chart:
<chart><!--{ data: { dimensions: [ [Mon, Tue, Wed, Thu, Fri, Sat, Sun], [Product 1, Product 2, Product 3] ], values: [ [10,20,30,80,70,50,35], [5,10,15,20,25,30,35], [1,2,3,4,5,6,7] ] }, type: line, width: 450, height: 250 }--></chart>