mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[XY] system_palette
and palette
support. (#128053)
* Added support of `system_palette` and `palette` types at the `dataLayer` `palette` arg. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marta Bondyra <marta.bondyra@gmail.com>
This commit is contained in:
parent
bef90a5866
commit
2dcdbbe658
3 changed files with 42 additions and 24 deletions
|
@ -106,11 +106,11 @@ export const dataLayerConfigFunction: ExpressionFunctionDefinition<
|
|||
}),
|
||||
},
|
||||
palette: {
|
||||
default: `{theme "palette" default={system_palette name="default"} }`,
|
||||
types: ['palette', 'system_palette'],
|
||||
help: i18n.translate('expressionXY.dataLayer.palette.help', {
|
||||
defaultMessage: 'Palette',
|
||||
}),
|
||||
types: ['palette'],
|
||||
default: '{palette}',
|
||||
},
|
||||
},
|
||||
fn(input, args) {
|
||||
|
|
|
@ -113,6 +113,22 @@ Object {
|
|||
"layerId": Array [
|
||||
"first",
|
||||
],
|
||||
"palette": Array [
|
||||
Object {
|
||||
"chain": Array [
|
||||
Object {
|
||||
"arguments": Object {
|
||||
"name": Array [
|
||||
"default",
|
||||
],
|
||||
},
|
||||
"function": "system_palette",
|
||||
"type": "function",
|
||||
},
|
||||
],
|
||||
"type": "expression",
|
||||
},
|
||||
],
|
||||
"seriesType": Array [
|
||||
"area",
|
||||
],
|
||||
|
|
|
@ -480,29 +480,31 @@ const dataLayerToExpression = (
|
|||
seriesType: [layer.seriesType],
|
||||
accessors: layer.accessors,
|
||||
columnToLabel: [JSON.stringify(columnToLabel)],
|
||||
...(layer.palette
|
||||
? {
|
||||
palette: [
|
||||
{
|
||||
type: 'expression',
|
||||
chain: [
|
||||
{
|
||||
type: 'function',
|
||||
function: 'theme',
|
||||
arguments: {
|
||||
variable: ['palette'],
|
||||
default: [
|
||||
paletteService
|
||||
.get(layer.palette.name)
|
||||
.toExpression(layer.palette.params),
|
||||
],
|
||||
},
|
||||
palette: [
|
||||
{
|
||||
type: 'expression',
|
||||
chain: [
|
||||
layer.palette
|
||||
? {
|
||||
type: 'function',
|
||||
function: 'theme',
|
||||
arguments: {
|
||||
variable: ['palette'],
|
||||
default: [
|
||||
paletteService.get(layer.palette.name).toExpression(layer.palette.params),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
}
|
||||
: {
|
||||
type: 'function',
|
||||
function: 'system_palette',
|
||||
arguments: {
|
||||
name: ['default'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue