@operato/scene-chartjs 0.0.5

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 (114) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +21 -0
  4. package/assets/bar-chart.png +0 -0
  5. package/assets/doughnut-chart.png +0 -0
  6. package/assets/horizontal-bar-chart.png +0 -0
  7. package/assets/line-chart.png +0 -0
  8. package/assets/mixed-chart.png +0 -0
  9. package/assets/pie-chart.png +0 -0
  10. package/assets/polar-area-chart.png +0 -0
  11. package/assets/radar-chart.png +0 -0
  12. package/demo/bar.html +266 -0
  13. package/demo/chartjs.html +73 -0
  14. package/demo/index.html +547 -0
  15. package/demo/legend.html +267 -0
  16. package/demo/things-scene-chartjs.html +7 -0
  17. package/dist/chartjs.d.ts +27 -0
  18. package/dist/chartjs.js +109 -0
  19. package/dist/chartjs.js.map +1 -0
  20. package/dist/config-converter.d.ts +1 -0
  21. package/dist/config-converter.js +343 -0
  22. package/dist/config-converter.js.map +1 -0
  23. package/dist/editors/index.d.ts +5 -0
  24. package/dist/editors/index.js +11 -0
  25. package/dist/editors/index.js.map +1 -0
  26. package/dist/editors/property-editor-chartjs-abstract.d.ts +44 -0
  27. package/dist/editors/property-editor-chartjs-abstract.js +250 -0
  28. package/dist/editors/property-editor-chartjs-abstract.js.map +1 -0
  29. package/dist/editors/property-editor-chartjs-hbar.d.ts +9 -0
  30. package/dist/editors/property-editor-chartjs-hbar.js +160 -0
  31. package/dist/editors/property-editor-chartjs-hbar.js.map +1 -0
  32. package/dist/editors/property-editor-chartjs-mixed.d.ts +20 -0
  33. package/dist/editors/property-editor-chartjs-mixed.js +193 -0
  34. package/dist/editors/property-editor-chartjs-mixed.js.map +1 -0
  35. package/dist/editors/property-editor-chartjs-multi-series-abstract.d.ts +31 -0
  36. package/dist/editors/property-editor-chartjs-multi-series-abstract.js +373 -0
  37. package/dist/editors/property-editor-chartjs-multi-series-abstract.js.map +1 -0
  38. package/dist/editors/property-editor-chartjs-pie.d.ts +14 -0
  39. package/dist/editors/property-editor-chartjs-pie.js +70 -0
  40. package/dist/editors/property-editor-chartjs-pie.js.map +1 -0
  41. package/dist/editors/property-editor-chartjs-radar.d.ts +10 -0
  42. package/dist/editors/property-editor-chartjs-radar.js +42 -0
  43. package/dist/editors/property-editor-chartjs-radar.js.map +1 -0
  44. package/dist/editors/property-editor-chartjs-styles.d.ts +1 -0
  45. package/dist/editors/property-editor-chartjs-styles.js +165 -0
  46. package/dist/editors/property-editor-chartjs-styles.js.map +1 -0
  47. package/dist/editors/property-editor-chartjs.d.ts +14 -0
  48. package/dist/editors/property-editor-chartjs.js +83 -0
  49. package/dist/editors/property-editor-chartjs.js.map +1 -0
  50. package/dist/index.d.ts +5 -0
  51. package/dist/index.js +8 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/ox-chart.d.ts +20 -0
  54. package/dist/ox-chart.js +137 -0
  55. package/dist/ox-chart.js.map +1 -0
  56. package/dist/plugins/chart-series-highlight.d.ts +5 -0
  57. package/dist/plugins/chart-series-highlight.js +37 -0
  58. package/dist/plugins/chart-series-highlight.js.map +1 -0
  59. package/dist/plugins/chartjs-plugin-data-binder.d.ts +5 -0
  60. package/dist/plugins/chartjs-plugin-data-binder.js +111 -0
  61. package/dist/plugins/chartjs-plugin-data-binder.js.map +1 -0
  62. package/helps/scene/component/chartjs.ko.md +332 -0
  63. package/helps/scene/component/chartjs.md +333 -0
  64. package/helps/scene/component/chartjs.zh.md +331 -0
  65. package/helps/scene/images/chart-bar-01.png +0 -0
  66. package/helps/scene/images/chart-bar-02.png +0 -0
  67. package/helps/scene/images/chart-bar-03.png +0 -0
  68. package/helps/scene/images/chart-bar-08.png +0 -0
  69. package/helps/scene/images/chart-bar-12.png +0 -0
  70. package/helps/scene/images/chart-data-01.png +0 -0
  71. package/helps/scene/images/chart-data-04.png +0 -0
  72. package/helps/scene/images/chart-doughnut-01.png +0 -0
  73. package/helps/scene/images/chart-horizontal-bar-01.png +0 -0
  74. package/helps/scene/images/chart-line-01.png +0 -0
  75. package/helps/scene/images/chart-mix-01.png +0 -0
  76. package/helps/scene/images/chart-mix-02.png +0 -0
  77. package/helps/scene/images/chart-pie-01.png +0 -0
  78. package/helps/scene/images/chart-polar-01.png +0 -0
  79. package/helps/scene/images/chart-radar-01.png +0 -0
  80. package/package.json +78 -0
  81. package/src/chartjs.ts +134 -0
  82. package/src/config-converter.ts +401 -0
  83. package/src/editors/index.ts +11 -0
  84. package/src/editors/property-editor-chartjs-abstract.ts +301 -0
  85. package/src/editors/property-editor-chartjs-hbar.ts +163 -0
  86. package/src/editors/property-editor-chartjs-mixed.ts +204 -0
  87. package/src/editors/property-editor-chartjs-multi-series-abstract.ts +393 -0
  88. package/src/editors/property-editor-chartjs-pie.ts +79 -0
  89. package/src/editors/property-editor-chartjs-radar.ts +43 -0
  90. package/src/editors/property-editor-chartjs-styles.ts +165 -0
  91. package/src/editors/property-editor-chartjs.ts +88 -0
  92. package/src/index.ts +7 -0
  93. package/src/ox-chart.ts +150 -0
  94. package/src/plugins/chart-series-highlight.ts +43 -0
  95. package/src/plugins/chartjs-plugin-data-binder.ts +138 -0
  96. package/src/scene-chart.d.ts +152 -0
  97. package/templates/bar-chart.js +124 -0
  98. package/templates/doughnut-chart.js +58 -0
  99. package/templates/horizontal-bar-chart.js +121 -0
  100. package/templates/index.js +22 -0
  101. package/templates/line-chart.js +155 -0
  102. package/templates/mixed-chart.js +152 -0
  103. package/templates/pie-chart.js +58 -0
  104. package/templates/polar-area-chart.js +92 -0
  105. package/templates/radar-chart.js +98 -0
  106. package/test/basic-test.html +61 -0
  107. package/test/index.html +20 -0
  108. package/things-scene.config.js +7 -0
  109. package/translations/en.json +5 -0
  110. package/translations/ko.json +5 -0
  111. package/translations/ms.json +5 -0
  112. package/translations/zh.json +5 -0
  113. package/tsconfig.json +22 -0
  114. package/tsconfig.tsbuildinfo +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ### [0.0.5](https://github.com/things-scene/operato-scene/compare/v0.0.4...v0.0.5) (2021-12-03)
