@thoughtspot/ts-chart-sdk 0.0.1-alpha.1 → 0.0.1-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/cjs/index.d.ts +1 -0
  2. package/cjs/index.d.ts.map +1 -1
  3. package/cjs/index.js +1 -0
  4. package/cjs/index.js.map +1 -1
  5. package/cjs/main/custom-chart-context.d.ts +10 -2
  6. package/cjs/main/custom-chart-context.d.ts.map +1 -1
  7. package/cjs/main/custom-chart-context.js +117 -2
  8. package/cjs/main/custom-chart-context.js.map +1 -1
  9. package/cjs/main/custom-chart-context.spec.js +320 -0
  10. package/cjs/main/custom-chart-context.spec.js.map +1 -1
  11. package/cjs/main/post-message-event-bridge.js +1 -1
  12. package/cjs/main/post-message-event-bridge.js.map +1 -1
  13. package/cjs/main/post-message-event-bridge.spec.js +5 -3
  14. package/cjs/main/post-message-event-bridge.spec.js.map +1 -1
  15. package/cjs/react/mocks/custom-chart-context-mock.d.ts +3 -0
  16. package/cjs/react/mocks/custom-chart-context-mock.d.ts.map +1 -0
  17. package/cjs/react/mocks/custom-chart-context-mock.js +100 -0
  18. package/cjs/react/mocks/custom-chart-context-mock.js.map +1 -0
  19. package/cjs/react/use-custom-chart-context.d.ts +4 -0
  20. package/cjs/react/use-custom-chart-context.d.ts.map +1 -0
  21. package/cjs/react/use-custom-chart-context.js +95 -0
  22. package/cjs/react/use-custom-chart-context.js.map +1 -0
  23. package/cjs/react/use-custom-chart-context.spec.d.ts +2 -0
  24. package/cjs/react/use-custom-chart-context.spec.d.ts.map +1 -0
  25. package/cjs/react/use-custom-chart-context.spec.js +391 -0
  26. package/cjs/react/use-custom-chart-context.spec.js.map +1 -0
  27. package/cjs/react/use-custom-chart-context.util.d.ts +6 -0
  28. package/cjs/react/use-custom-chart-context.util.d.ts.map +1 -0
  29. package/cjs/react/use-custom-chart-context.util.js +60 -0
  30. package/cjs/react/use-custom-chart-context.util.js.map +1 -0
  31. package/cjs/react/use-custom-chart-types.d.ts +23 -0
  32. package/cjs/react/use-custom-chart-types.d.ts.map +1 -0
  33. package/cjs/react/use-custom-chart-types.js +3 -0
  34. package/cjs/react/use-custom-chart-types.js.map +1 -0
  35. package/cjs/types/chart-to-ts-event.types.d.ts +54 -4
  36. package/cjs/types/chart-to-ts-event.types.d.ts.map +1 -1
  37. package/cjs/types/chart-to-ts-event.types.js +14 -1
  38. package/cjs/types/chart-to-ts-event.types.js.map +1 -1
  39. package/cjs/types/common.types.d.ts +2 -0
  40. package/cjs/types/common.types.d.ts.map +1 -1
  41. package/cjs/types/ts-to-chart-event.types.d.ts +23 -1
  42. package/cjs/types/ts-to-chart-event.types.d.ts.map +1 -1
  43. package/cjs/types/ts-to-chart-event.types.js +2 -0
  44. package/cjs/types/ts-to-chart-event.types.js.map +1 -1
  45. package/cjs/types/visual-prop.types.d.ts +27 -1
  46. package/cjs/types/visual-prop.types.d.ts.map +1 -1
  47. package/lib/index.d.ts +1 -0
  48. package/lib/index.d.ts.map +1 -1
  49. package/lib/index.js +1 -0
  50. package/lib/index.js.map +1 -1
  51. package/lib/main/custom-chart-context.d.ts +12 -4
  52. package/lib/main/custom-chart-context.d.ts.map +1 -1
  53. package/lib/main/custom-chart-context.js +119 -4
  54. package/lib/main/custom-chart-context.js.map +1 -1
  55. package/lib/main/custom-chart-context.spec.js +317 -0
  56. package/lib/main/custom-chart-context.spec.js.map +1 -1
  57. package/lib/main/post-message-event-bridge.js +1 -1
  58. package/lib/main/post-message-event-bridge.js.map +1 -1
  59. package/lib/main/post-message-event-bridge.spec.js +5 -3
  60. package/lib/main/post-message-event-bridge.spec.js.map +1 -1
  61. package/lib/react/mocks/custom-chart-context-mock.d.ts +3 -0
  62. package/lib/react/mocks/custom-chart-context-mock.d.ts.map +1 -0
  63. package/lib/react/mocks/custom-chart-context-mock.js +94 -0
  64. package/lib/react/mocks/custom-chart-context-mock.js.map +1 -0
  65. package/lib/react/use-custom-chart-context.d.ts +4 -0
  66. package/lib/react/use-custom-chart-context.d.ts.map +1 -0
  67. package/lib/react/use-custom-chart-context.js +68 -0
  68. package/lib/react/use-custom-chart-context.js.map +1 -0
  69. package/lib/react/use-custom-chart-context.spec.d.ts +2 -0
  70. package/lib/react/use-custom-chart-context.spec.d.ts.map +1 -0
  71. package/lib/react/use-custom-chart-context.spec.js +363 -0
  72. package/lib/react/use-custom-chart-context.spec.js.map +1 -0
  73. package/lib/react/use-custom-chart-context.util.d.ts +6 -0
  74. package/lib/react/use-custom-chart-context.util.d.ts.map +1 -0
  75. package/lib/react/use-custom-chart-context.util.js +51 -0
  76. package/lib/react/use-custom-chart-context.util.js.map +1 -0
  77. package/lib/react/use-custom-chart-types.d.ts +23 -0
  78. package/lib/react/use-custom-chart-types.d.ts.map +1 -0
  79. package/lib/react/use-custom-chart-types.js +2 -0
  80. package/lib/react/use-custom-chart-types.js.map +1 -0
  81. package/lib/types/chart-to-ts-event.types.d.ts +54 -4
  82. package/lib/types/chart-to-ts-event.types.d.ts.map +1 -1
  83. package/lib/types/chart-to-ts-event.types.js +13 -0
  84. package/lib/types/chart-to-ts-event.types.js.map +1 -1
  85. package/lib/types/common.types.d.ts +7 -5
  86. package/lib/types/common.types.d.ts.map +1 -1
  87. package/lib/types/ts-to-chart-event.types.d.ts +23 -1
  88. package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
  89. package/lib/types/ts-to-chart-event.types.js +2 -0
  90. package/lib/types/ts-to-chart-event.types.js.map +1 -1
  91. package/lib/types/visual-prop.types.d.ts +27 -1
  92. package/lib/types/visual-prop.types.d.ts.map +1 -1
  93. package/package.json +8 -2
  94. package/src/index.ts +1 -0
  95. package/src/main/custom-chart-context.spec.ts +426 -0
  96. package/src/main/custom-chart-context.ts +249 -4
  97. package/src/main/post-message-event-bridge.spec.ts +5 -3
  98. package/src/main/post-message-event-bridge.ts +1 -1
  99. package/src/react/mocks/custom-chart-context-mock.ts +114 -0
  100. package/src/react/use-custom-chart-context.spec.tsx +464 -0
  101. package/src/react/use-custom-chart-context.tsx +180 -0
  102. package/src/react/use-custom-chart-context.util.ts +101 -0
  103. package/src/react/use-custom-chart-types.ts +70 -0
  104. package/src/types/chart-to-ts-event.types.ts +215 -3
  105. package/src/types/common.types.ts +15 -1
  106. package/src/types/ts-to-chart-event.types.ts +70 -0
  107. package/src/types/visual-prop.types.ts +137 -0
  108. package/dist/ts-chart-sdk.d.ts +0 -312
  109. package/lib/dist/ts-chart-sdk.d.ts +0 -312
