Database Reference
In-Depth Information
domain:[0,29] },
{name:"y",range:"height",nice:true,
domain:{data:"values",field:"data"}},
],
axes:[
{type:"x",scale:"x"},
{type:"y",scale:"y"}
],
The primary element of note in this last section is the linking of the data
series to the scale in the domain element. This structure is called a
DataRef , and it usually consists of a data series, identified by the data
element, and a field accessor that is defined by the field element. When
data is added to Vega an array that looks like this:
[0,1]
It is translated into a “Vega compatible” format that looks like this:
[{index:0,data:0},{index:1,data:1}]
The field accessors operate on this transformed data and expect the
inclusion of the index and data fields to operate correctly. More
complicated data structures can be accessed using the usual JavaScript dot
notation.
Defining “marks” in the specification specifies the type of chart drawn for a
given series. Like NVD3, defining multiple marks draws multiple elements
within a single chart. In this case, only a rect mark is rendered to draw the
bar chart:
marks:[{
type:"rect",
from:{data:"values"},
properties:{
enter:{
fill:{value:"#ccc"},
stroke:{value:"#aaa"}
},
update:{
Search WWH ::




Custom Search