Grid Designer
The Grid designer is available in the grid columns panel in Grid visualizations. It allows you to easily add, hide, order, and customize columns of data that may come from any internal or external source.
Hiding a column
By default, when you configure a tile all columns will be displayed. To hide a column, simply click hide for each column you wish to hide.
Restoring hidden columns
If you have previously hidden some columns that you now want restored, you can click show all columns to show visible and hidden columns (the toggle will now read show visible columns only). Columns that are currently hidden will be grayed out and have the show option instead of hide.
Tip: Filtering columns in your query
The column modifications are performed client-side, so it's still most efficient to filter the columns directly in your query or script, but if you're using an API that doesn't allow you to filter columns then this feature gets you the results you need.
Ordering columns
Changing the column order couldn't be easier, simply click and drag the gray ☰ icon to the left of the column name.
Changing the name of a column
If you want to change a column name, simply click on the existing column name in the grid options panel and enter the new name.
To restore the original name, simply delete your updated name and the column will revert to its original name.
Changing the way the data in a column is displayed
To format the way the data in a column is displayed, click edit to the right of a column to display the custom template box. You can then type your standard SquaredUp DS 'mustache' syntax and click on done when you have the column looking exactly how you want it. If you want to preview the results before you're done, click anywhere outside the text box while editing it.
A { } icon will appear next to the column edit option to indicate that a custom template has been applied.
The mustache syntax is great for converting numbers, adding units, highlighting key values or performing any other customizations you may need. For more information on mustaches see How to use Custom Labels.
Check out our GitHub Samples repository for samples around using mustache. You'll find snippets for custom labels, conversions, manipulating strings, using HTML, and many more use cases.
Property names that contain hyphens (for example properties.name-with-hyphens
) can't be processed due to a JavaScript limitation. If you want to use a property that contains a hyphen, you have two options:
- If you have access to the data source and can change the name of the property, change the name of the property to a name without hyphens.
For example, if your Elasticsearch query uses a property (an aggregation, a grouping or any other property you want to use) with a name that contains a hyphen, you can either access your Elasticsearch instance and change the name there or you can overwrite the name in the query dsl field. - If you can't change the name of the property, you need to enter the property name in the following format:
Original property name:{{properties.name-with-hyphens.value}}
New format:{{properties['name-with-hyphens'].value}}
Adding custom columns
You can dynamically construct new columns based on the data returned by your tile, which is invaluable when dealing with data sources that only support simple data retrieval, or where the API does not return data in a simple tabular form (such as many JSON based Web APIs).
To add a custom column:
- Click the add button near the bottom of the grid columns panel.
- Click the column name and change the name from customcolumn1 to the name you want to give the column.
- In the data key path box, enter the (original) name of the column or path to the desired property in the returned data (this will depend on the API you are returning data from). If you need to access the values of multiple columns (i.e. concatenating two columns together) simply leave the box empty.
- Optionally, if you want to customize the display of the column, you can enter a mustache in the custom template box
- Click done when you have finished.
Custom columns have a pencil icon in the grid options panel to indicate they have been added by a dashboard author.
Property names that contain hyphens (for example properties.name-with-hyphens
) can't be processed due to a JavaScript limitation. If you want to use a property that contains a hyphen, you have two options:
- If you have access to the data source and can change the name of the property, change the name of the property to a name without hyphens.
For example, if your Elasticsearch query uses a property (an aggregation, a grouping or any other property you want to use) with a name that contains a hyphen, you can either access your Elasticsearch instance and change the name there or you can overwrite the name in the query dsl field. - If you can't change the name of the property, you need to enter the property name in the following format:
Original property name:{{properties.name-with-hyphens.value}}
New format:{{properties['name-with-hyphens'].value}}
Using Timeago to convert Unix timestamps
You can use timeago
to convert Unix timestamps from milliseconds to show a readable date and time. You can either display an absolute time (for example, August 20th 2021) or a relative time (for example, 20 hours ago).
There are four parameters you can use for converting the time, written in the following format:
timeago(Value you want to convert, Show Absolute, Show Time, Without Suffix, With Prefix).
The parameters for the value you want to convert can either be true
or false
:
Show Absolute | true = show absolute time (date) rather than relative timefalse = show relative time |
Show Time | true = if showing absolute time, show the time as well as the datefalse = do not show the time with the date |
Without Suffix | true = if showing relative time, this removes the "ago"false = "ago" at the end will be shown (e.g. 10 hours ago) |
With Prefix | true = adds "since" ahead of the absolute time, or "for" ahead of the relative timefalse = no prefix will be shown |
Tip: The default setting for all parameters is false
. If you only want to change the first parameters, you can just use timeago(value, true, true)
and it will be interpreted as timeago(value, true, true, false, false)
.
Examples:
To display the relative time (how long ago something occurred):
{{timeago(value)}}
To display the absolute time as the date without the time:
{{timeago(value, true)}}
To display the absolute time as the date with the time:
{{timeago(value, true, true)}}
To display the time with the prefix "for" for relative time and "since" for absolute time (for example, "the status has been unhealthy for 10 hours")
Option A) Use the fourth parameter and set it to true
. This will insert the appropriate prefix for the absolute or relative time:
timeago(value, false, false, true, true)
Option B) You can leave out the fourth parameter that controls if the prefix "for" or "since" is inserted automatically. Since you left it out, it defaults to false, causing no prefix to be shown. Instead you insert the word "for" or "since" manually before the timeago function.
for timeago(value, false, false, true)
To convert a time value from seconds to milliseconds:
Some APIs, like Pingdom for example, return the value in seconds. Since Timeago uses the time value in milliseconds, you need to multiply by 1000 in that case:
{{timeago(value*1000)}}
Example with a Pingdom property:
{{timeago(properties.lasttesttime*1000)}}