beyond-rails 0.0.193 → 0.0.194
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.
- checksums.yaml +4 -4
- data/src/js/components/LineChart.js +18 -0
- data/src/js/decorators/chartCommon.js +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1887cf7a29a1219ee0a2c8539bc2217e01463de1b0a0347455f3dfa7350fd71d
|
4
|
+
data.tar.gz: 4907c8b698d88f672d4010643fbed444a1747beefcc9120f4feea78d1a53bdfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f6aac570b43111c125dcd9918804adb181d1d0bc1a2a8ec21740ecf337b6b9bacb3d67145b8ac5beac0481cde2b46bee905d1f6a25449df43baf339e0d44644
|
7
|
+
data.tar.gz: 1979260d816dd8508c07cfdc81605bf301a0c8f0f73e3e8ad0b6d22425e0c86d1f24042910791a69e8e86b21427f6c22c4180030b32922e1b9ed9d6d3b61f95d
|
@@ -444,6 +444,7 @@ export default class LineChart {
|
|
444
444
|
this.setLabelWidths()
|
445
445
|
this.setLabelHeights()
|
446
446
|
this.setAxisData()
|
447
|
+
this.updateLabelSizeForAutoStep()
|
447
448
|
this.setPointPos()
|
448
449
|
this.draw()
|
449
450
|
})
|
@@ -496,6 +497,7 @@ export default class LineChart {
|
|
496
497
|
this.setLabelWidths()
|
497
498
|
this.setLabelHeights()
|
498
499
|
this.setAxisData()
|
500
|
+
this.updateLabelSizeForAutoStep()
|
499
501
|
this.setPointPos()
|
500
502
|
this.raf(() => this.draw())
|
501
503
|
}
|
@@ -513,6 +515,22 @@ export default class LineChart {
|
|
513
515
|
})
|
514
516
|
}
|
515
517
|
|
518
|
+
updateLabelSizeForAutoStep() {
|
519
|
+
const { measureWidth } = this
|
520
|
+
if (isUndef(this.xStep)) {
|
521
|
+
this.xLabelWidth = this.xLabelRows.reduce((width, row) => {
|
522
|
+
const measuredWidth = row.length
|
523
|
+
return (measuredWidth > width) ? measuredWidth : width
|
524
|
+
}, 0)
|
525
|
+
}
|
526
|
+
if (isUndef(this.yStep)) {
|
527
|
+
this.yLabelWidth = this.yLabelRows.reduce((width, row) => {
|
528
|
+
const measuredWidth = measureWidth.call(this, row.label)
|
529
|
+
return (measuredWidth > width) ? measuredWidth : width
|
530
|
+
}, 0)
|
531
|
+
}
|
532
|
+
}
|
533
|
+
|
516
534
|
destroy() {
|
517
535
|
const { dom, canvas } = this
|
518
536
|
const { toXLabel, toYLabel } = this.options
|
@@ -155,6 +155,10 @@ export default function chartCommon(target) {
|
|
155
155
|
return [stepStart, stepEnd]
|
156
156
|
}
|
157
157
|
|
158
|
+
measureWidth(value) {
|
159
|
+
return this.ctx.measureText(value).width
|
160
|
+
}
|
161
|
+
|
158
162
|
raf(fn) {
|
159
163
|
if (isDef(window.requestAnimationFrame)) {
|
160
164
|
return window.requestAnimationFrame(fn)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beyond-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.194
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kmsheng
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-09-
|
12
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sassc
|