Some of CubesViewer features rely on your model being correctly configured. This is required, for example, in order to identify date dimensions so CubesViewer knows which dimensions can be used by date filters.
Cubes supports the "label" attribute on every object. If available, CubesViewer will show this attribute when refering to Cubes, Dimensions, Hierarchies, Levels and other Cubes objects.
CubesViewer has a "Date Filter" option that shows a special cut filter for date dimensions. In order for it to work, you need to add information to your model.
- For each date dimension, add an "info" attribute called "cv-datefilter" with "true" value.
- Optionally, also add an "info" attribute "cv-datefilter-hierarchy" if your desired date filtering hierarchy is not "default".
- For each level involved in your date filtering, add an "info" attribute "cv-datefilter-field" identifying the unit of date value (one of "year", "quarter", "month", "week" or "day").
This is an example dimension "date_created" showing this configuration:
"dimensions": [
{
"name": "date_created",
"label": "Date Created",
"info": {
"cv-datefilter": true,
"cv-datefilter-hierarchy": "weekly"
},
"levels": [
{
"name":"year",
"label":"Year",
"info": { "cv-datefilter-field": "year" }
},
{
"name":"quarter",
"label":"Quarter"
},
{
"name":"month",
"label":"Month"
},
{
"name":"week",
"label":"Week",
"info": { "cv-datefilter-field": "week" }
}
],
"hierarchies": [
{
"name": "weekly",
"label": "Weekly",
"levels": [ "year", "week"]
},
{
"name": "monthly",
"label": "Monthly",
"levels": [ "year", "quarter", "month"]
}
]
},
{
"name": "date_updated_last",
"label": "Last Update",
"template": "date_created"
},
...
CubesViewer has a "Range Filter" option that shows a special cut filter for ranges. This can be applied to simple dimensions which keys are sortable.
In order for this to work, you need to add information to your model.
- For each range dimension, add an "info" attribute called "cv-rangefilter" with "true" value.
- Optionally, also add an "info" attribute "cv-rangefilter-slider" if you wish the filter to include a slider. This attribute must be a dictionary with "min", "max" and "step" keys, as shown in the example below:
This is an example dimension "year" showing this configuration:
"dimensions": [
{
"name": "date_year",
"label": "Year",
"info": {
"cv-rangefilter": true,
"cv-rangefilter-slider": {
"min": 2006,
"max": 2012,
"step": 1
}
}
},
...
You can make CubesViewer ignore a dimension by adding a "cv-ignore" information key as shown in the example below. Ignored dimensions will not be shown by CubesViewer.
"dimensions": [
{
"name": "company",
"label": "Company",
"info": {
"cv-ignore": true
}
},
...