gridviz 3.0.26 → 3.0.27

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 (66) hide show
  1. package/README.md +128 -128
  2. package/dist/gridviz.js +8630 -8620
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +73 -73
  5. package/src/button/Button.js +67 -67
  6. package/src/button/FullscreenButton.js +121 -121
  7. package/src/button/ZoomButtons.js +103 -103
  8. package/src/core/Dataset.js +154 -154
  9. package/src/core/Drawable.js +78 -78
  10. package/src/core/GeoCanvas.js +443 -443
  11. package/src/core/Layer.js +23 -23
  12. package/src/core/Legend.js +108 -108
  13. package/src/core/Map.js +544 -544
  14. package/src/core/MultiResolutionDataset.js +93 -93
  15. package/src/core/Style.js +98 -98
  16. package/src/core/Tooltip.js +182 -182
  17. package/src/dataset/COGeo.js +25 -25
  18. package/src/dataset/CSVGrid.js +112 -112
  19. package/src/dataset/GeoTIFF.js +122 -122
  20. package/src/dataset/JSGrid.js +55 -55
  21. package/src/dataset/TiledGrid.js +302 -302
  22. package/src/dataset/worker.js +18 -18
  23. package/src/index.js +77 -77
  24. package/src/layer/BackgroundLayer.js +173 -173
  25. package/src/layer/BackgroundLayerImage.js +81 -81
  26. package/src/layer/BackgroundLayerWMS.js +104 -104
  27. package/src/layer/GeoJSONLayer.js +224 -214
  28. package/src/layer/GridLayer.js +148 -148
  29. package/src/layer/LabelLayer.js +194 -194
  30. package/src/legend/ColorCategoryLegend.js +109 -109
  31. package/src/legend/ColorDiscreteLegend.js +100 -100
  32. package/src/legend/ColorLegend.js +115 -115
  33. package/src/legend/OrientationLegend.js +89 -89
  34. package/src/legend/SizeLegend.js +224 -224
  35. package/src/legend/TernaryLegend.js +302 -302
  36. package/src/style/CompositionStyle.js +291 -291
  37. package/src/style/ContourStyle.js +21 -21
  38. package/src/style/DotDensityStyle.js +133 -133
  39. package/src/style/ImageStyle.js +100 -100
  40. package/src/style/IsoFenceStyle.js +217 -217
  41. package/src/style/JoyPlotStyle.js +127 -127
  42. package/src/style/LegoStyle.js +110 -110
  43. package/src/style/MosaicStyle.js +99 -99
  44. package/src/style/NinjaStarStyle.js +102 -102
  45. package/src/style/PillarStyle.js +207 -207
  46. package/src/style/SegmentStyle.js +105 -105
  47. package/src/style/ShapeColorSizeStyle.js +147 -147
  48. package/src/style/SideCategoryStyle.js +112 -112
  49. package/src/style/SideStyle.js +212 -212
  50. package/src/style/SquareColorCategoryWebGLStyle.js +107 -107
  51. package/src/style/SquareColorWebGLStyle.js +126 -126
  52. package/src/style/StrokeStyle.js +135 -135
  53. package/src/style/TanakaStyle.js +69 -69
  54. package/src/style/TextStyle.js +110 -110
  55. package/src/style/TimeSeriesStyle.js +222 -222
  56. package/src/utils/WebGLRectangleColoring.js +106 -106
  57. package/src/utils/WebGLSquareColoring.js +118 -118
  58. package/src/utils/WebGLSquareColoringAdvanced.js +230 -230
  59. package/src/utils/WebGLSquareColoringCatAdvanced.js +133 -133
  60. package/src/utils/WebGLSquareColoringKS.js +153 -153
  61. package/src/utils/scale.js +218 -218
  62. package/src/utils/stretching.js +120 -120
  63. package/src/utils/ternary.js +208 -208
  64. package/src/utils/utils.js +58 -58
  65. package/src/utils/webGLUtils.js +72 -72
  66. package/src/utils/zoomUtils.js +142 -142