@@ -5,13 +5,20 @@
5
5
  *
6
6
  * Copyright: ThoughtSpot Inc. 2023
7
7
  */
8
+
8
9
  import _ from 'lodash';
9
10
  import {
11
+ AxisMenuActionHandler,
10
12
  ChartToTSEvent,
11
13
  ChartToTSEventsPayloadMap,
14
+ ContextMenuActionHandler,
15
+ CustomAction,
12
16
  ErrorType,
17
+ OpenAxisMenuEventPayload,
18
+ OpenContextMenuEventPayload,
13
19
  } from '../types/chart-to-ts-event.types';
14
20
  import {
21
+ AppConfig,
15
22
  ChartConfig,
16
23
  ChartModel,
17
24
  ValidationResponse,
@@ -19,8 +26,10 @@ import {
19
26
  } from '../types/common.types';
20
27
  import { ChartConfigEditorDefinition } from '../types/configurator.types';
21
28
  import {
29
+ AxisMenuCustomActionPayload,
22
30
  ChartConfigValidateEventPayload,
23
31
  ChartModelUpdateEventPayload,
32
+ ContextMenuCustomActionPayload,
24
33
  DataUpdateEventPayload,
25
34
  GetDataQueryPayload,
26
35
  GetDataQueryResponsePayload,
@@ -54,7 +63,10 @@ export type CustomChartContextProps = {
54
63
  * @returns {@link Array<Query>}
55
64
  * @version SDK: 0.1 | ThoughtSpot:
56
65
  */
57
- getQueriesFromChartConfig: (chartConfig: ChartConfig[]) => Query[];
66
+ getQueriesFromChartConfig: (
67
+ chartConfig: ChartConfig[],
68
+ chartModel: ChartModel,
69
+ ) => Query[];
58
70
  /**
59
71
  * Main Render function that will render the chart based on the chart context provided
60
72
  *
@@ -104,6 +116,8 @@ export type CustomChartContextProps = {
104
116
  * on the TS app. If not provided, visual properties will not be configurable in
105
117
  * editor
106
118
  *
119
+ * @param chartModel
120
+ * @returns {@link VisualPropEditorDefinition}
107
121
  * @version SDK: 0.1 | ThoughtSpot:
108
122
  */
109
123
  visualPropEditorDefinition?: VisualPropEditorDefinition;
@@ -116,7 +130,6 @@ const DEFAULT_CHART_CONTEXT_PROPS: Partial<CustomChartContextProps> = {
116
130
  validateConfig: () => ({ isValid: true }),
117
131
  validateVisualProps: () => ({ isValid: true }),
118
132
  chartConfigEditorDefinition: undefined,
119
- visualPropEditorDefinition: undefined,
120
133
  };
121
134
 
122
135
  export class CustomChartContext {
@@ -148,6 +161,13 @@ export class CustomChartContext {
148
161
  */
149
162
  private chartModel: ChartModel = {} as any;
150
163
 
164
+ /**
165
+ * App Config object. This contains the app state like locale and timezones.
166
+ *
167
+ * @version SDK: 0.1 | ThoughtSpot:
168
+ */
169
+ private appConfig: AppConfig = {};
170
+
151
171
  /**
152
172
  * Chart Props Object to define the workflow of the application
153
173
  *
@@ -184,6 +204,22 @@ export class CustomChartContext {
184
204
  */
185
205
  private triggerInitResolve: () => void = _.noop;
186
206
 
207
+ /**
208
+ * Stores the callbacks of context menu custom action based on custom action id
209
+ *
210
+ * @returns {@link ContextMenuActionHandler}
211
+ * @version SDK: 0.1 | ThoughtSpot:
212
+ */
213
+ private contextMenuActionHandler: ContextMenuActionHandler = {};
214
+
215
+ /**
216
+ * Stores the callbacks of axis menu custom action based on custom action id
217
+ *
218
+ * @returns {@link AxisMenuActionHandler}
219
+ * @version SDK: 0.1 | ThoughtSpot:
220
+ */
221
+ private axisMenuActionHandler: AxisMenuActionHandler = {};
222
+
187
223
  /**
188
224
  * Constructor to only accept context props as payload
189
225
  *
@@ -232,6 +268,21 @@ export class CustomChartContext {
232
268
  this.eventListeners[eventType].push(callbackFn);
233
269
  }
234
270
 
271
+ /**
272
+ * Removes specific event listeners on the chart context.
273
+ *
274
+ * @param {T} eventType
275
+ * @returns void
276
+ */
277
+ public off<T extends keyof TSToChartEventsPayloadMap>(eventType: T): void {
278
+ if (_.isNil(this.eventListeners[eventType])) {
279
+ console.log('No event listener found to remove');
280
+ this.eventListeners[eventType] = [];
281
+ return;
282
+ }
283
+ this.eventListeners[eventType].splice(0, 1);
284
+ }
285
+
235
286
  /**
236
287
  * Add internal event listeners on the chart context with the required callback.
237
288
  *
@@ -268,6 +319,107 @@ export class CustomChartContext {
268
319
  */
269
320
  public getChartModel = (): ChartModel => this.chartModel;
270
321
 
322
+ /**
323
+ * Getter for the chart model object
324
+ *
325
+ * @version SDK: 0.1 | ThoughtSpot:
326
+ */
327
+ public getAppConfig = (): AppConfig => this.appConfig;
328
+
329
+ /**
330
+ * Function to store the context menu custom action callback mapped with action id
331
+ * @param {[OpenContextMenuEventPayload]} eventPayload Event payload bound
332
+ * to the type of the event
333
+ * @returns payload
334
+ */
335
+ public contextMenuCustomActionPreProcessor(
336
+ eventPayload: [OpenContextMenuEventPayload],
337
+ ): [OpenContextMenuEventPayload] {
338
+ // clear out the stored custom events callback for context menu
339
+ this.contextMenuActionHandler = {};
340
+ if (_.isEmpty(eventPayload?.[0]?.customActions)) {
341
+ return eventPayload;
342
+ }
343
+ eventPayload?.[0]?.customActions?.forEach((action: CustomAction) => {
344
+ this.contextMenuActionHandler[action.id] = action.onClick;
345
+ });
346
+ const processedCustomActions = eventPayload[0]?.customActions?.map(
347
+ (action: CustomAction) => {
348
+ return {
349
+ id: action.id,
350
+ label: action.label,
351
+ icon: action.icon,
352
+ };
353
+ },
354
+ );
355
+ const processedPayload: [OpenContextMenuEventPayload] = [
356
+ {
357
+ ...eventPayload[0],
358
+ customActions: processedCustomActions as CustomAction[],
359
+ },
360
+ ];
361
+ return processedPayload;
362
+ }
363
+
364
+ /**
365
+ * Function to store the axis menu custom action callback mapped with action id
366
+ * @param {[OpenAxisMenuEventPayload]} eventPayload Event payload bound
367
+ * to the type of the event
368
+ * @returns payload
369
+ */
370
+ public axisMenuCustomActionPreProcessor(
371
+ eventPayload: [OpenAxisMenuEventPayload],
372
+ ): [OpenAxisMenuEventPayload] {
373
+ // clear out the stored custom events callback for axis menu
374
+ this.axisMenuActionHandler = {};
375
+ if (_.isEmpty(eventPayload?.[0]?.customActions)) {
376
+ return eventPayload;
377
+ }
378
+ eventPayload[0].customActions?.forEach((action: CustomAction) => {
379
+ this.axisMenuActionHandler[action.id] = action.onClick;
380
+ });
381
+ const processedCustomActions = eventPayload?.[0].customActions?.map(
382
+ (action: CustomAction) => {
383
+ return {
384
+ id: action.id,
385
+ label: action.label,
386
+ icon: action.icon,
387
+ };
388
+ },
389
+ );
390
+ const processedPayload: [OpenAxisMenuEventPayload] = [
391
+ {
392
+ ...eventPayload[0],
393
+ customActions: processedCustomActions as CustomAction[],
394
+ },
395
+ ];
396
+ return processedPayload;
397
+ }
398
+
399
+ /**
400
+ * Function to process the event payload based on event type
401
+ * @param {ChartToTSEventsPayloadMap[T]} eventPayload Event payload bound
402
+ * to the type of the event
403
+ * @returns payload
404
+ */
405
+ private eventPayloadPreProcessor<T extends keyof ChartToTSEventsPayloadMap>(
406
+ eventType: T,
407
+ eventPayload: ChartToTSEventsPayloadMap[T],
408
+ ): ChartToTSEventsPayloadMap[T] {
409
+ switch (eventType) {
410
+ case ChartToTSEvent.OpenContextMenu:
411
+ return this.contextMenuCustomActionPreProcessor(
412
+ eventPayload as [OpenContextMenuEventPayload],
413
+ ) as ChartToTSEventsPayloadMap[T];
414
+ case ChartToTSEvent.OpenAxisMenu:
415
+ return this.axisMenuCustomActionPreProcessor(
416
+ eventPayload as [OpenAxisMenuEventPayload],
417
+ ) as ChartToTSEventsPayloadMap[T];
418
+ default:
419
+ return eventPayload;
420
+ }
421
+ }
422
+
271
423
  /**
272
424
  * Function to emit Chart to TS Events to the TS application.
273
425
 
@@ -286,10 +438,14 @@ export class CustomChartContext {
286
438
  );
287
439
  return Promise.reject(new Error('Context not initialized'));
288
440
  }
441
+ const processedPayload = this.eventPayloadPreProcessor(
442
+ eventType,
443
+ eventPayload,
444
+ );
289
445
  return PostMessageEventBridge.postMessageToHostApp(
290
446
  this.componentId,
291
447
  this.hostUrl,
292
- eventPayload?.[0] ?? null,
448
+ processedPayload?.[0] ?? null,
293
449
  eventType,
294
450
  );
295
451
  }
@@ -417,6 +573,7 @@ export class CustomChartContext {
417
573
  const queries =
418
574
  this.chartContextProps.getQueriesFromChartConfig(
419
575
  payload.config,
576
+ this.chartModel,
420
577
  );
421
578
  return {
422
579
  queries,
@@ -431,6 +588,94 @@ export class CustomChartContext {
431
588
  this.chartContextProps.renderChart(this);
432
589
  });
433
590
 
591
+ /**
592
+ * This event is triggered when the custom context action is triggered from TS app
593
+ */
594
+ this.onInternal(
595
+ TSToChartEvent.ContextMenuActionClick,
596
+ (
597
+ payload: ContextMenuCustomActionPayload,
598
+ ): {
599
+ isValid: boolean;
600
+ error?: unknown;
601
+ } => {
602
+ try {
603
+ const {
604
+ id: customActionCallback,
605
+ clickedPoint,
606
+ selectedPoints,
607
+ event,
608
+ } = payload.customAction;
609
+ const customActionCallbackArgs = {
610
+ id: customActionCallback,
611
+ clickedPoint,
612
+ selectedPoints,
613
+ event,
614
+ };
615
+ this.contextMenuActionHandler[customActionCallback](
616
+ customActionCallbackArgs,
617
+ );
618
+ return {
619
+ isValid: true,
620
+ };
621
+ } catch (error: unknown) {
622
+ console.log(
623
+ 'ContextMenuCustomAction: payload recieved:',
624
+ payload,
625
+ 'CustomActionCallbackStore:',
626
+ this.axisMenuActionHandler,
627
+ );
628
+ return {
629
+ isValid: false,
630
+ error,
631
+ };
632
+ }
633
+ },
634
+ );
635
+
636
+ /**
637
+ * This event is triggered when the custom axis action is triggered from TS app
638
+ */
639
+ this.onInternal(
640
+ TSToChartEvent.AxisMenuActionClick,
641
+ (
642
+ payload: AxisMenuCustomActionPayload,
643
+ ): {
644
+ isValid: boolean;
645
+ error?: unknown;
646
+ } => {
647
+ try {
648
+ const {
649
+ id: customActionCallback,
650
+ columnIds,
651
+ event,
652
+ } = payload.customAction;
653
+ const customActionCallbackArgs = {
654
+ id: customActionCallback,
655
+ columnIds,
656
+ event,
657
+ };
658
+ this.axisMenuActionHandler[customActionCallback](
659
+ customActionCallbackArgs,
660
+ );
661
+ return {
662
+ isValid: true,
663
+ };
664
+ } catch (error: unknown) {
665
+ console.log(
666
+ 'AxisMenuCustomAction: payload recieved:',
667
+ payload,
668
+ 'CustomActionCallbackStore:',
669
+ this.axisMenuActionHandler,
670
+ );
671
+ return {
672
+ isValid: false,
673
+ error,
674
+ };
675
+ }
676
+ },
677
+ );
678
+
434
679
  // Register External Events
435
680
  // These events are readable by the developer
436
681
 
@@ -501,6 +746,7 @@ export class CustomChartContext {
501
746
  this.componentId = payload.componentId;
502
747
  this.hostUrl = payload.hostUrl;
503
748
  this.chartModel = payload.chartModel;
749
+ this.appConfig = payload.appConfig ?? {};
504
750
 
505
751
  return this.publishChartContextPropsToHost();
506
752
  };
@@ -534,7 +780,6 @@ export class CustomChartContext {
534
780
  this.chartModel,
535
781
  );
536
782
  }
537
-
538
783
  return {
539
784
  isConfigValid: isValid,
540
785
  defaultChartConfig,
@@ -13,7 +13,7 @@ describe('postMessageToHostApp', () => {
13
13
  jest.resetAllMocks();
14
14
  });
15
15
 
16
- test('should resolve the promise with null when successful', async () => {
16
+ test('should resolve the promise with data object when successful', async () => {
17
17
  // Mock the necessary variables and functions
18
18
  const componentId = '123';
19
19
  const hostUrl = 'https://example.com';
@@ -39,7 +39,9 @@ describe('postMessageToHostApp', () => {
39
39
  );
40
40
 
41
41
  // Simulate a successful response
42
- const response = { data: { hasError: false } };
42
+ const response = {
43
+ data: { hasError: false, randomData: 'randomString' },
44
+ };
43
45
  if (_.isFunction(channel.port1.onmessage)) {
44
46
  (channel.port1.onmessage as any)(response);
45
47
  } else {
@@ -48,7 +50,7 @@ describe('postMessageToHostApp', () => {
48
50
  }
49
51
 
50
52
  // Wait for the promise to resolve
51
- await expect(promise).resolves.toBeNull();
53
+ await expect(promise).resolves.toEqual(response.data);
52
54
 
53
55
  // Verify that the postMessage function was called with the correct
54
56
  // arguments
@@ -44,7 +44,7 @@ const postMessageToHostApp = (
44
44
  reject(error);
45
45
  } else {
46
46
  console.log('ChartContext: message success:', res.data);
47
- resolve(null);
47
+ resolve(res.data);
48
48
  }
49
49
  };
50
50
 
@@ -0,0 +1,114 @@
1
+ import _ from 'lodash';
2
+ import { CustomChartContextProps } from '../../main/custom-chart-context';
3
+ import { ColumnType } from '../../types/answer-column.types';
4
+ import { ChartConfig, ChartModel } from '../../types/common.types';
5
+ import { Query } from '../../types/ts-to-chart-event.types';
6
+
7
+ export const contextChartProps: CustomChartContextProps = {
8
+ getDefaultChartConfig: (chartModel: ChartModel): ChartConfig[] => {
9
+ const cols = chartModel.columns;
10
+
11
+ const measureColumns = _.filter(
12
+ cols,
13
+ (col) => col.type === ColumnType.MEASURE,
14
+ );
15
+
16
+ const attributeColumns = _.filter(
17
+ cols,
18
+ (col) => col.type === ColumnType.ATTRIBUTE,
19
+ );
20
+
21
+ const axisConfig: ChartConfig = {
22
+ key: 'column',
23
+ dimensions: [
24
+ {
25
+ key: 'x',
26
+ columns: [attributeColumns[0]],
27
+ },
28
+ {
29
+ key: 'y',
30
+ columns: measureColumns.slice(0, 2),
31
+ },
32
+ ],
33
+ };
34
+ return [axisConfig];
35
+ },
36
+ getQueriesFromChartConfig: (chartConfig: ChartConfig[]): Array<Query> => {
37
+ const queries = chartConfig.map(
38
+ (config: ChartConfig): Query =>
39
+ _.reduce(
40
+ config.dimensions,
41
+ (acc: Query, dimension) => ({
42
+ queryColumns: [
43
+ ...acc.queryColumns,
44
+ ...dimension.columns,
45
+ ],
46
+ }),
47
+ {
48
+ queryColumns: [],
49
+ } as Query,
50
+ ),
51
+ );
52
+ return queries;
53
+ },
54
+ chartConfigEditorDefinition: [
55
+ {
56
+ key: 'column',
57
+ label: 'Custom Column',
58
+ descriptionText:
59
+ 'X Axis can only have attributes, Y Axis can only have measures, Color can only have attributes. ' +
60
+ 'Should have just 1 column in Y axis with colors columns.',
61
+ columnSections: [
62
+ {
63
+ key: 'x',
64
+ label: 'Custom X Axis',
65
+ allowAttributeColumns: true,
66
+ allowMeasureColumns: false,
67
+ allowTimeSeriesColumns: true,
68
+ maxColumnCount: 1,
69
+ },
70
+ {
71
+ key: 'y',
72
+ label: 'Custom Y Axis',
73
+ allowAttributeColumns: false,
74
+ allowMeasureColumns: true,
75
+ allowTimeSeriesColumns: false,
76
+ },
77
+ ],
78
+ },
79
+ ],
80
+ visualPropEditorDefinition: {
81
+ elements: [
82
+ {
83
+ key: 'color',
84
+ type: 'radio',
85
+ defaultValue: 'red',
86
+ values: ['red', 'green', 'yellow'],
87
+ label: 'Colors',
88
+ },
89
+ {
90
+ type: 'section',
91
+ key: 'accordion',
92
+ label: 'Accordion',
93
+ children: [
94
+ {
95
+ key: 'Color2',
96
+ type: 'radio',
97
+ defaultValue: 'blue',
98
+ values: ['blue', 'white', 'red'],
99
+ label: 'Color2',
100
+ },
101
+ {
102
+ key: 'datalabels',
103
+ type: 'toggle',
104
+ defaultValue: false,
105
+ label: 'Data Labels',
106
+ },
107
+ ],
108
+ },
109
+ ],
110
+ },
111
+ renderChart: (cx) => {
112
+ return Promise.resolve();
113
+ },
114
+ };