data Property
Use the Vega data
property to specify the visualization data sources by providing an array of one or more data definitions. A data definition must be an object identified by a unique name, which can be referenced in other areas of the specification. Data can be statically defined inline ("values":
), can reference columns from a database table using a SQL statement ("SQL":
), or can be loaded from an existing data set ("source":
).
JSON format:
The data specification has the following properties:
Examples
Load discrete x- and y column values using the values
database table type:
Use the sql
database table type to load latitude and longitude coordinates from the tweets_data
database table:
Use the source
type to use the data set defined in the sql
data section and perform aggregation transforms:
Data Properties
name
The name
property uniquely identifies a data set, and is used for reference by other Vega properties, such as the Marks property.
format
The format
property indicates that data preprocessing is needed before rendering the query result. If this property is not specified, data is assumed to be in row-oriented JSON format.
This property is required for Polys and Lines mark types. The property has one of two forms:
The "short form", where
format
is a single string, which must be eitherpolys
orlines
. This form is used for all polygon rendering, and for fast ‘in-situ’ rendering of LINESTRING data.The "long form", where
format
is an object containing other properties, as follows:
For lines
, each row in the query corresponds to a single line.
This lines format
example of interleaved
data renders ten lines, all of the same length.
In this lines format
example of sequential
data, x
only stores points corresponding to the x coordinate and y
only stores points corresponding to the y coordinate. Make sure that columns only contain a single coordinate if using multiple columns in sequential layout.
The following example shows a fast "in-situ" LINESTRING format
:
The following example shows a polys format
:
Data Source
The database table source property key-value pair specifies the location of the data and defines how the data is loaded:
transform
Transforms process a data stream to calculate new aggregated statistic fields and derive new data streams from them. Currently, transforms are specified only as part of a source
data definition. Transforms are defined as an array of specific transform types that are executed in sequential order. Each element of the array must be an object and must contain a type
property. Currently, two transform types are supported: aggregate
and formula
.
See Tutorial: Using Transforms for more detailed examples.
enableHitTesting
If true
, automatically adds rowid column(s) to the SQL statement where appropriate, enabling the data block for hit-testing using the get_result_row_for_pixel
endpoint.
If false
, the data block is not automatically hit-test enabled, and any later get_result_row_for_pixel
calls return empty hit-test results.
If the enableHitTesting property is not present, the following legacy behavior is used as the default:
If the SQL statement represents a projection query, hit-testing is enabled if a rowid column is explicitly projected.
If the SQL statement represents an aggregate query, hit-testing is always enabled.
This legacy behavior will likely be deprecated and removed in an upcoming version of OmniSci. At that point, the enableHitTesting property will be required for activating hit-test support for the data.
Last updated