Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This feature is available since v5.6.0

Sometimes there is a need to tune a data for particular chart. In those cases you can use data transformation feature to cover following needs:

  1. Convert dates to browses locale.

  2. Create additional dimensions with complex calculations.

  3. Add new rows to data or remove unneeded.

Data transformation is available only for advanced chart gadget.

Example usage of data transformation

Consider a query of min, max and average comments length per day which we want to visualize as a plot in Jira. For this need we want to create a new view with following steps:

...

  1. Go to Smart QL → New query and place following query

    Code Block
    languagesql
    SELECT 
    	floor(created to day) creationday, 
    	max(CHAR_LENGTH(body)) maxcommentlength, 
    	avg(CHAR_LENGTH(body)) avgcommentlength, 
    	min(CHAR_LENGTH(body)) mincommentlength 
    FROM 
    	CORE.comments 
    GROUP BY 
    	floor(created to day)

...

Code Block
languagejson
{
  "type": "line",
  "x": "X",
  "y": "Y",
  "color":"C",
  "plugins": [
    {
      "name": "tooltip"
    },
    {
      "name": "legend"
    },
    {
      "name": "export-to"
    }
  ]
}
Code Block
languagejs
data => data.reduce((acc, curr)=>[
  ...acc,
  {X: curr.creationday, Y: curr.maxcommentlength, C: 'max'},
  {X: curr.creationday, Y: curr.mincommentlength, C: 'min'},
  {X: curr.creationday, Y: curr.avgcommentlength, C: 'avg'}
	], [])

...