Back to homepage

Creating multilevel hierarchies in CSV

When working with CSV data, you can define multilevel hierarchies directly in the file.

To create a multilevel hierarchy

Step 1. Choose fields that will be the levels of the hierarchy.

Step 2. For each level, specify the full path to its parent fields using colons.

Example

Here is an example of a Country > City > District hierarchy:

Country, Country:City, Country:City:District, Invoice Date
France, Nice, Port, 8/17/2025
Germany, Munich, Schwabing, 1/5/2025
France, Nice, Port, 9/26/2025
Italy, Naples, Posillipo, 4/8/2025
USA, Los Angeles, Downtown, 5/25/2025

This demo is also available on our CodePen.

See also

When working with CSV data, you can define multilevel hierarchies directly in the file.

To create a multilevel hierarchy

Step 1. Choose fields that will be the levels of the hierarchy.

Step 2. For each level, specify the full path to its parent fields using colons.

Example

Here is an example of a Country > City > District hierarchy:

Country, Country:City, Country:City:District, Invoice Date
France, Nice, Port, 8/17/2025
Germany, Munich, Schwabing, 1/5/2025
France, Nice, Port, 9/26/2025
Italy, Naples, Posillipo, 4/8/2025
USA, Los Angeles, Downtown, 5/25/2025

This demo is also available on our CodePen.

See also

When working with CSV data, you can define multilevel hierarchies directly in the file.

To create a multilevel hierarchy

Step 1. Choose fields that will be the levels of the hierarchy.

Step 2. For each level, specify the full path to its parent fields using colons.

Example

Here is an example of a Country > City > District hierarchy:

Country, Country:City, Country:City:District, Invoice Date
France, Nice, Port, 8/17/2025
Germany, Munich, Schwabing, 1/5/2025
France, Nice, Port, 9/26/2025
Italy, Naples, Posillipo, 4/8/2025
USA, Los Angeles, Downtown, 5/25/2025

This demo is also available on our CodePen.

See also

When working with CSV data, you can define multilevel hierarchies directly in the file.

To create a multilevel hierarchy

Step 1. Choose fields that will be the levels of the hierarchy.

Step 2. For each level, specify the full path to its parent fields using colons.

Example

Here is an example of a Country > City > District hierarchy:

Country, Country:City, Country:City:District, Invoice Date
France, Nice, Port, 8/17/2025
Germany, Munich, Schwabing, 1/5/2025
France, Nice, Port, 9/26/2025
Italy, Naples, Posillipo, 4/8/2025
USA, Los Angeles, Downtown, 5/25/2025

This demo is also available on our CodePen.

See also

By default, WebDataRocks can auto-detect basic data types such as strings, numbers, and dates, but you can use all available data types to enrich your visualization. To set types explicitly, use the metadata object in JSON or data type prefixes in CSV.

After setting field data types, see the guides about connecting to the JSON or connecting to the CSV data.

Available data types

The following data types are available in WebDataRocks:

Number

This field type is used to store numbers.

Available aggregations: all.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "number":

"Price": {
"type": "number"
}

Read how to specify number values in JSON data.

CSV

Add the - data type prefix to the field name.

Here is an example of CSV data with the Quantity number (-) field:

-Quantity, Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify number values in CSV data.

String

This field type is used to store strings.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "string":

"Product": {
"type": "string"
}

Read how to specify string values in JSON data.

CSV

Add the + data type prefix to the field name.

Here is an example of CSV data with the Product string (+) field:

Quantity, +Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify string values in CSV data.

Date

WebDataRocks offers a wide range of date types. Review the options in this section to select the most suitable one.

Read how to specify date values in JSON or CSV data.

Year, Month, Day subfields

The date is divided into 3 string subfields: Year, Month, Day.

This is the default format for all date fields unless a different type is specified in the metadata object or prefixes.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date":

"Date": {
"type": "date"
}

See the example.

CSV

Add the d+ data type prefix to the field name:

d+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

Year > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/month/day":

"Date": {
"type": "year/month/day"
}

See the example.

CSV

Add the D+ data type prefix to the field name:

D+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

Year > Quarter > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Quarter > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/quarter/month/day":