@@ -1,100 +1,100 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- import { Legend } from '../core/Legend.js'
5
-
6
- /**
7
- * A legend element for discrete color style.
8
- * Inspiration: https://observablehq.com/@d3/color-legend
9
- *
10
- * @module legend
11
- * @author Julien Gaffuri
12
- */
13
- export class ColorDiscreteLegend extends Legend {
14
- /** @param {Object} opts */
15
- constructor(opts) {
16
- super(opts)
17
- opts = opts || {}
18
-
19
- /** @private @type {function(import('../core/Style').ViewScale):Array.<string>} */
20
- this.colors = opts.colors
21
- /** @private @type {function(import('../core/Style').ViewScale):Array.<number>} */
22
- this.breaks = opts.breaks
23
-
24
- this.width = opts.width || 300
25
- this.height = opts.height || 15
26
-
27
- this.tickSize = opts.tickSize || 3
28
-
29
- //label
30
- this.invert = opts.invert
31
- }
32
-
33
- /**
34
- * @param {{viewScale:import('../core/Style').ViewScale} } opts
35
- */
36
- update(opts) {
37
- //clear
38
- this.div.selectAll('*').remove()
39
-
40
- //title
41
- this.makeTitle()
42
-
43
- //get colors and breaks
44
- const colors = this.colors(opts.viewScale)
45
- const breaks = this.breaks(opts.viewScale)
46
- if (!breaks) return
47
-
48
- //classes
49
- const nb = colors.length
50
- if (nb == 0) return
51
- const w = this.width / nb
52
-
53
- //make svg element
54
- const svg = this.div
55
- .append('svg')
56
- .attr('width', this.width)
57
- .attr('height', this.height + this.tickSize + 2 + 10)
58
-
59
- //draw graphic elements
60
- for (let i = 0; i < nb; i++) {
61
- svg.append('rect')
62
- .attr('x', i * w)
63
- .attr('y', 0)
64
- .attr('width', w)
65
- .attr('height', this.height)
66
- .style('fill', colors[i])
67
- }
68
-
69
- //tick line
70
- for (let i = 1; i < nb; i++) {
71
- svg.append('line')
72
- .attr('x1', w * i)
73
- .attr('y1', 0)
74
- .attr('x2', w * i)
75
- .attr('y2', this.height + this.tickSize)
76
- .style('stroke', 'black')
77
- }
78
-
79
- //labels
80
- for (let i = 1; i < nb; i++) {
81
- let label = breaks[i - 1]
82
- if (isNaN(label) || label == undefined) continue
83
- if (this.labelFormat) label = this.labelFormat(label, i)
84
-
85
- //label
86
- svg.append('text')
87
- .attr('id', 'ticklabel_' + i)
88
- .attr('x', w * i)
89
- .attr('y', this.height + this.tickSize + 2)
90
- .style('font-size', this.labelFontSize)
91
- //.style("font-weight", "bold")
92
- //.style("font-family", "Arial")
93
- .style('text-anchor', 'middle')
94
- .style('alignment-baseline', 'top')
95
- .style('dominant-baseline', 'hanging')
96
- .style('pointer-events', 'none')
97
- .text(label)
98
- }
99
- }
100
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ import { Legend } from '../core/Legend.js'
5
+
6
+ /**
7
+ * A legend element for discrete color style.
8
+ * Inspiration: https://observablehq.com/@d3/color-legend
9
+ *
10
+ * @module legend
11
+ * @author Julien Gaffuri
12
+ */
13
+ export class ColorDiscreteLegend extends Legend {
14
+ /** @param {Object} opts */
15
+ constructor(opts) {
16
+ super(opts)
17
+ opts = opts || {}
18
+
19
+ /** @private @type {function(import('../core/Style').ViewScale):Array.<string>} */
20
+ this.colors = opts.colors
21
+ /** @private @type {function(import('../core/Style').ViewScale):Array.<number>} */
22
+ this.breaks = opts.breaks
23
+
24
+ this.width = opts.width || 300
25
+ this.height = opts.height || 15
26
+
27
+ this.tickSize = opts.tickSize || 3
28
+
29
+ //label
30
+ this.invert = opts.invert
31
+ }
32
+
33
+ /**
34
+ * @param {{viewScale:import('../core/Style').ViewScale} } opts
35
+ */
36
+ update(opts) {
37
+ //clear
38
+ this.div.selectAll('*').remove()
39
+
40
+ //title
41
+ this.makeTitle()
42
+
43
+ //get colors and breaks
44
+ const colors = this.colors(opts.viewScale)
45
+ const breaks = this.breaks(opts.viewScale)
46
+ if (!breaks) return
47
+
48
+ //classes
49
+ const nb = colors.length
50
+ if (nb == 0) return
51
+ const w = this.width / nb
52
+
53
+ //make svg element
54
+ const svg = this.div
55
+ .append('svg')
56
+ .attr('width', this.width)
57
+ .attr('height', this.height + this.tickSize + 2 + 10)
58
+
59
+ //draw graphic elements
60
+ for (let i = 0; i < nb; i++) {
61
+ svg.append('rect')
62
+ .attr('x', i * w)
63
+ .attr('y', 0)
64
+ .attr('width', w)
65
+ .attr('height', this.height)
66
+ .style('fill', colors[i])
67
+ }
68
+
69
+ //tick line
70
+ for (let i = 1; i < nb; i++) {
71
+ svg.append('line')
72
+ .attr('x1', w * i)
73
+ .attr('y1', 0)
74
+ .attr('x2', w * i)
75
+ .attr('y2', this.height + this.tickSize)
76
+ .style('stroke', 'black')
77
+ }
78
+
79
+ //labels
80
+ for (let i = 1; i < nb; i++) {
81
+ let label = breaks[i - 1]
82
+ if (isNaN(label) || label == undefined) continue
83
+ if (this.labelFormat) label = this.labelFormat(label, i)
84
+
85
+ //label
86
+ svg.append('text')
87
+ .attr('id', 'ticklabel_' + i)
88
+ .attr('x', w * i)
89
+ .attr('y', this.height + this.tickSize + 2)
90
+ .style('font-size', this.labelFontSize)
91
+ //.style("font-weight", "bold")
92
+ //.style("font-family", "Arial")
93
+ .style('text-anchor', 'middle')
94
+ .style('alignment-baseline', 'top')
95
+ .style('dominant-baseline', 'hanging')
96
+ .style('pointer-events', 'none')
97
+ .text(label)
98
+ }
99
+ }
100
+ }
@@ -1,115 +1,115 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- import { Legend } from '../core/Legend.js'
5
-
6
- /**
7
- * A legend element for continuous color style.
8
- * Inspiration: https://observablehq.com/@d3/color-legend
9
- *
10
- * @module legend
11
- * @author Joseph Davies, Julien Gaffuri
12
- */
13
- export class ColorLegend extends Legend {
14
- /** @param {Object} opts */
15
- constructor(opts) {
16
- super(opts)
17
- opts = opts || {}
18
-
19
- //a function [0,1]->color for continuous colors.
20
- //it can take as second argument the viewscale.
21
- this.colorScale = opts.colorScale
22
-
23
- //function (t[0,1]) -> value (for label text)
24
- //it can take as second argument the viewscale.
25
- this.textScale = opts.textScale || ((t) => t)
26
-
27
- this.margin = opts.margin || 5
28
-
29
- //replace with labels ?
30
- this.tickSize = opts.tickSize || 6
31
- this.ticks = opts.ticks || Math.floor(this.width / 50)
32
- this.tickFormat = opts.tickFormat
33
- this.tickUnit = opts.tickUnit
34
-
35
- this.fontSize = opts.fontSize || '0.8em'
36
- this.invert = opts.invert
37
-
38
- this.width = opts.width || 300
39
- this.height = opts.height || 15
40
- }
41
-
42
- /**
43
- * @param {{viewScale:import('../core/Style').ViewScale} } opts
44
- */
45
- update(opts) {
46
- //clear
47
- this.div.selectAll('*').remove()
48
-
49
- //title
50
- this.makeTitle()
51
-
52
- const svgW = this.width + 2 * this.margin
53
- const svgH = this.height + this.margin + this.tickSize + 10
54
- const svg = this.div.append('svg').attr('width', svgW).attr('height', svgH)
55
- // <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
56
-
57
- const g = svg.append('g').attr('transform', 'translate(' + this.margin + ' ' + 0 + ')')
58
-
59
- //draw color bar
60
- const w = this.width,
61
- h = this.height
62
- const step = 5
63
- for (let i = 0; i < w; i += step) {
64
- let t = i / (w - 1)
65
- if (this.invert) t = 1 - t
66
- g.append('rect')
67
- .attr('x', i)
68
- .attr('y', 0)
69
- .attr('width', step)
70
- .attr('height', h)
71
- .style('fill', this.colorScale(t, opts.viewScale))
72
- }
73
-
74
- for (let i = 0; i < this.ticks; i++) {
75
- let t = i / (this.ticks - 1)
76
-
77
- //tick line
78
- g.append('line')
79
- .attr('x1', w * t)
80
- .attr('y1', 0)
81
- .attr('x2', w * t)
82
- .attr('y2', h + this.tickSize)
83
- .style('stroke', 'black')
84
-
85
- //prepare tick label
86
- g.append('text')
87
- .attr('id', 'ticklabel_' + i)
88
- .attr('x', w * t)
89
- .attr('y', h + this.tickSize + 2)
90
- .style('font-size', this.fontSize)
91
- //.style("font-weight", "bold")
92
- //.style("font-family", "Arial")
93
- .style('text-anchor', i == 0 ? 'start' : i == this.ticks - 1 ? 'end' : 'middle')
94
- .style('alignment-baseline', 'top')
95
- .style('dominant-baseline', 'hanging')
96
- .style('pointer-events', 'none')
97
- //.text("-")
98
- }
99
-
100
- //update tick labels
101
-
102
- //label text format
103
- const f = this.tickFormat && this.tickFormat != 'text' ? this.tickFormat : (v) => v
104
- for (let i = 0; i < this.ticks; i++) {
105
- let t = i / (this.ticks - 1)
106
-
107
- const v = this.textScale(t, opts.viewScale)
108
- const text = (v ? f(v) : '0') + (this.tickUnit ? this.tickUnit : '')
109
- if (text == undefined) continue
110
-
111
- //tick label
112
- this.div.select('#' + 'ticklabel_' + i).text(text)
113
- }
114
- }
115
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ import { Legend } from '../core/Legend.js'
5
+
6
+ /**
7
+ * A legend element for continuous color style.
8
+ * Inspiration: https://observablehq.com/@d3/color-legend
9
+ *
10
+ * @module legend
11
+ * @author Joseph Davies, Julien Gaffuri
12
+ */
13
+ export class ColorLegend extends Legend {
14
+ /** @param {Object} opts */
15
+ constructor(opts) {
16
+ super(opts)
17
+ opts = opts || {}
18
+
19
+ //a function [0,1]->color for continuous colors.
20
+ //it can take as second argument the viewscale.
21
+ this.colorScale = opts.colorScale
22
+
23
+ //function (t[0,1]) -> value (for label text)
24
+ //it can take as second argument the viewscale.
25
+ this.textScale = opts.textScale || ((t) => t)
26
+
27
+ this.margin = opts.margin || 5
28
+
29
+ //replace with labels ?
30
+ this.tickSize = opts.tickSize || 6
31
+ this.ticks = opts.ticks || Math.floor(this.width / 50)
32
+ this.tickFormat = opts.tickFormat
33
+ this.tickUnit = opts.tickUnit
34
+
35
+ this.fontSize = opts.fontSize || '0.8em'
36
+ this.invert = opts.invert
37
+
38
+ this.width = opts.width || 300
39
+ this.height = opts.height || 15
40
+ }
41
+
42
+ /**
43
+ * @param {{viewScale:import('../core/Style').ViewScale} } opts
44
+ */
45
+ update(opts) {
46
+ //clear
47
+ this.div.selectAll('*').remove()
48
+
49
+ //title
50
+ this.makeTitle()
51
+
52
+ const svgW = this.width + 2 * this.margin
53
+ const svgH = this.height + this.margin + this.tickSize + 10
54
+ const svg = this.div.append('svg').attr('width', svgW).attr('height', svgH)
55
+ // <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
56
+
57
+ const g = svg.append('g').attr('transform', 'translate(' + this.margin + ' ' + 0 + ')')
58
+
59
+ //draw color bar
60
+ const w = this.width,
61
+ h = this.height
62
+ const step = 5
63
+ for (let i = 0; i < w; i += step) {
64
+ let t = i / (w - 1)
65
+ if (this.invert) t = 1 - t
66
+ g.append('rect')
67
+ .attr('x', i)
68
+ .attr('y', 0)
69
+ .attr('width', step)
70
+ .attr('height', h)
71
+ .style('fill', this.colorScale(t, opts.viewScale))
72
+ }
73
+
74
+ for (let i = 0; i < this.ticks; i++) {
75
+ let t = i / (this.ticks - 1)
76
+
77
+ //tick line
78
+ g.append('line')
79
+ .attr('x1', w * t)
80
+ .attr('y1', 0)
81
+ .attr('x2', w * t)
82
+ .attr('y2', h + this.tickSize)
83
+ .style('stroke', 'black')
84
+
85
+ //prepare tick label
86
+ g.append('text')
87
+ .attr('id', 'ticklabel_' + i)
88
+ .attr('x', w * t)
89
+ .attr('y', h + this.tickSize + 2)
90
+ .style('font-size', this.fontSize)
91
+ //.style("font-weight", "bold")
92
+ //.style("font-family", "Arial")
93
+ .style('text-anchor', i == 0 ? 'start' : i == this.ticks - 1 ? 'end' : 'middle')
94
+ .style('alignment-baseline', 'top')
95
+ .style('dominant-baseline', 'hanging')
96
+ .style('pointer-events', 'none')
97
+ //.text("-")
98
+ }
99
+
100
+ //update tick labels
101
+
102
+ //label text format
103
+ const f = this.tickFormat && this.tickFormat != 'text' ? this.tickFormat : (v) => v
104
+ for (let i = 0; i < this.ticks; i++) {
105
+ let t = i / (this.ticks - 1)
106
+
107
+ const v = this.textScale(t, opts.viewScale)
108
+ const text = (v ? f(v) : '0') + (this.tickUnit ? this.tickUnit : '')
109
+ if (text == undefined) continue
110
+
111
+ //tick label
112
+ this.div.select('#' + 'ticklabel_' + i).text(text)
113
+ }
114
+ }
115
+ }
@@ -1,89 +1,89 @@
1
- //@ts-check
2
- 'use strict'
3
-
4
- import { Legend } from '../core/Legend.js'
5
-
6
- /**
7
- * A legend element for segment orientation.
8
- *
9
- * @module legend
10
- * @author Joseph Davies, Julien Gaffuri
11
- */
12
- export class OrientationLegend extends Legend {
13
- /** @param {Object} opts */
14
- constructor(opts) {
15
- super(opts)
16
- opts = opts || {}
17
-
18
- //orientation
19
- this.orientation = opts.orientation || 0
20
- //color
21
- this.color = opts.color || ((resolution, z, viewScale) => 'gray')
22
- //width
23
- this.width = opts.width || ((resolution, z, viewScale) => 3 * z)
24
- //length
25
- this.length = opts.length || ((resolution, z, viewScale) => resolution)
26
-
27
- //label
28
- this.label = opts.label || '-'
29
- }
30
-
31
- /**
32
- * @param {{ style: import("../style/SegmentStyle.js").SegmentStyle, resolution: number, z: number, viewScale:object }} opts
33
- */
34
- update(opts) {
35
- //clear
36
- this.div.selectAll('*').remove()
37
-
38
- //title
39
- this.makeTitle()
40
-
41
- const d = this.div.append('div')
42
-
43
- //compute segment color, width and length
44
- const color = this.color(opts.resolution, opts.z, opts.viewScale)
45
- const widthPix = this.width(opts.resolution, opts.z, opts.viewScale) / opts.z
46
- const lengthPix = this.length(opts.resolution, opts.z, opts.viewScale) / opts.z
47
-
48
- //draw SVG segment
49
- const svgS = Math.max(lengthPix, widthPix)
50
- const svg = d.append('svg').attr('width', svgS).attr('height', svgS).style('', 'inline-block')
51
-
52
- const cos = Math.cos((-this.orientation * Math.PI) / 180)
53
- const sin = Math.sin((-this.orientation * Math.PI) / 180)
54
- const dc = svgS * 0.5,
55
- l2 = lengthPix * 0.5
56
- svg.append('line')
57
- .attr('x1', dc - cos * l2)
58
- .attr('y1', dc - sin * l2)
59
- .attr('x2', dc + cos * l2)
60
- .attr('y2', dc + sin * l2)
61
- .style('stroke', color)
62
- .style('stroke-width', widthPix)
63
-
64
- //label
65
- d.append('div')
66
- .style('display', 'inline')
67
- .style('padding-left', '5px')
68
- .style('font-size', this.labelFontSize)
69
- .text(this.label + (this.labelUnitText ? ' ' : '') + this.labelUnitText)
70
- }
71
- }
72
-
73
- /**
74
- *
75
- * @param {Array.<number>} orientations
76
- * @param {Array.<string>} labels
77
- * @param {object} opts
78
- * @returns { Array.<OrientationLegend> }
79
- */
80
- export function orientationLegend(orientations, labels, opts = {}) {
81
- const legends = []
82
- for (let i = 0; i < orientations.length; i++) {
83
- opts.title = i == 0 ? opts.title : undefined
84
- opts.orientation = orientations[i]
85
- opts.label = labels[i]
86
- legends.push(new OrientationLegend(opts))
87
- }
88
- return legends
89
- }
1
+ //@ts-check
2
+ 'use strict'
3
+
4
+ import { Legend } from '../core/Legend.js'
5
+
6
+ /**
7
+ * A legend element for segment orientation.
8
+ *
9
+ * @module legend
10
+ * @author Joseph Davies, Julien Gaffuri
11
+ */
12
+ export class OrientationLegend extends Legend {
13
+ /** @param {Object} opts */
14
+ constructor(opts) {
15
+ super(opts)
16
+ opts = opts || {}
17
+
18
+ //orientation
19
+ this.orientation = opts.orientation || 0
20
+ //color
21
+ this.color = opts.color || ((resolution, z, viewScale) => 'gray')
22
+ //width
23
+ this.width = opts.width || ((resolution, z, viewScale) => 3 * z)
24
+ //length
25
+ this.length = opts.length || ((resolution, z, viewScale) => resolution)
26
+
27
+ //label
28
+ this.label = opts.label || '-'
29
+ }
30
+
31
+ /**
32
+ * @param {{ style: import("../style/SegmentStyle.js").SegmentStyle, resolution: number, z: number, viewScale:object }} opts
33
+ */
34
+ update(opts) {
35
+ //clear
36
+ this.div.selectAll('*').remove()
37
+
38
+ //title
39
+ this.makeTitle()
40
+
41
+ const d = this.div.append('div')
42
+
43
+ //compute segment color, width and length
44
+ const color = this.color(opts.resolution, opts.z, opts.viewScale)
45
+ const widthPix = this.width(opts.resolution, opts.z, opts.viewScale) / opts.z
46
+ const lengthPix = this.length(opts.resolution, opts.z, opts.viewScale) / opts.z
47
+
48
+ //draw SVG segment
49
+ const svgS = Math.max(lengthPix, widthPix)
50
+ const svg = d.append('svg').attr('width', svgS).attr('height', svgS).style('', 'inline-block')
51
+
52
+ const cos = Math.cos((-this.orientation * Math.PI) / 180)
53
+ const sin = Math.sin((-this.orientation * Math.PI) / 180)
54
+ const dc = svgS * 0.5,
55
+ l2 = lengthPix * 0.5
56
+ svg.append('line')
57
+ .attr('x1', dc - cos * l2)
58
+ .attr('y1', dc - sin * l2)
59
+ .attr('x2', dc + cos * l2)
60
+ .attr('y2', dc + sin * l2)
61
+ .style('stroke', color)
62
+ .style('stroke-width', widthPix)
63
+
64
+ //label
65
+ d.append('div')
66
+ .style('display', 'inline')
67
+ .style('padding-left', '5px')
68
+ .style('font-size', this.labelFontSize)
69
+ .text(this.label + (this.labelUnitText ? ' ' : '') + this.labelUnitText)
70
+ }
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @param {Array.<number>} orientations
76
+ * @param {Array.<string>} labels
77
+ * @param {object} opts
78
+ * @returns { Array.<OrientationLegend> }
79
+ */
80
+ export function orientationLegend(orientations, labels, opts = {}) {
81
+ const legends = []
82
+ for (let i = 0; i < orientations.length; i++) {
83
+ opts.title = i == 0 ? opts.title : undefined
84
+ opts.orientation = orientations[i]
85
+ opts.label = labels[i]
86
+ legends.push(new OrientationLegend(opts))
87
+ }
88
+ return legends
89
+ }