-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathgetChartSpecWithContext.test.ts
More file actions
73 lines (72 loc) · 1.92 KB
/
getChartSpecWithContext.test.ts
File metadata and controls
73 lines (72 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { getChartSpecWithContext } from '../../src/atom/chartGenerator/spec';
import type { GenerateChartCellContext } from '../../src/atom/chartGenerator/type';
import { ChartType } from '../../src/types';
import { DataType } from '../../src/types/base';
import { ROLE } from '../../src/types/base';
it('Linechart', () => {
const context = {
chartTypeList: [
'Bar Chart',
'Line Chart',
'Area Chart',
'Pie Chart',
'Scatter Plot',
'Word Cloud',
'Rose Chart',
'Radar Chart',
'Sankey Chart',
'Funnel Chart',
'Dual Axis Chart',
'Waterfall Chart',
'Box Plot',
'Linear Progress chart',
'Circular Progress chart',
'Liquid Chart',
'Bubble Circle Packing',
'Map Chart',
'Range Column Chart',
'Sunburst Chart',
'Treemap Chart',
'Gauge Chart',
'Basic Heat Map',
'Venn Chart',
'Dynamic Bar Chart'
],
dataTable: [
{ time: '2:00', value: 38 },
{ time: '4:00', value: 56 },
{ time: '6:00', value: 10 },
{ time: '8:00', value: 70 },
{ time: '10:00', value: 36 },
{ time: '12:00', value: 94 },
{ time: '14:00', value: 24 },
{ time: '16:00', value: 44 },
{ time: '18:00', value: 36 },
{ time: '20:00', value: 68 },
{ time: '22:00', value: 22 }
],
command: 'Generate a line chart with time on the x-axis and value on the y-axis',
cell: {
x: 'time',
y: 'value',
category: 'time'
},
transpose: false,
chartType: ChartType.LineChart.toUpperCase(),
fieldInfo: [
{
fieldName: 'time',
type: 'string',
role: 'dimension'
},
{
fieldName: 'value',
type: 'number',
role: 'dimension'
}
]
};
const { chartType, spec } = getChartSpecWithContext(context);
expect(chartType).toBe(ChartType.LineChart);
expect(spec.type).toBe('line');
});