@windborne/grapher 1.0.11 → 1.0.13

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windborne/grapher",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Graphing library",
5
5
  "main": "bundle.js",
6
6
  "publishConfig": {},
@@ -38,7 +38,7 @@
38
38
  "@babel/polyfill": "^7.7.0",
39
39
  "@babel/preset-env": "^7.7.6",
40
40
  "@babel/preset-react": "^7.7.4",
41
- "@wasm-tool/wasm-pack-plugin": "^1.2.0",
41
+ "@wasm-tool/wasm-pack-plugin": "^1.7.0",
42
42
  "babel-eslint": "^10.1.0",
43
43
  "babel-loader": "^8.0.6",
44
44
  "chai": "^4.2.0",
package/readme.md CHANGED
@@ -97,6 +97,7 @@ The `series` prop requires an array of objects, where each object represents a d
97
97
  - **gradient**: Gradient configuration, only applies to area rendering (array)
98
98
  - **zeroLineWidth**: Width of the zero line, only applies to bar and area rendering (number)
99
99
  - **zeroLineColor**: Color of the zero line, only applies to bar and area rendering (string)
100
+ - **zeroLineY**: Y-coordinate of the zero line, only applies to bar and area rendering (number). Defaults to zero.
100
101
  - **pointRadius**: Radius of points, only applies to area rendering (number)
101
102
  - **tooltipWidth**: Expected width of the tooltip (number). Will make the tooltip switch sides when this width plus the tooltip left position is greater than the graph width.
102
103
  - **hasAreaBottom**: read the bottom of the area from data (boolean). By default, the bottom of an area will just be zero; this allows changing that via passing in `[[x1, bottom], [x1, top], [x2, bottom], [x2, top]]` to data (see [examples/dynamic_bottom_area_chart.js](examples/dynamic_bottom_area_chart.js)).
@@ -115,6 +115,10 @@ export default class Tooltip extends React.PureComponent {
115
115
  const preparedTooltips = this.props.tooltips.map((tooltip) => {
116
116
  const { x, y, pixelY, pixelX, series, index, xLabel, yLabel, fullYPrecision } = tooltip;
117
117
 
118
+ if (typeof pixelX !== 'number') {
119
+ return null;
120
+ }
121
+
118
122
  const axisLabel = (series.name || series.yKey || index).toString();
119
123
  let width = Math.max(axisLabel.length, (xLabel || formatX(x, formatXOptions)).length + 4, getYLabelContent({ yLabel, y, fullYPrecision}).length + 4) * 7.5;
120
124
  if (series.tooltipWidth) {
@@ -209,7 +213,7 @@ export default class Tooltip extends React.PureComponent {
209
213
  yTranslation,
210
214
  baseLeft
211
215
  };
212
- });
216
+ }).filter(Boolean);
213
217
 
214
218
  const CustomTooltipComponent = this.props.customTooltip;
215
219
 
@@ -70,6 +70,7 @@ const SingleSeries = PropTypes.shape({
70
70
  gradient: PropTypes.array, // only applies to area
71
71
  zeroLineWidth: PropTypes.number, // only applies to bar and area
72
72
  zeroLineColor: PropTypes.string, // only applies to bar and area
73
+ zeroLineY: PropTypes.number, // only applies to bar and area
73
74
  pointRadius: PropTypes.number, // only applies to area
74
75
  tooltipWidth: PropTypes.number,
75
76
  hasAreaBottom: PropTypes.bool,
@@ -160,7 +160,7 @@ export default class GraphBodyRenderer extends Eventable {
160
160
  context: this._context2d,
161
161
  color: getColor(singleSeries.color, singleSeries.index, singleSeries.multigrapherSeriesIndex),
162
162
  sizing: this._sizing,
163
- zero: (1.0 - (0 - bounds.minY) / (bounds.maxY - bounds.minY)) * this._sizing.renderHeight,
163
+ zero: (1.0 - ((singleSeries.zeroLineY || 0) - bounds.minY) / (bounds.maxY - bounds.minY)) * this._sizing.renderHeight,
164
164
  hasNegatives: !!singleSeries.inDataSpace.find((tuple) => tuple[1] < 0),
165
165
  negativeColor: singleSeries.negativeColor,
166
166
  zeroWidth: singleSeries.zeroLineWidth,
@@ -1,24 +1,41 @@
1
1
  # This file is automatically @generated by Cargo.
2
2
  # It is not intended for manual editing.
3
+ version = 4
4
+
3
5
  [[package]]
4
6
  name = "bumpalo"
5
7
  version = "3.2.0"
6
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
7
9
  checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742"
8
10
 
11
+ [[package]]
12
+ name = "cc"
13
+ version = "1.2.20"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a"
16
+ dependencies = [
17
+ "shlex",
18
+ ]
19
+
9
20
  [[package]]
10
21
  name = "cfg-if"
11
22
  version = "0.1.10"
12
23
  source = "registry+https://github.com/rust-lang/crates.io-index"
13
24
  checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
14
25
 
26
+ [[package]]
27
+ name = "cfg-if"
28
+ version = "1.0.0"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
31
+
15
32
  [[package]]
16
33
  name = "console_error_panic_hook"
17
34
  version = "0.1.6"
18
35
  source = "registry+https://github.com/rust-lang/crates.io-index"
19
36
  checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
20
37
  dependencies = [
21
- "cfg-if",
38
+ "cfg-if 0.1.10",
22
39
  "wasm-bindgen",
23
40
  ]
24
41
 
@@ -43,149 +60,162 @@ dependencies = [
43
60
 
44
61
  [[package]]
45
62
  name = "js-sys"
46
- version = "0.3.36"
63
+ version = "0.3.77"
47
64
  source = "registry+https://github.com/rust-lang/crates.io-index"
48
- checksum = "1cb931d43e71f560c81badb0191596562bafad2be06a3f9025b845c847c60df5"
65
+ checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
49
66
  dependencies = [
67
+ "once_cell",
50
68
  "wasm-bindgen",
51
69
  ]
52
70
 
53
- [[package]]
54
- name = "lazy_static"
55
- version = "1.4.0"
56
- source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
58
-
59
71
  [[package]]
60
72
  name = "log"
61
73
  version = "0.4.8"
62
74
  source = "registry+https://github.com/rust-lang/crates.io-index"
63
75
  checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
64
76
  dependencies = [
65
- "cfg-if",
77
+ "cfg-if 0.1.10",
66
78
  ]
67
79
 
68
80
  [[package]]
69
- name = "proc-macro2"
70
- version = "0.4.30"
81
+ name = "minicov"
82
+ version = "0.3.7"
71
83
  source = "registry+https://github.com/rust-lang/crates.io-index"
72
- checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
84
+ checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b"
73
85
  dependencies = [
74
- "unicode-xid 0.1.0",
86
+ "cc",
87
+ "walkdir",
75
88
  ]
76
89
 
90
+ [[package]]
91
+ name = "once_cell"
92
+ version = "1.21.3"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
95
+
77
96
  [[package]]
78
97
  name = "proc-macro2"
79
- version = "1.0.9"
98
+ version = "1.0.95"
80
99
  source = "registry+https://github.com/rust-lang/crates.io-index"
81
- checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
100
+ checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
82
101
  dependencies = [
83
- "unicode-xid 0.2.0",
102
+ "unicode-ident",
84
103
  ]
85
104
 
86
105
  [[package]]
87
106
  name = "quote"
88
- version = "0.6.13"
107
+ version = "1.0.40"
89
108
  source = "registry+https://github.com/rust-lang/crates.io-index"
90
- checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
109
+ checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
91
110
  dependencies = [
92
- "proc-macro2 0.4.30",
111
+ "proc-macro2",
93
112
  ]
94
113
 
95
114
  [[package]]
96
- name = "quote"
97
- version = "1.0.3"
115
+ name = "rustversion"
116
+ version = "1.0.20"
98
117
  source = "registry+https://github.com/rust-lang/crates.io-index"
99
- checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
118
+ checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
119
+
120
+ [[package]]
121
+ name = "same-file"
122
+ version = "1.0.6"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
100
125
  dependencies = [
101
- "proc-macro2 1.0.9",
126
+ "winapi-util",
102
127
  ]
103
128
 
104
129
  [[package]]
105
- name = "scoped-tls"
106
- version = "1.0.0"
130
+ name = "shlex"
131
+ version = "1.3.0"
107
132
  source = "registry+https://github.com/rust-lang/crates.io-index"
108
- checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
133
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
109
134
 
110
135
  [[package]]
111
136
  name = "syn"
112
- version = "1.0.16"
137
+ version = "2.0.101"
113
138
  source = "registry+https://github.com/rust-lang/crates.io-index"
114
- checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
139
+ checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
115
140
  dependencies = [
116
- "proc-macro2 1.0.9",
117
- "quote 1.0.3",
118
- "unicode-xid 0.2.0",
141
+ "proc-macro2",
142
+ "quote",
143
+ "unicode-ident",
119
144
  ]
120
145
 
121
146
  [[package]]
122
- name = "unicode-xid"
123
- version = "0.1.0"
147
+ name = "unicode-ident"
148
+ version = "1.0.18"
124
149
  source = "registry+https://github.com/rust-lang/crates.io-index"
125
- checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
150
+ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
126
151
 
127
152
  [[package]]
128
- name = "unicode-xid"
129
- version = "0.2.0"
153
+ name = "walkdir"
154
+ version = "2.5.0"
130
155
  source = "registry+https://github.com/rust-lang/crates.io-index"
131
- checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
156
+ checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
157
+ dependencies = [
158
+ "same-file",
159
+ "winapi-util",
160
+ ]
132
161
 
133
162
  [[package]]
134
163
  name = "wasm-bindgen"
135
- version = "0.2.59"
164
+ version = "0.2.100"
136
165
  source = "registry+https://github.com/rust-lang/crates.io-index"
137
- checksum = "3557c397ab5a8e347d434782bcd31fc1483d927a6826804cec05cc792ee2519d"
166
+ checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
138
167
  dependencies = [
139
- "cfg-if",
168
+ "cfg-if 1.0.0",
169
+ "once_cell",
170
+ "rustversion",
140
171
  "wasm-bindgen-macro",
141
172
  ]
142
173
 
143
174
  [[package]]
144
175
  name = "wasm-bindgen-backend"
145
- version = "0.2.59"
176
+ version = "0.2.100"
146
177
  source = "registry+https://github.com/rust-lang/crates.io-index"
147
- checksum = "e0da9c9a19850d3af6df1cb9574970b566d617ecfaf36eb0b706b6f3ef9bd2f8"
178
+ checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
148
179
  dependencies = [
149
180
  "bumpalo",
150
- "lazy_static",
151
181
  "log",
152
- "proc-macro2 1.0.9",
153
- "quote 1.0.3",
182
+ "proc-macro2",
183
+ "quote",
154
184
  "syn",
155
185
  "wasm-bindgen-shared",
156
186
  ]
157
187
 
158
188
  [[package]]
159
189
  name = "wasm-bindgen-futures"
160
- version = "0.3.27"
190
+ version = "0.4.50"
161
191
  source = "registry+https://github.com/rust-lang/crates.io-index"
162
- checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
192
+ checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
163
193
  dependencies = [
164
- "cfg-if",
165
- "futures",
194
+ "cfg-if 1.0.0",
166
195
  "js-sys",
196
+ "once_cell",
167
197
  "wasm-bindgen",
168
198
  "web-sys",
169
199
  ]
170
200
 
171
201
  [[package]]
172
202
  name = "wasm-bindgen-macro"
173
- version = "0.2.59"
203
+ version = "0.2.100"
174
204
  source = "registry+https://github.com/rust-lang/crates.io-index"
175
- checksum = "0f6fde1d36e75a714b5fe0cffbb78978f222ea6baebb726af13c78869fdb4205"
205
+ checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
176
206
  dependencies = [
177
- "quote 1.0.3",
207
+ "quote",
178
208
  "wasm-bindgen-macro-support",
179
209
  ]
180
210
 
181
211
  [[package]]
182
212
  name = "wasm-bindgen-macro-support"
183
- version = "0.2.59"
213
+ version = "0.2.100"
184
214
  source = "registry+https://github.com/rust-lang/crates.io-index"
185
- checksum = "25bda4168030a6412ea8a047e27238cadf56f0e53516e1e83fec0a8b7c786f6d"
215
+ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
186
216
  dependencies = [
187
- "proc-macro2 1.0.9",
188
- "quote 1.0.3",
217
+ "proc-macro2",
218
+ "quote",
189
219
  "syn",
190
220
  "wasm-bindgen-backend",
191
221
  "wasm-bindgen-shared",
@@ -193,20 +223,21 @@ dependencies = [
193
223
 
194
224
  [[package]]
195
225
  name = "wasm-bindgen-shared"
196
- version = "0.2.59"
226
+ version = "0.2.100"
197
227
  source = "registry+https://github.com/rust-lang/crates.io-index"
198
- checksum = "fc9f36ad51f25b0219a3d4d13b90eb44cd075dff8b6280cca015775d7acaddd8"
228
+ checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
229
+ dependencies = [
230
+ "unicode-ident",
231
+ ]
199
232
 
200
233
  [[package]]
201
234
  name = "wasm-bindgen-test"
202
- version = "0.2.50"
235
+ version = "0.3.50"
203
236
  source = "registry+https://github.com/rust-lang/crates.io-index"
204
- checksum = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
237
+ checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3"
205
238
  dependencies = [
206
- "console_error_panic_hook",
207
- "futures",
208
239
  "js-sys",
209
- "scoped-tls",
240
+ "minicov",
210
241
  "wasm-bindgen",
211
242
  "wasm-bindgen-futures",
212
243
  "wasm-bindgen-test-macro",
@@ -214,20 +245,103 @@ dependencies = [
214
245
 
215
246
  [[package]]
216
247
  name = "wasm-bindgen-test-macro"
217
- version = "0.2.50"
248
+ version = "0.3.50"
218
249
  source = "registry+https://github.com/rust-lang/crates.io-index"
219
- checksum = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
250
+ checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b"
220
251
  dependencies = [
221
- "proc-macro2 0.4.30",
222
- "quote 0.6.13",
252
+ "proc-macro2",
253
+ "quote",
254
+ "syn",
223
255
  ]
224
256
 
225
257
  [[package]]
226
258
  name = "web-sys"
227
- version = "0.3.36"
259
+ version = "0.3.77"
228
260
  source = "registry+https://github.com/rust-lang/crates.io-index"
229
- checksum = "721c6263e2c66fd44501cc5efbfa2b7dfa775d13e4ea38c46299646ed1f9c70a"
261
+ checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
230
262
  dependencies = [
231
263
  "js-sys",
232
264
  "wasm-bindgen",
233
265
  ]
266
+
267
+ [[package]]
268
+ name = "winapi-util"
269
+ version = "0.1.9"
270
+ source = "registry+https://github.com/rust-lang/crates.io-index"
271
+ checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
272
+ dependencies = [
273
+ "windows-sys",
274
+ ]
275
+
276
+ [[package]]
277
+ name = "windows-sys"
278
+ version = "0.59.0"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
281
+ dependencies = [
282
+ "windows-targets",
283
+ ]
284
+
285
+ [[package]]
286
+ name = "windows-targets"
287
+ version = "0.52.6"
288
+ source = "registry+https://github.com/rust-lang/crates.io-index"
289
+ checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
290
+ dependencies = [
291
+ "windows_aarch64_gnullvm",
292
+ "windows_aarch64_msvc",
293
+ "windows_i686_gnu",
294
+ "windows_i686_gnullvm",
295
+ "windows_i686_msvc",
296
+ "windows_x86_64_gnu",
297
+ "windows_x86_64_gnullvm",
298
+ "windows_x86_64_msvc",
299
+ ]
300
+
301
+ [[package]]
302
+ name = "windows_aarch64_gnullvm"
303
+ version = "0.52.6"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
306
+
307
+ [[package]]
308
+ name = "windows_aarch64_msvc"
309
+ version = "0.52.6"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
312
+
313
+ [[package]]
314
+ name = "windows_i686_gnu"
315
+ version = "0.52.6"
316
+ source = "registry+https://github.com/rust-lang/crates.io-index"
317
+ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
318
+
319
+ [[package]]
320
+ name = "windows_i686_gnullvm"
321
+ version = "0.52.6"
322
+ source = "registry+https://github.com/rust-lang/crates.io-index"
323
+ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
324
+
325
+ [[package]]
326
+ name = "windows_i686_msvc"
327
+ version = "0.52.6"
328
+ source = "registry+https://github.com/rust-lang/crates.io-index"
329
+ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
330
+
331
+ [[package]]
332
+ name = "windows_x86_64_gnu"
333
+ version = "0.52.6"
334
+ source = "registry+https://github.com/rust-lang/crates.io-index"
335
+ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
336
+
337
+ [[package]]
338
+ name = "windows_x86_64_gnullvm"
339
+ version = "0.52.6"
340
+ source = "registry+https://github.com/rust-lang/crates.io-index"
341
+ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
342
+
343
+ [[package]]
344
+ name = "windows_x86_64_msvc"
345
+ version = "0.52.6"
346
+ source = "registry+https://github.com/rust-lang/crates.io-index"
347
+ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
@@ -13,7 +13,7 @@ lto = true
13
13
  [features]
14
14
 
15
15
  [dependencies]
16
- wasm-bindgen = "0.2.45"
16
+ wasm-bindgen = "0.2.100"
17
17
  js-sys = "0.3.22"
18
18
 
19
19
  [dependencies.web-sys]
@@ -29,7 +29,7 @@ console_error_panic_hook = "0.1.5"
29
29
 
30
30
  # These crates are used for running unit tests.
31
31
  [dev-dependencies]
32
- wasm-bindgen-test = "0.2.45"
32
+ wasm-bindgen-test = "0.3.50"
33
33
  futures = "0.1.27"
34
- wasm-bindgen-futures = "0.3.22"
34
+ wasm-bindgen-futures = "0.4.50"
35
35