"Date": {
"type": "year/quarter/month/day"
}

CSV

Add the D4+ data type prefix to the field name:

D4+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

“dd/MM/yyyy” format

The date is displayed as a string in the "dd/MM/yyyy" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the datePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date string":

"Date": {
"type": "date string"
}

CSV

Add the ds+ data type prefix to the field name:

ds+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

“dd/MM/yyyy HH:mm:ss” format

The date is displayed as a string in the "dd/MM/yyyy HH:mm:ss" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the dateTimePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "datetime":

"Date": {
"type": "datetime"
}

See the example.

CSV

Add the dt+ data type prefix to the field name:

dt+Invoice Date, Price, Country
2018-05-15T18:30:00, 329, France
2018-05-16T06:20:00, 139, Italy
2018-05-17T13:45:00, 429, Spain
2018-05-12T04:50:00, 559, Japan

Time

This field type is used to store time intervals, such as duration.

Available aggregations: Min, Max, Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "time":

"Duration": {
"type": "time"
}

See the example.

Read how to specify time values in JSON data.

CSV

Add the t+ data type prefix to the field name.

Here is an example of CSV data with the Duration time (t+) field:

t+Duration, Movie, ReleaseYears
7020, Blade Runner, 1980-1990
5220, The Lion King, 1990-2000
7560, Jurassic Park, 1990-2000
9120, The Dark Knight, 2000-2010

Read how to specify time values in CSV data.

Month

Fields of this type store months. Natural sorting is applied to the field members: from January to December.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "month":

"Month": {
"type": "month"
}

Read how to specify month values in JSON data.

CSV

Add the m+ data type prefix to the field name.

Here is an example of CSV data with the Month month (m+) field:

m+Month, Price, Country
Apr, 329, France
Feb, 139, Italy
Jan, 429, Spain
Dec, 559, Japan

Read how to specify month values in CSV data.

Weekday

Fields of this type store the days of the week. Natural sorting is applied to the field members: from Sunday to Monday.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "weekday":

"Week Day": {
"type": "weekday"
}

Read how to specify weekday values in JSON data.

CSV

Add the w+ data type prefix to the field name.

Here is an example of CSV data with the Week Day weekday (w+) field:

w+Week Day, Quantity, Country
Tuesday, 3, France
Wednesday, 4, Italy
Thursday, 2, Spain
Saturday, 2, Japan

Read how to specify weekday values in CSV data.

Level (only for JSON)

This field type means that a field is a level of a multilevel hierarchy. Level fields are stored as strings.

To mark the field as a hierarchy level, set the type property of the field’s metadata object to "level".

Available aggregations: none (fields of this type cannot be used as measures).

See the example.

Hidden (only for JSON)

This field type is used to hide fields from the report.

To mark the field as hidden, set the type property of the field’s metadata object to "hidden".

Available aggregations: none.

Note. Another way to hide fields from the report is to exclude them from the metadata object.

Automatic type detection

If you omit the field’s type in the JSON metadata object or CSV prefixes, the component detects the data type based on the field’s first value. The following data types can be auto-detected:

See the example of automatic type detection in JSON.

The results of the automatic detection may be unexpected when:

  • The first field value is null. In this case, the field type cannot be detected automatically.
  • The first field value is formatted differently from other values. For example, the first value is a number while the others are strings.
  • Field values are not formatted correctly. For example, a number was specified in hexadecimal form instead of decimal.
  • Field values may be confused with values of other types. For example, time values are processed as numbers if the "time" type is not explicitly specified.

See also

By default, WebDataRocks can auto-detect basic data types such as strings, numbers, and dates, but you can use all available data types to enrich your visualization. To set types explicitly, use the metadata object in JSON or data type prefixes in CSV.

After setting field data types, see the guides about connecting to the JSON or connecting to the CSV data.

Available data types

The following data types are available in WebDataRocks:

Number

This field type is used to store numbers.

Available aggregations: all.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "number":

"Price": {
"type": "number"
}

Read how to specify number values in JSON data.

CSV

Add the - data type prefix to the field name.

Here is an example of CSV data with the Quantity number (-) field:

-Quantity, Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify number values in CSV data.

String

This field type is used to store strings.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "string":

"Product": {
"type": "string"
}

Read how to specify string values in JSON data.

CSV

Add the + data type prefix to the field name.

Here is an example of CSV data with the Product string (+) field:

Quantity, +Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify string values in CSV data.

Date

WebDataRocks offers a wide range of date types. Review the options in this section to select the most suitable one.

Read how to specify date values in JSON or CSV data.

Year, Month, Day subfields

The date is divided into 3 string subfields: Year, Month, Day.

This is the default format for all date fields unless a different type is specified in the metadata object or prefixes.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date":

"Date": {
"type": "date"
}

See the example.

CSV

Add the d+ data type prefix to the field name:

d+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

Year > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/month/day":

"Date": {
"type": "year/month/day"
}

See the example.

CSV

Add the D+ data type prefix to the field name:

D+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

Year > Quarter > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Quarter > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/quarter/month/day":

"Date": {
"type": "year/quarter/month/day"
}

CSV

Add the D4+ data type prefix to the field name:

D4+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

“dd/MM/yyyy” format

The date is displayed as a string in the "dd/MM/yyyy" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the datePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date string":

"Date": {
"type": "date string"
}

CSV

Add the ds+ data type prefix to the field name:

ds+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

“dd/MM/yyyy HH:mm:ss” format

The date is displayed as a string in the "dd/MM/yyyy HH:mm:ss" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the dateTimePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "datetime":

"Date": {
"type": "datetime"
}

See the example.

CSV

Add the dt+ data type prefix to the field name:

dt+Invoice Date, Price, Country
2018-05-15T18:30:00, 329, France
2018-05-16T06:20:00, 139, Italy
2018-05-17T13:45:00, 429, Spain
2018-05-12T04:50:00, 559, Japan

Time

This field type is used to store time intervals, such as duration.

Available aggregations: Min, Max, Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "time":

"Duration": {
"type": "time"
}

See the example.

Read how to specify time values in JSON data.

CSV

Add the t+ data type prefix to the field name.

Here is an example of CSV data with the Duration time (t+) field:

t+Duration, Movie, ReleaseYears
7020, Blade Runner, 1980-1990
5220, The Lion King, 1990-2000
7560, Jurassic Park, 1990-2000
9120, The Dark Knight, 2000-2010

Read how to specify time values in CSV data.

Month

Fields of this type store months. Natural sorting is applied to the field members: from January to December.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "month":

"Month": {
"type": "month"
}

Read how to specify month values in JSON data.

CSV

Add the m+ data type prefix to the field name.

Here is an example of CSV data with the Month month (m+) field:

m+Month, Price, Country
Apr, 329, France
Feb, 139, Italy
Jan, 429, Spain
Dec, 559, Japan

Read how to specify month values in CSV data.

Weekday

Fields of this type store the days of the week. Natural sorting is applied to the field members: from Sunday to Monday.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "weekday":

"Week Day": {
"type": "weekday"
}

Read how to specify weekday values in JSON data.

CSV

Add the w+ data type prefix to the field name.

Here is an example of CSV data with the Week Day weekday (w+) field:

w+Week Day, Quantity, Country
Tuesday, 3, France
Wednesday, 4, Italy
Thursday, 2, Spain
Saturday, 2, Japan

Read how to specify weekday values in CSV data.

Level (only for JSON)

This field type means that a field is a level of a multilevel hierarchy. Level fields are stored as strings.

To mark the field as a hierarchy level, set the type property of the field’s metadata object to "level".

Available aggregations: none (fields of this type cannot be used as measures).

See the example.

Hidden (only for JSON)

This field type is used to hide fields from the report.

To mark the field as hidden, set the type property of the field’s metadata object to "hidden".

Available aggregations: none.

Note. Another way to hide fields from the report is to exclude them from the metadata object.

Automatic type detection

If you omit the field’s type in the JSON metadata object or CSV prefixes, the component detects the data type based on the field’s first value. The following data types can be auto-detected:

See the example of automatic type detection in JSON.