7
+
8
+
9
+ ### :rocket: New Features
10
+
11
+ * add chartjs ([6b3b67b](https://github.com/things-scene/operato-scene/commit/6b3b67be882eda21a702f4f13ed5e0c4606ac934))
12
+
13
+
14
+ ### :bug: Bug Fix
15
+
16
+ * add chartjs, integration module ([24cd106](https://github.com/things-scene/operato-scene/commit/24cd1065d13314e7ca3927a0306fed766531b851))
17
+ * chartjs types ([df033c8](https://github.com/things-scene/operato-scene/commit/df033c8a426dc53e6e73d46e4bb5f64506a2e3ac))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Hearty, Oh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # things-scene-chartjs
2
+
3
+ ## build
4
+
5
+ `$ yarn build`
6
+
7
+ | type | filename | for | tested |
8
+ | ---- | -------------------------- | -------------- | ------ |
9
+ | UMD | things-scene-chartjs.js | modern browser | X |
10
+ | UMD | things-scene-chartjs-ie.js | ie 11 | O |
11
+ | ESM | things-scene-chartjs.mjs | modern browser | X |
12
+
13
+ ## IE 11 Support
14
+
15
+ ie11에서 사용하기 위해 다음과 같은 polyfill을 추가해야 함.
16
+
17
+ ```html
18
+ <script src="//cdn.polyfill.io/v2/polyfill.min.js"></script>
19
+ <script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
20
+ <script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
21
+ ```
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/demo/bar.html ADDED
@@ -0,0 +1,266 @@
1
+ <!doctype html>
2
+ <!--
3
+ @license
4
+ Copyright © HatioLab Inc. All rights reserved.
5
+ -->
6
+ <html>
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
10
+ <title>things-scene-chartjs Demo</title>
11
+ <script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
12
+
13
+ <link rel="import" href="../bower_components/things-scene-viewer/things-scene-viewer.html">
14
+ <link rel="import" href="../bower_components/things-scene-viewer/things-scene-layer.html">
15
+ <link rel="import" href="../bower_components/things-scene-viewer/things-scene-handler.html">
16
+ <link rel="import" href="../bower_components/things-designer-elements/elements.html">
17
+ <link rel="import" href="../bower_components/things-scene-modeler/things-scene-properties.html">
18
+
19
+ <link rel="import" href="./things-scene-chartjs.html">
20
+
21
+ <style is="custom-style">
22
+
23
+ @font-face {
24
+ font-family: "Bitstream Vera Serif Bold";
25
+ src: url("fonts/VeraSeBd.ttf");
26
+ }
27
+
28
+ things-scene-viewer {
29
+ display: block;
30
+ width: 640px;
31
+ height: 480px;
32
+ }
33
+ </style>
34
+ </head>
35
+ <body unresolved>
36
+
37
+ <template is="dom-bind" id="app">
38
+ <p>An example of <code>&lt;things-scene-chartjs&gt;</code>:</p>
39
+
40
+ <things-scene-viewer id='scene' scene='{{scene}}' model='[[model]]' selected='{{selected}}'>
41
+ <things-scene-layer type="selection-layer"></things-scene-layer>
42
+ <things-scene-layer type="modeling-layer"></things-scene-layer>
43
+ <things-scene-handler type="text-editor"></things-scene-handler>
44
+ <things-scene-handler type="move-handler"></things-scene-handler>
45
+ </things-scene-viewer>
46
+
47
+ <button id="change">Change Value</button>
48
+ <button id="change-model">Change Model</button>
49
+ <fieldset>
50
+ <legend>Chart.js properties</legend>
51
+ <things-scene-properties id="properties"
52
+ scene="[[scene]]"
53
+ selected="[[selected]]"
54
+ model="{{target}}"
55
+ bounds="{{bounds}}"
56
+ props="{{props}}">
57
+ <things-editor-properties id="properties"
58
+ target="{{target}}"
59
+ props="{{props}}">
60
+ </things-editor-properties>
61
+ </things-scene-properties>
62
+ </fieldset>
63
+
64
+ </template>
65
+ <canvas id="chartCanvas" width="300" height="300">
66
+ </canvas>
67
+ <script>
68
+ window.addEventListener('WebComponentsReady', function(e) {
69
+ var app = document.querySelector('#app')
70
+
71
+ app.$.change.addEventListener('click', function() {
72
+ var viewer = app.$.scene
73
+
74
+ app.selected[0].set('data', [
75
+ {
76
+ "date": "2016-11-10",
77
+ "inQty": "712882",
78
+ "badQty": "0"
79
+ },
80
+ {
81
+ "date": "2016-11-11",
82
+ "inQty": "526234",
83
+ "badQty": "0"
84
+ },
85
+ {
86
+ "date": "2016-11-12",
87
+ "inQty": "701163",
88
+ "badQty": "8837"
89
+ }
90
+ ])
91
+ })
92
+ app.$['change-model'].addEventListener('click', function() {
93
+ var viewer = app.$.scene
94
+
95
+ var selected = app.selected[0]
96
+ var chartModel = JSON.parse(JSON.stringify(selected.model.chart))
97
+ chartModel.data.datasets.push({
98
+ label:'add',
99
+ backgroundColor: 'red',
100
+ data: []
101
+ })
102
+
103
+ selected.set('chart', chartModel)
104
+ })
105
+
106
+ app.$.properties.addEventListener('change', function(e) {
107
+ console.log('change', e, app.$.properties.model)
108
+ })
109
+
110
+ Chart.defaults.global.tooltips.mode = 'label';
111
+
112
+ app.props = [{
113
+ type: 'number',
114
+ label: 'Font Size',
115
+ name: 'chart.options.fontSize',
116
+ property: 'number'
117
+ },{
118
+ type: 'number',
119
+ label: 'Width',
120
+ name: 'width',
121
+ property: 'number'
122
+ }, {
123
+ type: 'number',
124
+ label: 'Height',
125
+ name: 'height',
126
+ property: 'number'
127
+ }, {
128
+ type: 'number',
129
+ label: 'Tension',
130
+ name: 'chart.data.datasets.0.lineTension',
131
+ property: 'number'
132
+ }, {
133
+ type: 'color',
134
+ label: 'Border Color',
135
+ name: 'chart.data.datasets.0.borderColor',
136
+ property: 'color'
137
+ }, {
138
+ type: 'multiple-color',
139
+ label: 'Background Color',
140
+ name: 'chart.data.datasets.0.backgroundColor',
141
+ property: {
142
+ colorType: 'array'
143
+ }
144
+ }, {
145
+ type: 'number',
146
+ label: 'Border Width',
147
+ name: 'chart.data.datasets.0.borderWidth',
148
+ property: 'number'
149
+ }, {
150
+ type: 'color',
151
+ label: 'Point Border Color',
152
+ name: 'chart.data.datasets.0.pointBorderColor',
153
+ property: 'color'
154
+ }, {
155
+ type: 'color',
156
+ label: 'Point Background Color',
157
+ name: 'chart.data.datasets.0.pointBackgroundColor',
158
+ property: 'color'
159
+ }, {
160
+ type: 'number',
161
+ label: 'Point Border Width',
162
+ name: 'chart.data.datasets.0.pointBorderWidth',
163
+ property: 'number'
164
+ }, {
165
+ type: 'checkbox',
166
+ label: 'Fill',
167
+ name: 'chart.data.datasets.0.fill',
168
+ property: 'checkbox'
169
+ }, {
170
+ type: 'checkbox',
171
+ label: 'X Axis Grid Line',
172
+ name: 'chart.options.scales.xAxes.0.gridLines.display',
173
+ property: 'checkbox'
174
+ }, {
175
+ type: 'string',
176
+ label: 'Theme',
177
+ name: 'chart.options.theme',
178
+ property: 'string'
179
+ }, {
180
+ type: 'checkbox',
181
+ label: 'Show Legend',
182
+ name: 'chart.options.legend.display',
183
+ property: 'checkbox'
184
+ }, {
185
+ type: 'string',
186
+ label: 'Legend Position',
187
+ name: 'chart.options.legend.position',
188
+ property: 'string'
189
+ }, {
190
+ type: 'checkbox',
191
+ label: 'is Stacked',
192
+ name: 'chart.options.stacked',
193
+ property: 'checkbox'
194
+ }, {
195
+ type: 'checkbox',
196
+ label: 'Multi Axis',
197
+ name: 'chart.options.multiAxis',
198
+ property: 'checkbox'
199
+ }]
200
+
201
+ app.model = {
202
+ width: 500,
203
+ height: 500,
204
+ components: [{
205
+ type: 'chartjs',
206
+ top: 50,
207
+ left: 50,
208
+ width: 400,
209
+ height: 400,
210
+ fontColor: '#FF0000',
211
+ lineWidth: 5,
212
+ chart: {
213
+ type: 'bar',
214
+ data: {
215
+ labels: [],
216
+ datasets: [{
217
+ type: 'bar',
218
+ label: 'Line Dataset',
219
+ yAxisID: 'left',
220
+ borderColor: 'red',
221
+ backgroundColor: 'red',
222
+ fill: false,
223
+ data: []
224
+ }, {
225
+ type: 'bar',
226
+ label: 'Bar Dataset',
227
+ borderColor: 'blue',
228
+ backgroundColor: 'blue',
229
+ data: []
230
+ }]
231
+ },
232
+ options: {
233
+ legend: {
234
+ display: true,
235
+ position: 'top'
236
+ },
237
+ scales: {
238
+ xAxes: [{
239
+ position: 'bottom',
240
+ gridLines: {
241
+ display: true
242
+ }
243
+ }],
244
+ yAxes: [{
245
+ position: 'left',
246
+ id: 'left'
247
+ }, {
248
+ position: 'right',
249
+ id: 'right'
250
+ }]
251
+ }
252
+ }
253
+ },
254
+ data : {
255
+ seriesData : [
256
+ [0, 10, 5, 3, 6],
257
+ [100, 10, 60, 30, 50]
258
+ ],
259
+ labelData : ['a', 'b', 'c', 'd', 'e' ]
260
+ }
261
+ }]
262
+ }
263
+ });
264
+ </script>
265
+ </body>
266
+ </html>
@@ -0,0 +1,73 @@
1
+ <!doctype html>
2
+ <!--
3
+ @license
4
+ Copyright © HatioLab Inc. All rights reserved.
5
+ -->
6
+ <html>
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
10
+ <title>things-scene-chartjs Demo</title>
11
+ <script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
12
+
13
+ <link rel="import" href="../bower_components/things-scene-viewer/things-scene-viewer.html">
14
+ <link rel="import" href="../bower_components/things-scene-viewer/things-scene-layer.html">
15
+ <link rel="import" href="../bower_components/things-scene-viewer/things-scene-handler.html">
16
+ <link rel="import" href="../bower_components/things-designer-elements/elements.html">
17
+ <link rel="import" href="../bower_components/things-scene-modeler/things-scene-properties.html">
18
+
19
+ <!--<link rel="import" href="./things-scene-chartjs.html">-->
20
+
21
+ <style is="custom-style">
22
+
23
+ @font-face {
24
+ font-family: "Bitstream Vera Serif Bold";
25
+ src: url("fonts/VeraSeBd.ttf");
26
+ }
27
+
28
+ things-scene-viewer {
29
+ display: block;
30
+ width: 640px;
31
+ height: 480px;
32
+ }
33
+ </style>
34
+ </head>
35
+ <body unresolved>
36
+
37
+ <canvas id="chartCanvas" width="300" height="300">
38
+ </canvas>
39
+ <script src="../bower_components/chart.js/dist/Chart.js"></script>
40
+ <script>
41
+ var chartCanvas = document.getElementById("chartCanvas");
42
+ var ctx = chartCanvas.getContext("2d");
43
+
44
+ var myChart = new Chart(ctx, {
45
+ type: 'bar',
46
+ data: {
47
+ labels: ['Item 1', 'Item 2', 'Item 3'],
48
+ datasets: [
49
+ {
50
+ type: 'bar',
51
+ label: 'Bar Component',
52
+ data: [10, 20, 30],
53
+ },
54
+ {
55
+ type: 'line',
56
+ label: 'Line Component',
57
+ data: [30, 20, 10],
58
+ }
59
+ ]
60
+ },
61
+ options: {
62
+ legend: {
63
+ labels: {
64
+ useLineStyle: true,
65
+ usePointStyle: true
66
+ }
67
+ }
68
+ }
69
+ });
70
+
71
+ </script>
72
+ </body>
73
+ </html>