UNPKG

4.33 kBJavaScriptView Raw
1/**
2 * This object contains all possible options. It will check if the types are correct, if required if the option is one
3 * of the allowed values.
4 *
5 * __any__ means that the name of the property does not matter.
6 * __type__ is a required field for all objects and contains the allowed types of all objects
7 */
8let string = 'string';
9let bool = 'boolean';
10let number = 'number';
11let object = 'object'; // should only be in a __type__ property
12// Following not used here, but useful for reference
13//let array = 'array';
14//let dom = 'dom';
15//let any = 'any';
16
17
18let colorOptions = {
19 fill : { string },
20 stroke : { string },
21 strokeWidth: { number },
22 __type__ : { string, object, 'undefined': 'undefined' }
23};
24
25
26/**
27 * Order attempted to be alphabetical.
28 * - x/y/z-prefixes ignored in sorting
29 * - __type__ always at end
30 * - globals at end
31 */
32let allOptions = {
33 animationAutoStart: { boolean: bool, 'undefined': 'undefined' },
34 animationInterval : { number },
35 animationPreload : { boolean: bool },
36 axisColor : { string },
37 backgroundColor : colorOptions,
38 xBarWidth : { number, 'undefined': 'undefined' },
39 yBarWidth : { number, 'undefined': 'undefined' },
40 cameraPosition : {
41 distance : { number },
42 horizontal: { number },
43 vertical : { number },
44 __type__ : { object }
45 },
46 zoomable : { boolean: bool },
47 ctrlToZoom : { boolean: bool },
48 xCenter : { string },
49 yCenter : { string },
50 dataColor : colorOptions,
51 dotSizeMinFraction: { number },
52 dotSizeMaxFraction: { number },
53 dotSizeRatio : { number },
54 filterLabel : { string },
55 gridColor : { string },
56 onclick : { 'function': 'function' },
57 keepAspectRatio : { boolean: bool },
58 xLabel : { string },
59 yLabel : { string },
60 zLabel : { string },
61 legendLabel : { string },
62 xMin : { number, 'undefined': 'undefined' },
63 yMin : { number, 'undefined': 'undefined' },
64 zMin : { number, 'undefined': 'undefined' },
65 xMax : { number, 'undefined': 'undefined' },
66 yMax : { number, 'undefined': 'undefined' },
67 zMax : { number, 'undefined': 'undefined' },
68 showAnimationControls: { boolean: bool, 'undefined': 'undefined' },
69 showGrid : { boolean: bool },
70 showLegend : { boolean: bool, 'undefined': 'undefined' },
71 showPerspective : { boolean: bool },
72 showShadow : { boolean: bool },
73 showXAxis : { boolean: bool },
74 showYAxis : { boolean: bool },
75 showZAxis : { boolean: bool },
76 xStep : { number, 'undefined': 'undefined' },
77 yStep : { number, 'undefined': 'undefined' },
78 zStep : { number, 'undefined': 'undefined' },
79 style: {
80 number, // TODO: either Graph3d.DEFAULT has string, or number allowed in documentation
81 string: [
82 'bar',
83 'bar-color',
84 'bar-size',
85 'dot',
86 'dot-line',
87 'dot-color',
88 'dot-size',
89 'line',
90 'grid',
91 'surface'
92 ]
93 },
94 tooltip : { boolean: bool, 'function': 'function' },
95 tooltipStyle : {
96 content: {
97 color : { string },
98 background : { string },
99 border : { string },
100 borderRadius: { string },
101 boxShadow : { string },
102 padding : { string },
103 __type__ : { object }
104 },
105 line: {
106 borderLeft : { string },
107 height : { string },
108 width : { string },
109 pointerEvents: { string },
110 __type__ : { object }
111 },
112 dot: {
113 border : { string },
114 borderRadius : { string },
115 height : { string },
116 width : { string },
117 pointerEvents: { string },
118 __type__ : { object}
119 },
120 __type__: { object}
121 },
122 xValueLabel : { 'function': 'function' },
123 yValueLabel : { 'function': 'function' },
124 zValueLabel : { 'function': 'function' },
125 valueMax : { number, 'undefined': 'undefined' },
126 valueMin : { number, 'undefined': 'undefined' },
127 verticalRatio : { number },
128
129 //globals :
130 height: { string },
131 width: { string },
132 __type__: { object }
133};
134
135
136export {allOptions};