Skip to content

Commit ec4f53f

Browse files
[XY axis] Implement new palette service (#86876) (#88173)
* [XY Axis] New Palette service * Calculate all Series to map the colors correctly * remove commented out code * syncColors on XY plugin * Reset to false when no embeddable * Add unit test for getAllSeries function * Measure the usage of the selected palette * Minor adjustments * Update documentation for isSyncColorsEnabled method * Fix bug on changing palette on charts with no split series * Fix coloring for multiple y axis visualizations * Call getPalettes function from the renderer * Fullwidth palette picker * Fetch palette registry on the component and not on the renderer Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 34b6e79 commit ec4f53f

30 files changed

+567
-25
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExecutionContext](./kibana-plugin-plugins-expressions-public.executioncontext.md) &gt; [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md)
4+
5+
## ExecutionContext.isSyncColorsEnabled property
6+
7+
Returns the state (true\|false) of the sync colors across panels switch.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
isSyncColorsEnabled?: () => boolean;
13+
```

docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface ExecutionContext<InspectorAdapters extends Adapters = Adapters,
2222
| [getSearchContext](./kibana-plugin-plugins-expressions-public.executioncontext.getsearchcontext.md) | <code>() =&gt; ExecutionContextSearch</code> | Get search context of the expression. |
2323
| [getSearchSessionId](./kibana-plugin-plugins-expressions-public.executioncontext.getsearchsessionid.md) | <code>() =&gt; string &#124; undefined</code> | Search context in which expression should operate. |
2424
| [inspectorAdapters](./kibana-plugin-plugins-expressions-public.executioncontext.inspectoradapters.md) | <code>InspectorAdapters</code> | Adapters for <code>inspector</code> plugin. |
25+
| [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md) | <code>() =&gt; boolean</code> | Returns the state (true\|false) of the sync colors across panels switch. |
2526
| [types](./kibana-plugin-plugins-expressions-public.executioncontext.types.md) | <code>Record&lt;string, ExpressionType&gt;</code> | A map of available expression types. |
2627
| [variables](./kibana-plugin-plugins-expressions-public.executioncontext.variables.md) | <code>Record&lt;string, unknown&gt;</code> | Context variables that can be consumed using <code>var</code> and <code>var_set</code> functions. |
2728

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) &gt; [ExecutionContext](./kibana-plugin-plugins-expressions-server.executioncontext.md) &gt; [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md)
4+
5+
## ExecutionContext.isSyncColorsEnabled property
6+
7+
Returns the state (true\|false) of the sync colors across panels switch.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
isSyncColorsEnabled?: () => boolean;
13+
```

docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface ExecutionContext<InspectorAdapters extends Adapters = Adapters,
2222
| [getSearchContext](./kibana-plugin-plugins-expressions-server.executioncontext.getsearchcontext.md) | <code>() =&gt; ExecutionContextSearch</code> | Get search context of the expression. |
2323
| [getSearchSessionId](./kibana-plugin-plugins-expressions-server.executioncontext.getsearchsessionid.md) | <code>() =&gt; string &#124; undefined</code> | Search context in which expression should operate. |
2424
| [inspectorAdapters](./kibana-plugin-plugins-expressions-server.executioncontext.inspectoradapters.md) | <code>InspectorAdapters</code> | Adapters for <code>inspector</code> plugin. |
25+
| [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md) | <code>() =&gt; boolean</code> | Returns the state (true\|false) of the sync colors across panels switch. |
2526
| [types](./kibana-plugin-plugins-expressions-server.executioncontext.types.md) | <code>Record&lt;string, ExpressionType&gt;</code> | A map of available expression types. |
2627
| [variables](./kibana-plugin-plugins-expressions-server.executioncontext.variables.md) | <code>Record&lt;string, unknown&gt;</code> | Context variables that can be consumed using <code>var</code> and <code>var_set</code> functions. |
2728

src/plugins/expressions/common/execution/execution.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export class Execution<
183183
logDatatable: (name: string, datatable: Datatable) => {
184184
inspectorAdapters.tables[name] = datatable;
185185
},
186+
isSyncColorsEnabled: () => execution.params.syncColors,
186187
...(execution.params as any).extraContext,
187188
};
188189
}

src/plugins/expressions/common/execution/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ export interface ExecutionContext<
8383
type: string,
8484
id: string
8585
) => Promise<SavedObject<T>>;
86+
87+
/**
88+
* Returns the state (true|false) of the sync colors across panels switch.
89+
*/
90+
isSyncColorsEnabled?: () => boolean;
8691
}
8792

8893
/**

src/plugins/expressions/common/service/expressions_services.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ export interface ExpressionExecutionParams {
7070

7171
searchSessionId?: string;
7272

73+
syncColors?: boolean;
74+
7375
inspectorAdapters?: Adapters;
7476
}
7577

src/plugins/expressions/public/loader.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class ExpressionLoader {
154154
inspectorAdapters: params.inspectorAdapters,
155155
searchSessionId: params.searchSessionId,
156156
debug: params.debug,
157+
syncColors: params.syncColors,
157158
});
158159

159160
const prevDataHandler = this.execution;
@@ -189,6 +190,7 @@ export class ExpressionLoader {
189190
if (params.searchSessionId && this.params) {
190191
this.params.searchSessionId = params.searchSessionId;
191192
}
193+
this.params.syncColors = params.syncColors;
192194
this.params.debug = Boolean(params.debug);
193195

194196
this.params.inspectorAdapters = (params.inspectorAdapters ||

src/plugins/expressions/public/public.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export interface ExecutionContext<InspectorAdapters extends Adapters = Adapters,
143143
getSearchContext: () => ExecutionContextSearch;
144144
getSearchSessionId: () => string | undefined;
145145
inspectorAdapters: InspectorAdapters;
146+
isSyncColorsEnabled?: () => boolean;
146147
types: Record<string, ExpressionType>;
147148
variables: Record<string, unknown>;
148149
}

src/plugins/expressions/server/server.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export interface ExecutionContext<InspectorAdapters extends Adapters = Adapters,
141141
getSearchContext: () => ExecutionContextSearch;
142142
getSearchSessionId: () => string | undefined;
143143
inspectorAdapters: InspectorAdapters;
144+
isSyncColorsEnabled?: () => boolean;
144145
types: Record<string, ExpressionType>;
145146
variables: Record<string, unknown>;
146147
}

0 commit comments

Comments
 (0)