ntcharts 0.0.1 → 0.1.0

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.
@@ -0,0 +1,354 @@
1
+ package main
2
+
3
+ /*
4
+ #include <stdlib.h>
5
+ */
6
+ import "C"
7
+
8
+ import (
9
+ "time"
10
+
11
+ "github.com/NimbleMarkets/ntcharts/canvas/runes"
12
+ "github.com/NimbleMarkets/ntcharts/linechart/timeserieslinechart"
13
+ )
14
+
15
+ //export ntcharts_timeserieslinechart_new
16
+ func ntcharts_timeserieslinechart_new(width C.int, height C.int) C.ulonglong {
17
+ m := timeserieslinechart.New(int(width), int(height))
18
+ return C.ulonglong(allocTimeserieslinechart(&m))
19
+ }
20
+
21
+ //export ntcharts_timeserieslinechart_free
22
+ func ntcharts_timeserieslinechart_free(id C.ulonglong) {
23
+ freeTimeserieslinechart(uint64(id))
24
+ }
25
+
26
+ //export ntcharts_timeserieslinechart_width
27
+ func ntcharts_timeserieslinechart_width(id C.ulonglong) C.int {
28
+ t := getTimeserieslinechart(uint64(id))
29
+
30
+ if t == nil {
31
+ return 0
32
+ }
33
+
34
+ return C.int(t.Width())
35
+ }
36
+
37
+ //export ntcharts_timeserieslinechart_height
38
+ func ntcharts_timeserieslinechart_height(id C.ulonglong) C.int {
39
+ t := getTimeserieslinechart(uint64(id))
40
+
41
+ if t == nil {
42
+ return 0
43
+ }
44
+
45
+ return C.int(t.Height())
46
+ }
47
+
48
+ //export ntcharts_timeserieslinechart_graph_width
49
+ func ntcharts_timeserieslinechart_graph_width(id C.ulonglong) C.int {
50
+ t := getTimeserieslinechart(uint64(id))
51
+
52
+ if t == nil {
53
+ return 0
54
+ }
55
+
56
+ return C.int(t.GraphWidth())
57
+ }
58
+
59
+ //export ntcharts_timeserieslinechart_graph_height
60
+ func ntcharts_timeserieslinechart_graph_height(id C.ulonglong) C.int {
61
+ t := getTimeserieslinechart(uint64(id))
62
+
63
+ if t == nil {
64
+ return 0
65
+ }
66
+
67
+ return C.int(t.GraphHeight())
68
+ }
69
+
70
+ //export ntcharts_timeserieslinechart_min_x
71
+ func ntcharts_timeserieslinechart_min_x(id C.ulonglong) C.longlong {
72
+ t := getTimeserieslinechart(uint64(id))
73
+
74
+ if t == nil {
75
+ return 0
76
+ }
77
+
78
+ return C.longlong(int64(t.MinX()))
79
+ }
80
+
81
+ //export ntcharts_timeserieslinechart_max_x
82
+ func ntcharts_timeserieslinechart_max_x(id C.ulonglong) C.longlong {
83
+ t := getTimeserieslinechart(uint64(id))
84
+
85
+ if t == nil {
86
+ return 0
87
+ }
88
+
89
+ return C.longlong(int64(t.MaxX()))
90
+ }
91
+
92
+ //export ntcharts_timeserieslinechart_min_y
93
+ func ntcharts_timeserieslinechart_min_y(id C.ulonglong) C.double {
94
+ t := getTimeserieslinechart(uint64(id))
95
+
96
+ if t == nil {
97
+ return 0
98
+ }
99
+
100
+ return C.double(t.MinY())
101
+ }
102
+
103
+ //export ntcharts_timeserieslinechart_max_y
104
+ func ntcharts_timeserieslinechart_max_y(id C.ulonglong) C.double {
105
+ t := getTimeserieslinechart(uint64(id))
106
+
107
+ if t == nil {
108
+ return 0
109
+ }
110
+
111
+ return C.double(t.MaxY())
112
+ }
113
+
114
+ //export ntcharts_timeserieslinechart_set_time_range
115
+ func ntcharts_timeserieslinechart_set_time_range(id C.ulonglong, minUnix C.longlong, maxUnix C.longlong) {
116
+ t := getTimeserieslinechart(uint64(id))
117
+
118
+ if t != nil {
119
+ minTime := time.Unix(int64(minUnix), 0)
120
+ maxTime := time.Unix(int64(maxUnix), 0)
121
+ t.SetTimeRange(minTime, maxTime)
122
+ }
123
+ }
124
+
125
+ //export ntcharts_timeserieslinechart_set_y_range
126
+ func ntcharts_timeserieslinechart_set_y_range(id C.ulonglong, minVal C.double, maxVal C.double) {
127
+ t := getTimeserieslinechart(uint64(id))
128
+
129
+ if t != nil {
130
+ t.SetYRange(float64(minVal), float64(maxVal))
131
+ }
132
+ }
133
+
134
+ //export ntcharts_timeserieslinechart_set_view_time_range
135
+ func ntcharts_timeserieslinechart_set_view_time_range(id C.ulonglong, minUnix C.longlong, maxUnix C.longlong) {
136
+ t := getTimeserieslinechart(uint64(id))
137
+
138
+ if t != nil {
139
+ minTime := time.Unix(int64(minUnix), 0)
140
+ maxTime := time.Unix(int64(maxUnix), 0)
141
+ t.SetViewTimeRange(minTime, maxTime)
142
+ }
143
+ }
144
+
145
+ //export ntcharts_timeserieslinechart_set_view_y_range
146
+ func ntcharts_timeserieslinechart_set_view_y_range(id C.ulonglong, minVal C.double, maxVal C.double) {
147
+ t := getTimeserieslinechart(uint64(id))
148
+
149
+ if t != nil {
150
+ t.SetViewYRange(float64(minVal), float64(maxVal))
151
+ }
152
+ }
153
+
154
+ //export ntcharts_timeserieslinechart_resize
155
+ func ntcharts_timeserieslinechart_resize(id C.ulonglong, width C.int, height C.int) {
156
+ t := getTimeserieslinechart(uint64(id))
157
+
158
+ if t != nil {
159
+ t.Resize(int(width), int(height))
160
+ }
161
+ }
162
+
163
+ //export ntcharts_timeserieslinechart_clear
164
+ func ntcharts_timeserieslinechart_clear(id C.ulonglong) {
165
+ t := getTimeserieslinechart(uint64(id))
166
+
167
+ if t != nil {
168
+ t.Clear()
169
+ }
170
+ }
171
+
172
+ //export ntcharts_timeserieslinechart_clear_all_data
173
+ func ntcharts_timeserieslinechart_clear_all_data(id C.ulonglong) {
174
+ t := getTimeserieslinechart(uint64(id))
175
+
176
+ if t != nil {
177
+ t.ClearAllData()
178
+ }
179
+ }
180
+
181
+ //export ntcharts_timeserieslinechart_clear_data_set
182
+ func ntcharts_timeserieslinechart_clear_data_set(id C.ulonglong, name *C.char) {
183
+ t := getTimeserieslinechart(uint64(id))
184
+
185
+ if t != nil {
186
+ t.ClearDataSet(C.GoString(name))
187
+ }
188
+ }
189
+
190
+ //export ntcharts_timeserieslinechart_push
191
+ func ntcharts_timeserieslinechart_push(id C.ulonglong, timeUnix C.longlong, value C.double) {
192
+ t := getTimeserieslinechart(uint64(id))
193
+
194
+ if t != nil {
195
+ tp := timeserieslinechart.TimePoint{
196
+ Time: time.Unix(int64(timeUnix), 0),
197
+ Value: float64(value),
198
+ }
199
+
200
+ t.Push(tp)
201
+ }
202
+ }
203
+
204
+ //export ntcharts_timeserieslinechart_push_data_set
205
+ func ntcharts_timeserieslinechart_push_data_set(id C.ulonglong, name *C.char, timeUnix C.longlong, value C.double) {
206
+ t := getTimeserieslinechart(uint64(id))
207
+
208
+ if t != nil {
209
+ tp := timeserieslinechart.TimePoint{
210
+ Time: time.Unix(int64(timeUnix), 0),
211
+ Value: float64(value),
212
+ }
213
+
214
+ t.PushDataSet(C.GoString(name), tp)
215
+ }
216
+ }
217
+
218
+ //export ntcharts_timeserieslinechart_set_line_style
219
+ func ntcharts_timeserieslinechart_set_line_style(id C.ulonglong, lineStyle C.int) {
220
+ t := getTimeserieslinechart(uint64(id))
221
+
222
+ if t != nil {
223
+ ls := getTimeseriesLineStyle(int(lineStyle))
224
+ t.SetLineStyle(ls)
225
+ }
226
+ }
227
+
228
+ //export ntcharts_timeserieslinechart_set_style
229
+ func ntcharts_timeserieslinechart_set_style(id C.ulonglong, styleID C.ulonglong) {
230
+ t := getTimeserieslinechart(uint64(id))
231
+
232
+ if t == nil {
233
+ return
234
+ }
235
+
236
+ style, ok := getStyle(uint64(styleID))
237
+
238
+ if ok {
239
+ t.SetStyle(style)
240
+ }
241
+ }
242
+
243
+ //export ntcharts_timeserieslinechart_set_data_set_line_style
244
+ func ntcharts_timeserieslinechart_set_data_set_line_style(id C.ulonglong, name *C.char, lineStyle C.int) {
245
+ t := getTimeserieslinechart(uint64(id))
246
+
247
+ if t != nil {
248
+ ls := getTimeseriesLineStyle(int(lineStyle))
249
+ t.SetDataSetLineStyle(C.GoString(name), ls)
250
+ }
251
+ }
252
+
253
+ //export ntcharts_timeserieslinechart_set_data_set_style
254
+ func ntcharts_timeserieslinechart_set_data_set_style(id C.ulonglong, name *C.char, styleID C.ulonglong) {
255
+ t := getTimeserieslinechart(uint64(id))
256
+
257
+ if t == nil {
258
+ return
259
+ }
260
+
261
+ style, ok := getStyle(uint64(styleID))
262
+
263
+ if ok {
264
+ t.SetDataSetStyle(C.GoString(name), style)
265
+ }
266
+ }
267
+
268
+ //export ntcharts_timeserieslinechart_set_axis_style
269
+ func ntcharts_timeserieslinechart_set_axis_style(id C.ulonglong, styleID C.ulonglong) {
270
+ t := getTimeserieslinechart(uint64(id))
271
+
272
+ if t == nil {
273
+ return
274
+ }
275
+
276
+ style, ok := getStyle(uint64(styleID))
277
+
278
+ if ok {
279
+ t.AxisStyle = style
280
+ }
281
+ }
282
+
283
+ //export ntcharts_timeserieslinechart_set_label_style
284
+ func ntcharts_timeserieslinechart_set_label_style(id C.ulonglong, styleID C.ulonglong) {
285
+ t := getTimeserieslinechart(uint64(id))
286
+
287
+ if t == nil {
288
+ return
289
+ }
290
+
291
+ style, ok := getStyle(uint64(styleID))
292
+
293
+ if ok {
294
+ t.LabelStyle = style
295
+ }
296
+ }
297
+
298
+ //export ntcharts_timeserieslinechart_draw
299
+ func ntcharts_timeserieslinechart_draw(id C.ulonglong) {
300
+ t := getTimeserieslinechart(uint64(id))
301
+
302
+ if t != nil {
303
+ t.Draw()
304
+ }
305
+ }
306
+
307
+ //export ntcharts_timeserieslinechart_draw_all
308
+ func ntcharts_timeserieslinechart_draw_all(id C.ulonglong) {
309
+ t := getTimeserieslinechart(uint64(id))
310
+
311
+ if t != nil {
312
+ t.DrawAll()
313
+ }
314
+ }
315
+
316
+ //export ntcharts_timeserieslinechart_draw_braille
317
+ func ntcharts_timeserieslinechart_draw_braille(id C.ulonglong) {
318
+ t := getTimeserieslinechart(uint64(id))
319
+
320
+ if t != nil {
321
+ t.DrawBraille()
322
+ }
323
+ }
324
+
325
+ //export ntcharts_timeserieslinechart_draw_braille_all
326
+ func ntcharts_timeserieslinechart_draw_braille_all(id C.ulonglong) {
327
+ t := getTimeserieslinechart(uint64(id))
328
+
329
+ if t != nil {
330
+ t.DrawBrailleAll()
331
+ }
332
+ }
333
+
334
+ //export ntcharts_timeserieslinechart_view
335
+ func ntcharts_timeserieslinechart_view(id C.ulonglong) *C.char {
336
+ t := getTimeserieslinechart(uint64(id))
337
+
338
+ if t == nil {
339
+ return C.CString("")
340
+ }
341
+
342
+ return C.CString(t.View())
343
+ }
344
+
345
+ func getTimeseriesLineStyle(style int) runes.LineStyle {
346
+ switch style {
347
+ case 0:
348
+ return runes.ThinLineStyle
349
+ case 1:
350
+ return runes.ArcLineStyle
351
+ default:
352
+ return runes.ArcLineStyle
353
+ }
354
+ }
@@ -0,0 +1,309 @@
1
+ package main
2
+
3
+ /*
4
+ #include <stdlib.h>
5
+ */
6
+ import "C"
7
+
8
+ import (
9
+ "github.com/NimbleMarkets/ntcharts/canvas"
10
+ "github.com/NimbleMarkets/ntcharts/canvas/runes"
11
+ "github.com/NimbleMarkets/ntcharts/linechart/wavelinechart"
12
+ )
13
+
14
+ //export ntcharts_wavelinechart_new
15
+ func ntcharts_wavelinechart_new(width C.int, height C.int) C.ulonglong {
16
+ m := wavelinechart.New(int(width), int(height))
17
+ return C.ulonglong(allocWavelinechart(&m))
18
+ }
19
+
20
+ //export ntcharts_wavelinechart_free
21
+ func ntcharts_wavelinechart_free(id C.ulonglong) {
22
+ freeWavelinechart(uint64(id))
23
+ }
24
+
25
+ //export ntcharts_wavelinechart_width
26
+ func ntcharts_wavelinechart_width(id C.ulonglong) C.int {
27
+ w := getWavelinechart(uint64(id))
28
+
29
+ if w == nil {
30
+ return 0
31
+ }
32
+
33
+ return C.int(w.Width())
34
+ }
35
+
36
+ //export ntcharts_wavelinechart_height
37
+ func ntcharts_wavelinechart_height(id C.ulonglong) C.int {
38
+ w := getWavelinechart(uint64(id))
39
+
40
+ if w == nil {
41
+ return 0
42
+ }
43
+
44
+ return C.int(w.Height())
45
+ }
46
+
47
+ //export ntcharts_wavelinechart_graph_width
48
+ func ntcharts_wavelinechart_graph_width(id C.ulonglong) C.int {
49
+ w := getWavelinechart(uint64(id))
50
+
51
+ if w == nil {
52
+ return 0
53
+ }
54
+
55
+ return C.int(w.GraphWidth())
56
+ }
57
+
58
+ //export ntcharts_wavelinechart_graph_height
59
+ func ntcharts_wavelinechart_graph_height(id C.ulonglong) C.int {
60
+ w := getWavelinechart(uint64(id))
61
+
62
+ if w == nil {
63
+ return 0
64
+ }
65
+
66
+ return C.int(w.GraphHeight())
67
+ }
68
+
69
+ //export ntcharts_wavelinechart_min_x
70
+ func ntcharts_wavelinechart_min_x(id C.ulonglong) C.double {
71
+ w := getWavelinechart(uint64(id))
72
+
73
+ if w == nil {
74
+ return 0
75
+ }
76
+
77
+ return C.double(w.MinX())
78
+ }
79
+
80
+ //export ntcharts_wavelinechart_max_x
81
+ func ntcharts_wavelinechart_max_x(id C.ulonglong) C.double {
82
+ w := getWavelinechart(uint64(id))
83
+
84
+ if w == nil {
85
+ return 0
86
+ }
87
+
88
+ return C.double(w.MaxX())
89
+ }
90
+
91
+ //export ntcharts_wavelinechart_min_y
92
+ func ntcharts_wavelinechart_min_y(id C.ulonglong) C.double {
93
+ w := getWavelinechart(uint64(id))
94
+
95
+ if w == nil {
96
+ return 0
97
+ }
98
+
99
+ return C.double(w.MinY())
100
+ }
101
+
102
+ //export ntcharts_wavelinechart_max_y
103
+ func ntcharts_wavelinechart_max_y(id C.ulonglong) C.double {
104
+ w := getWavelinechart(uint64(id))
105
+
106
+ if w == nil {
107
+ return 0
108
+ }
109
+
110
+ return C.double(w.MaxY())
111
+ }
112
+
113
+ //export ntcharts_wavelinechart_set_y_range
114
+ func ntcharts_wavelinechart_set_y_range(id C.ulonglong, minVal C.double, maxVal C.double) {
115
+ w := getWavelinechart(uint64(id))
116
+
117
+ if w != nil {
118
+ w.SetYRange(float64(minVal), float64(maxVal))
119
+ }
120
+ }
121
+
122
+ //export ntcharts_wavelinechart_set_view_x_range
123
+ func ntcharts_wavelinechart_set_view_x_range(id C.ulonglong, minVal C.double, maxVal C.double) {
124
+ w := getWavelinechart(uint64(id))
125
+
126
+ if w != nil {
127
+ w.SetViewXRange(float64(minVal), float64(maxVal))
128
+ }
129
+ }
130
+
131
+ //export ntcharts_wavelinechart_set_view_y_range
132
+ func ntcharts_wavelinechart_set_view_y_range(id C.ulonglong, minVal C.double, maxVal C.double) {
133
+ w := getWavelinechart(uint64(id))
134
+
135
+ if w != nil {
136
+ w.SetViewYRange(float64(minVal), float64(maxVal))
137
+ }
138
+ }
139
+
140
+ //export ntcharts_wavelinechart_resize
141
+ func ntcharts_wavelinechart_resize(id C.ulonglong, width C.int, height C.int) {
142
+ w := getWavelinechart(uint64(id))
143
+
144
+ if w != nil {
145
+ w.Resize(int(width), int(height))
146
+ }
147
+ }
148
+
149
+ //export ntcharts_wavelinechart_clear
150
+ func ntcharts_wavelinechart_clear(id C.ulonglong) {
151
+ w := getWavelinechart(uint64(id))
152
+
153
+ if w != nil {
154
+ w.Clear()
155
+ }
156
+ }
157
+
158
+ //export ntcharts_wavelinechart_clear_all_data
159
+ func ntcharts_wavelinechart_clear_all_data(id C.ulonglong) {
160
+ w := getWavelinechart(uint64(id))
161
+
162
+ if w != nil {
163
+ w.ClearAllData()
164
+ }
165
+ }
166
+
167
+ //export ntcharts_wavelinechart_clear_data_set
168
+ func ntcharts_wavelinechart_clear_data_set(id C.ulonglong, name *C.char) {
169
+ w := getWavelinechart(uint64(id))
170
+
171
+ if w != nil {
172
+ w.ClearDataSet(C.GoString(name))
173
+ }
174
+ }
175
+
176
+ //export ntcharts_wavelinechart_plot
177
+ func ntcharts_wavelinechart_plot(id C.ulonglong, x C.double, y C.double) {
178
+ w := getWavelinechart(uint64(id))
179
+
180
+ if w != nil {
181
+ w.Plot(canvas.Float64Point{X: float64(x), Y: float64(y)})
182
+ }
183
+ }
184
+
185
+ //export ntcharts_wavelinechart_plot_data_set
186
+ func ntcharts_wavelinechart_plot_data_set(id C.ulonglong, name *C.char, x C.double, y C.double) {
187
+ w := getWavelinechart(uint64(id))
188
+
189
+ if w != nil {
190
+ w.PlotDataSet(C.GoString(name), canvas.Float64Point{X: float64(x), Y: float64(y)})
191
+ }
192
+ }
193
+
194
+ //export ntcharts_wavelinechart_set_styles
195
+ func ntcharts_wavelinechart_set_styles(id C.ulonglong, lineStyle C.int, styleID C.ulonglong) {
196
+ w := getWavelinechart(uint64(id))
197
+
198
+ if w == nil {
199
+ return
200
+ }
201
+
202
+ ls := getWaveLineStyle(int(lineStyle))
203
+
204
+ style, ok := getStyle(uint64(styleID))
205
+ if ok {
206
+ w.SetStyles(ls, style)
207
+ }
208
+ }
209
+
210
+ //export ntcharts_wavelinechart_set_data_set_styles
211
+ func ntcharts_wavelinechart_set_data_set_styles(id C.ulonglong, name *C.char, lineStyle C.int, styleID C.ulonglong) {
212
+ w := getWavelinechart(uint64(id))
213
+
214
+ if w == nil {
215
+ return
216
+ }
217
+
218
+ ls := getWaveLineStyle(int(lineStyle))
219
+ style, ok := getStyle(uint64(styleID))
220
+
221
+ if ok {
222
+ w.SetDataSetStyles(C.GoString(name), ls, style)
223
+ }
224
+ }
225
+
226
+ //export ntcharts_wavelinechart_set_style
227
+ func ntcharts_wavelinechart_set_style(id C.ulonglong, styleID C.ulonglong) {
228
+ w := getWavelinechart(uint64(id))
229
+
230
+ if w == nil {
231
+ return
232
+ }
233
+
234
+ style, ok := getStyle(uint64(styleID))
235
+
236
+ if ok {
237
+ w.Style = style
238
+ }
239
+ }
240
+
241
+ //export ntcharts_wavelinechart_set_axis_style
242
+ func ntcharts_wavelinechart_set_axis_style(id C.ulonglong, styleID C.ulonglong) {
243
+ w := getWavelinechart(uint64(id))
244
+
245
+ if w == nil {
246
+ return
247
+ }
248
+
249
+ style, ok := getStyle(uint64(styleID))
250
+
251
+ if ok {
252
+ w.AxisStyle = style
253
+ }
254
+ }
255
+
256
+ //export ntcharts_wavelinechart_set_label_style
257
+ func ntcharts_wavelinechart_set_label_style(id C.ulonglong, styleID C.ulonglong) {
258
+ w := getWavelinechart(uint64(id))
259
+
260
+ if w == nil {
261
+ return
262
+ }
263
+
264
+ style, ok := getStyle(uint64(styleID))
265
+
266
+ if ok {
267
+ w.LabelStyle = style
268
+ }
269
+ }
270
+
271
+ //export ntcharts_wavelinechart_draw
272
+ func ntcharts_wavelinechart_draw(id C.ulonglong) {
273
+ w := getWavelinechart(uint64(id))
274
+
275
+ if w != nil {
276
+ w.Draw()
277
+ }
278
+ }
279
+
280
+ //export ntcharts_wavelinechart_draw_all
281
+ func ntcharts_wavelinechart_draw_all(id C.ulonglong) {
282
+ w := getWavelinechart(uint64(id))
283
+
284
+ if w != nil {
285
+ w.DrawAll()
286
+ }
287
+ }
288
+
289
+ //export ntcharts_wavelinechart_view
290
+ func ntcharts_wavelinechart_view(id C.ulonglong) *C.char {
291
+ w := getWavelinechart(uint64(id))
292
+
293
+ if w == nil {
294
+ return C.CString("")
295
+ }
296
+
297
+ return C.CString(w.View())
298
+ }
299
+
300
+ func getWaveLineStyle(style int) runes.LineStyle {
301
+ switch style {
302
+ case 0:
303
+ return runes.ThinLineStyle
304
+ case 1:
305
+ return runes.ArcLineStyle
306
+ default:
307
+ return runes.ArcLineStyle
308
+ }
309
+ }
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ntcharts
4
+ class BarValue
5
+ attr_reader :name, :value, :style
6
+
7
+ def initialize(name: "", value: 0.0, style: nil)
8
+ @name = name
9
+ @value = value.to_f
10
+ @style = style
11
+ end
12
+
13
+ def to_h
14
+ h = { name: @name, value: @value }
15
+ h[:style_handle] = @style.handle if @style
16
+ h
17
+ end
18
+
19
+ def to_json(*args)
20
+ to_h.to_json(*args)
21
+ end
22
+ end
23
+
24
+ class BarData
25
+ attr_reader :label, :values
26
+
27
+ def initialize(label: "", values: [])
28
+ @label = label
29
+ @values = values.map do |v|
30
+ case v
31
+ when BarValue then v
32
+ when Hash then BarValue.new(**v)
33
+ else raise ArgumentError, "Expected BarValue or Hash, got #{v.class}"
34
+ end
35
+ end
36
+ end
37
+
38
+ def add_value(name: "", value: 0.0, style: nil)
39
+ @values << BarValue.new(name: name, value: value, style: style)
40
+ self
41
+ end
42
+
43
+ def to_h
44
+ { label: @label, values: @values.map(&:to_h) }
45
+ end
46
+
47
+ def to_json(*args)
48
+ to_h.to_json(*args)
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ntcharts
4
- VERSION = "0.0.1"
4
+ VERSION = "0.1.0"
5
5
  end