The results of the automatic detection may be unexpected when:

  • The first field value is null. In this case, the field type cannot be detected automatically.
  • The first field value is formatted differently from other values. For example, the first value is a number while the others are strings.
  • Field values are not formatted correctly. For example, a number was specified in hexadecimal form instead of decimal.
  • Field values may be confused with values of other types. For example, time values are processed as numbers if the "time" type is not explicitly specified.

See also

By default, WebDataRocks can auto-detect basic data types such as strings, numbers, and dates, but you can use all available data types to enrich your visualization. To set types explicitly, use the metadata object in JSON or data type prefixes in CSV.

After setting field data types, see the guides about connecting to the JSON or connecting to the CSV data.

Available data types

The following data types are available in WebDataRocks:

Number

This field type is used to store numbers.

Available aggregations: all.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "number":

"Price": {
"type": "number"
}

Read how to specify number values in JSON data.

CSV

Add the - data type prefix to the field name.

Here is an example of CSV data with the Quantity number (-) field:

-Quantity, Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify number values in CSV data.

String

This field type is used to store strings.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "string":

"Product": {
"type": "string"
}

Read how to specify string values in JSON data.

CSV

Add the + data type prefix to the field name.

Here is an example of CSV data with the Product string (+) field:

Quantity, +Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify string values in CSV data.

Date

WebDataRocks offers a wide range of date types. Review the options in this section to select the most suitable one.

Read how to specify date values in JSON or CSV data.

Year, Month, Day subfields

The date is divided into 3 string subfields: Year, Month, Day.

This is the default format for all date fields unless a different type is specified in the metadata object or prefixes.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date":

"Date": {
"type": "date"
}

See the example.

CSV

Add the d+ data type prefix to the field name:

d+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

Year > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/month/day":

"Date": {
"type": "year/month/day"
}

See the example.

CSV

Add the D+ data type prefix to the field name:

D+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

Year > Quarter > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Quarter > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/quarter/month/day":

"Date": {
"type": "year/quarter/month/day"
}

CSV

Add the D4+ data type prefix to the field name:

D4+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

“dd/MM/yyyy” format

The date is displayed as a string in the "dd/MM/yyyy" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the datePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date string":

"Date": {
"type": "date string"
}

CSV

Add the ds+ data type prefix to the field name:

ds+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

“dd/MM/yyyy HH:mm:ss” format

The date is displayed as a string in the "dd/MM/yyyy HH:mm:ss" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the dateTimePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "datetime":

"Date": {
"type": "datetime"
}

See the example.

CSV

Add the dt+ data type prefix to the field name:

dt+Invoice Date, Price, Country
2018-05-15T18:30:00, 329, France
2018-05-16T06:20:00, 139, Italy
2018-05-17T13:45:00, 429, Spain
2018-05-12T04:50:00, 559, Japan

Time

This field type is used to store time intervals, such as duration.

Available aggregations: Min, Max, Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "time":

"Duration": {
"type": "time"
}

See the example.

Read how to specify time values in JSON data.

CSV

Add the t+ data type prefix to the field name.

Here is an example of CSV data with the Duration time (t+) field:

t+Duration, Movie, ReleaseYears
7020, Blade Runner, 1980-1990
5220, The Lion King, 1990-2000
7560, Jurassic Park, 1990-2000
9120, The Dark Knight, 2000-2010

Read how to specify time values in CSV data.

Month

Fields of this type store months. Natural sorting is applied to the field members: from January to December.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "month":

"Month": {
"type": "month"
}

Read how to specify month values in JSON data.

CSV

Add the m+ data type prefix to the field name.

Here is an example of CSV data with the Month month (m+) field:

m+Month, Price, Country
Apr, 329, France
Feb, 139, Italy
Jan, 429, Spain
Dec, 559, Japan

Read how to specify month values in CSV data.

Weekday

Fields of this type store the days of the week. Natural sorting is applied to the field members: from Sunday to Monday.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "weekday":

"Week Day": {
"type": "weekday"
}

Read how to specify weekday values in JSON data.

CSV

Add the w+ data type prefix to the field name.

Here is an example of CSV data with the Week Day weekday (w+) field:

