Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
docs: add color by expression definition (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbt1 authored Oct 19, 2023
1 parent 85a83f9 commit 6e4953a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
51 changes: 51 additions & 0 deletions api-specifications/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@
"entries": {
"qDef": {
"type": "#/definitions/InlineDimensionDef"
},
"qAttributeExpressions": {
"kind": "array",
"items": {
"type": "#/definitions/AttributeExpressionDef"
}
}
}
},
Expand All @@ -157,9 +163,54 @@
"entries": {
"qDefs": {
"type": "#/definitions/InlineMeasureDef"
},
"qAttributeExpressions": {
"kind": "array",
"items": {
"type": "#/definitions/AttributeExpressionDef"
}
}
}
},
"AttributeExpressionDef": {
"kind": "union",
"items": [
{
"type": "#/definitions/ColorByExpressionDef"
},
{
"type": "NxAttrExprDef"
}
]
},
"ColorByExpressionId": {
"description": "Color by expression identifier",
"kind": "union",
"items": [
{
"kind": "literal",
"value": "\"cellBackgroundColor\""
},
{
"kind": "literal",
"value": "\"cellForegroundColor\""
}
]
},
"ColorByExpressionDef": {
"kind": "object",
"entries": {
"qExpression": {
"type": "StringExpression"
},
"id": {
"type": "#/definitions/ColorByExpressionId"
}
},
"examples": [
"{ qExpression: \"=if(Sum([Sales Quantity]) > 500, green(), blue())\", id: \"cellBackgroundColor\" }"
]
},
"InlineDimensionDef": {
"description": "Extends `NxInlineDimensionDef`, see Engine API: `NxInlineDimensionDef`.",
"extends": [
Expand Down
3 changes: 3 additions & 0 deletions scriptappy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ module.exports = {
GenericObjectProperties: {
url: "https://qlik.dev/apis/json-rpc/qix/schemas#%23%2Fdefinitions%2Fschemas%2Fentries%2FGenericObjectProperties",
},
NxAttrExprDef: {
url: "https://qlik.dev/apis/json-rpc/qix/schemas#%23%2Fdefinitions%2Fschemas%2Fentries%2FNxAttrExprDef",
},
NxDimension: {
url: "https://qlik.dev/apis/json-rpc/qix/schemas#%23%2Fdefinitions%2Fschemas%2Fentries%2FNxDimension",
},
Expand Down
22 changes: 22 additions & 0 deletions src/qae/initial-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const properties = {
* @type object
* @extends NxDimension
* @property {InlineDimensionDef} qDef
* @property {AttributeExpressionDef[]} qAttributeExpressions
*/

/**
Expand All @@ -88,6 +89,27 @@ const properties = {
* @type object
* @extends NxMeasure
* @property {InlineMeasureDef} qDefs
* @property {AttributeExpressionDef[]} qAttributeExpressions
*/

/**
* @name AttributeExpressionDef
* @type {ColorByExpressionDef | NxAttrExprDef}
*/

/**
* Color by expression identifier
* @name ColorByExpressionId
* @type {"cellBackgroundColor" | "cellForegroundColor"}
*/

/**
* @name ColorByExpressionDef
* @type object
* @property {StringExpression} qExpression
* @property {ColorByExpressionId} id
* @example
* { qExpression: "=if(Sum([Sales Quantity]) > 500, green(), blue())", id: "cellBackgroundColor" }
*/

/**
Expand Down

0 comments on commit 6e4953a

Please sign in to comment.