Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

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

    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)

{
  "type": "line",
  "x": "X",
  "y": "Y",
  "color":"C",
  "plugins": [
    {
      "name": "tooltip"
    },
    {
      "name": "legend"
    },
    {
      "name": "export-to"
    }
  ]
}
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'}
	], [])

  • No labels