w+Week Day, Quantity, Country
Tuesday, 3, France
Wednesday, 4, Italy
Thursday, 2, Spain
Saturday, 2, Japan

Read how to specify weekday values in CSV data.

Level (only for JSON)

This field type means that a field is a level of a multilevel hierarchy. Level fields are stored as strings.

To mark the field as a hierarchy level, set the type property of the field’s metadata object to "level".

Available aggregations: none (fields of this type cannot be used as measures).

See the example.

Hidden (only for JSON)

This field type is used to hide fields from the report.

To mark the field as hidden, set the type property of the field’s metadata object to "hidden".

Available aggregations: none.

Note. Another way to hide fields from the report is to exclude them from the metadata object.

Automatic type detection

If you omit the field’s type in the JSON metadata object or CSV prefixes, the component detects the data type based on the field’s first value. The following data types can be auto-detected:

See the example of automatic type detection in JSON.

The results of the automatic detection may be unexpected when:

  • The first field value is null. In this case, the field type cannot be detected automatically.
  • The first field value is formatted differently from other values. For example, the first value is a number while the others are strings.
  • Field values are not formatted correctly. For example, a number was specified in hexadecimal form instead of decimal.
  • Field values may be confused with values of other types. For example, time values are processed as numbers if the "time" type is not explicitly specified.

See also

By default, WebDataRocks can auto-detect basic data types such as strings, numbers, and dates, but you can use all available data types to enrich your visualization. To set types explicitly, use the metadata object in JSON or data type prefixes in CSV.

After setting field data types, see the guides about connecting to the JSON or connecting to the CSV data.

Available data types

The following data types are available in WebDataRocks:

Number

This field type is used to store numbers.

Available aggregations: all.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "number":

"Price": {
"type": "number"
}

Read how to specify number values in JSON data.

CSV

Add the - data type prefix to the field name.

Here is an example of CSV data with the Quantity number (-) field:

-Quantity, Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify number values in CSV data.

String

This field type is used to store strings.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "string":

"Product": {
"type": "string"
}

Read how to specify string values in JSON data.

CSV

Add the + data type prefix to the field name.

Here is an example of CSV data with the Product string (+) field:

Quantity, +Product
3, Cars
4, Bikes
2, Components
2, Bikes

Read how to specify string values in CSV data.

Date

WebDataRocks offers a wide range of date types. Review the options in this section to select the most suitable one.

Read how to specify date values in JSON or CSV data.

Year, Month, Day subfields

The date is divided into 3 string subfields: Year, Month, Day.

This is the default format for all date fields unless a different type is specified in the metadata object or prefixes.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date":

"Date": {
"type": "date"
}

See the example.

CSV

Add the d+ data type prefix to the field name:

d+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

Year > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/month/day":

"Date": {
"type": "year/month/day"
}

See the example.

CSV

Add the D+ data type prefix to the field name:

D+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

Year > Quarter > Month > Day multilevel hierarchy

The date is represented as a multilevel hierarchy with the following levels: Year > Quarter > Month > Day.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "year/quarter/month/day":

"Date": {
"type": "year/quarter/month/day"
}

CSV

Add the D4+ data type prefix to the field name:

D4+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

See the example.

“dd/MM/yyyy” format

The date is displayed as a string in the "dd/MM/yyyy" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the datePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "date string":

"Date": {
"type": "date string"
}

CSV

Add the ds+ data type prefix to the field name:

ds+Invoice Date, Quantity, Country
2018-05-15, 3, France
2018-05-16, 4, Italy
2018-05-17, 2, Spain
2018-05-12, 2, Japan

“dd/MM/yyyy HH:mm:ss” format

The date is displayed as a string in the "dd/MM/yyyy HH:mm:ss" format.

Available aggregations: Min, Max, Count, Distinct Count.

The format can be changed using the dateTimePattern option.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "datetime":

"Date": {
"type": "datetime"
}

See the example.

CSV

Add the dt+ data type prefix to the field name:

dt+Invoice Date, Price, Country
2018-05-15T18:30:00, 329, France
2018-05-16T06:20:00, 139, Italy
2018-05-17T13:45:00, 429, Spain
2018-05-12T04:50:00, 559, Japan

Time

This field type is used to store time intervals, such as duration.

Available aggregations: Min, Max, Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "time":

"Duration": {
"type": "time"
}

See the example.

Read how to specify time values in JSON data.

CSV

Add the t+ data type prefix to the field name.

Here is an example of CSV data with the Duration time (t+) field:

t+Duration, Movie, ReleaseYears
7020, Blade Runner, 1980-1990
5220, The Lion King, 1990-2000
7560, Jurassic Park, 1990-2000
9120, The Dark Knight, 2000-2010

Read how to specify time values in CSV data.

Month

Fields of this type store months. Natural sorting is applied to the field members: from January to December.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "month":

"Month": {
"type": "month"
}

Read how to specify month values in JSON data.

CSV

Add the m+ data type prefix to the field name.

Here is an example of CSV data with the Month month (m+) field:

m+Month, Price, Country
Apr, 329, France
Feb, 139, Italy
Jan, 429, Spain
Dec, 559, Japan

Read how to specify month values in CSV data.

Weekday

Fields of this type store the days of the week. Natural sorting is applied to the field members: from Sunday to Monday.

Available aggregations: Count, Distinct Count.

See how to set this type for a field in your data source:

JSON

Set the type property of the field’s metadata object to "weekday":

"Week Day": {
"type": "weekday"
}

Read how to specify weekday values in JSON data.

CSV

Add the w+ data type prefix to the field name.

Here is an example of CSV data with the Week Day weekday (w+) field:

w+Week Day, Quantity, Country
Tuesday, 3, France
Wednesday, 4, Italy
Thursday, 2, Spain
Saturday, 2, Japan

Read how to specify weekday values in CSV data.

Level (only for JSON)

This field type means that a field is a level of a multilevel hierarchy. Level fields are stored as strings.

To mark the field as a hierarchy level, set the type property of the field’s metadata object to "level".

Available aggregations: none (fields of this type cannot be used as measures).

See the example.

Hidden (only for JSON)

This field type is used to hide fields from the report.

To mark the field as hidden, set the type property of the field’s metadata object to "hidden".

Available aggregations: none.

Note. Another way to hide fields from the report is to exclude them from the metadata object.

Automatic type detection

If you omit the field’s type in the JSON metadata object or CSV prefixes, the component detects the data type based on the field’s first value. The following data types can be auto-detected:

See the example of automatic type detection in JSON.

The results of the automatic detection may be unexpected when:

  • The first field value is null. In this case, the field type cannot be detected automatically.
  • The first field value is formatted differently from other values. For example, the first value is a number while the others are strings.
  • Field values are not formatted correctly. For example, a number was specified in hexadecimal form instead of decimal.
  • Field values may be confused with values of other types. For example, time values are processed as numbers if the "time" type is not explicitly specified.

See also

You can hide the spreadsheet headers with column and row numbers, which are displayed by default on the grid.

To hide column and row numbers

Set the grid.showHeaders property to false in the Options Object.

There are several ways to apply this setting, depending on whether the pivot table is configured during report initialization or at runtime:

On initialization

This approach is useful when you want spreadsheet headers to be hidden by default: 

report = {
options: {
grid: {
     showHeaders: false
    }
  }
};

At runtime

You can toggle the visibility of spreadsheet headers at runtime by using the setOptions() API call:

this.pivot.webdatarocks.setOptions({ grid: { showHeaders: false }});
this.pivot.webdatarocks.refresh();

Example

You can hide the spreadsheet headers with column and row numbers, which are displayed by default on the grid.

To hide column and row numbers

Set the grid.showHeaders property to false in the Options Object.

There are several ways to apply this setting, depending on whether the pivot table is configured during report initialization or at runtime:

On initialization

This approach is useful when you want spreadsheet headers to be hidden by default: 

const report = {
options: {
grid: {
     showHeaders: false
    }
  }
};

At runtime

You can toggle the visibility of spreadsheet headers at runtime by using the setOptions() API call:

this.$refs.pivot.webdatarocks.setOptions({ grid: { showHeaders: false }});
this.$refs.pivot.webdatarocks.refresh();

Example

Move up