gridviz 3.0.0 → 3.0.2

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 (54) hide show
  1. package/README.md +36 -33
  2. package/dist/gridviz.js +528 -229
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +4 -3
  5. package/src/button/Button.js +1 -0
  6. package/src/button/FullscreenButton.js +1 -0
  7. package/src/button/ZoomButtons.js +1 -0
  8. package/src/core/Dataset.js +1 -1
  9. package/src/core/Drawable.js +1 -0
  10. package/src/core/GeoCanvas.js +1 -0
  11. package/src/core/Layer.js +1 -0
  12. package/src/core/Legend.js +1 -0
  13. package/src/core/Map.js +15 -0
  14. package/src/core/MultiResolutionDataset.js +1 -0
  15. package/src/core/Style.js +10 -1
  16. package/src/core/Tooltip.js +1 -0
  17. package/src/dataset/COGeo.js +1 -0
  18. package/src/dataset/CSVGrid.js +1 -0
  19. package/src/dataset/GeoTIFF.js +1 -0
  20. package/src/dataset/JSGrid.js +3 -3
  21. package/src/dataset/TiledGrid.js +1 -0
  22. package/src/index.js +3 -3
  23. package/src/layer/BackgroundLayer.js +1 -0
  24. package/src/layer/BackgroundLayerWMS.js +1 -0
  25. package/src/layer/GeoJSONLayer.js +1 -0
  26. package/src/layer/GridLayer.js +21 -0
  27. package/src/layer/LabelLayer.js +1 -0
  28. package/src/legend/ColorCategoryLegend.js +1 -0
  29. package/src/legend/ColorDiscreteLegend.js +2 -0
  30. package/src/legend/ColorLegend.js +1 -0
  31. package/src/legend/OrientationLegend.js +1 -0
  32. package/src/legend/SizeLegend.js +4 -2
  33. package/src/style/CompositionStyle.js +1 -0
  34. package/src/style/ContourStyle.js +1 -0
  35. package/src/style/DotDensityStyle.js +1 -0
  36. package/src/style/IsoFenceStyle.js +24 -72
  37. package/src/style/JoyPlotStyle.js +1 -1
  38. package/src/style/LegoStyle.js +22 -24
  39. package/src/style/MosaicStyle.js +1 -0
  40. package/src/style/NinjaStarStyle.js +1 -1
  41. package/src/style/PillarStyle.js +1 -0
  42. package/src/style/SegmentStyle.js +1 -0
  43. package/src/style/ShapeColorSizeStyle.js +1 -0
  44. package/src/style/SideCategoryStyle.js +1 -0
  45. package/src/style/SideStyle.js +51 -28
  46. package/src/style/SquareColorCategoryWebGLStyle.js +4 -3
  47. package/src/style/SquareColorWebGLStyle.js +1 -0
  48. package/src/style/StrokeStyle.js +1 -1
  49. package/src/style/TanakaStyle.js +11 -5
  50. package/src/style/TextStyle.js +1 -1
  51. package/src/style/TimeSeriesStyle.js +1 -0
  52. package/src/utils/scale.js +44 -18
  53. package/src/utils/stretching.js +4 -0
  54. package/src/utils/utils.js +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridviz",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Visualization tool for gridded statistics",
5
5
  "keywords": [
6
6
  "statistics",
@@ -40,7 +40,7 @@
40
40
  "start": "export NODE_OPTIONS=--openssl-legacy-provider && webpack --config webpack.config.dev.cjs",
41
41
  "start-dev": "webpack --config webpack.config.dev.cjs",
42
42
  "server": "webpack serve -c webpack.config.dev.cjs",
43
- "doc": "./node_modules/.bin/jsdoc src/ src/dataset src/legend src/style -d docs/jsdoc",
43
+ "doc": "./node_modules/.bin/jsdoc -c docs/jsdoc/jsdoc.conf.json",
44
44
  "bp": "webpack --config webpack.config.prod.cjs",
45
45
  "test": "jest"
46
46
  },
@@ -55,7 +55,8 @@
55
55
  "d3-random": "^3.0.1",
56
56
  "d3-scale": "^4.0.2",
57
57
  "d3-selection": "^3.0.0",
58
- "d3-zoom": "^3.0.0"
58
+ "d3-zoom": "^3.0.0",
59
+ "jsdoc": "^4.0.2"
59
60
  },
60
61
  "devDependencies": {
61
62
  "@babel/core": "^7.9.0",
@@ -3,6 +3,7 @@ import { select } from 'd3-selection'
3
3
  /**
4
4
  * Parent class for button elements used to interact with the gridviz viewer.
5
5
  *
6
+ * @module button
6
7
  * @author Joseph Davies, Julien Gaffuri
7
8
  */
8
9
  export class Button {
@@ -3,6 +3,7 @@ import { Button } from './Button.js'
3
3
  /**
4
4
  * Button for toggling fullscreen mode
5
5
  *
6
+ * @module button
6
7
  * @author Joseph Davies, Julien Gaffuri
7
8
  */
8
9
  export class FullscreenButton extends Button {
@@ -3,6 +3,7 @@ import { Button } from './Button.js'
3
3
  /**
4
4
  * Button for toggling fullscreen mode
5
5
  *
6
+ * @module button
6
7
  * @author Joseph Davies, Julien Gaffuri
7
8
  */
8
9
  export class ZoomButtons extends Button {
@@ -9,6 +9,7 @@
9
9
  * A dataset component, of grid cells.
10
10
  * @abstract
11
11
  *
12
+ * @module core
12
13
  * @author Joseph Davies, Julien Gaffuri
13
14
  */
14
15
  export class Dataset {
@@ -20,7 +21,6 @@ export class Dataset {
20
21
  * @abstract
21
22
  */
22
23
  constructor(map, url, resolution, opts = {}) {
23
- opts = opts || {}
24
24
 
25
25
  /**
26
26
  * The map.
@@ -5,6 +5,7 @@
5
5
  * This is an abstract class used to group elements shared between Layer and Style classes.
6
6
  *
7
7
  * @abstract
8
+ * @module core
8
9
  * @author Joseph Davies, Julien Gaffuri
9
10
  */
10
11
  export class Drawable {
@@ -13,6 +13,7 @@ import { zoom as d3zoom, zoomIdentity } from 'd3-zoom'
13
13
  /**
14
14
  * A HTML canvas for geo data display, enhanced with zoom and pan capabilities.
15
15
  *
16
+ * @module core
16
17
  * @author Joseph Davies, Julien Gaffuri
17
18
  */
18
19
  export class GeoCanvas {
package/src/core/Layer.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { Drawable } from "./Drawable.js"
5
5
 
6
6
  /**
7
+ * @module core
7
8
  * @abstract
8
9
  * @author Joseph Davies, Julien Gaffuri
9
10
  */
@@ -6,6 +6,7 @@ import { select } from 'd3-selection'
6
6
  /**
7
7
  * A legend container.
8
8
  *
9
+ * @module core
9
10
  * @author Joseph Davies, Julien Gaffuri
10
11
  */
11
12
  export class Legend {
package/src/core/Map.js CHANGED
@@ -13,6 +13,7 @@ import { select } from 'd3-selection'
13
13
  /**
14
14
  * A gridviz application.
15
15
  *
16
+ * @module core
16
17
  * @author Joseph Davies, Julien Gaffuri
17
18
  */
18
19
  export class Map {
@@ -135,6 +136,20 @@ export class Map {
135
136
  //.style("visibility", "hidden")
136
137
  }
137
138
 
139
+ /**
140
+ * Set/get layer stack.
141
+ *
142
+ * @param {undefined|import("./Layer.js").Layer|import("./Layer.js").Layer[]} layers
143
+ * @returns { this | import("./Layer.js").Layer[] }
144
+ */
145
+ layers_(layers) {
146
+ if (arguments.length === 0) return this.layers
147
+ if (arguments.length === 1)
148
+ if (Array.isArray(layers)) this.layers = layers
149
+ else this.layers = [layers]
150
+ else this.layers = arguments
151
+ return this
152
+ }
138
153
 
139
154
  /** @returns {this} */
140
155
  redraw() {
@@ -7,6 +7,7 @@
7
7
  *
8
8
  * @abstract
9
9
  *
10
+ * @module core
10
11
  * @author Joseph Davies, Julien Gaffuri
11
12
  */
12
13
  export class MultiResolutionDataset {
package/src/core/Style.js CHANGED
@@ -13,6 +13,7 @@ import { Drawable } from "./Drawable.js"
13
13
  /**
14
14
  * A style, to show a grid dataset.
15
15
  *
16
+ * @module core
16
17
  * @author Joseph Davies, Julien Gaffuri
17
18
  */
18
19
  export class Style extends Drawable {
@@ -73,7 +74,7 @@ export class Style extends Drawable {
73
74
  return this
74
75
  }
75
76
 
76
- /** Hide all legend elements of the style, if any
77
+ /** Update legends of the style, if any
77
78
  * @param {object} opts
78
79
  * @returns {this} */
79
80
  updateLegends(opts) {
@@ -81,4 +82,12 @@ export class Style extends Drawable {
81
82
  return this
82
83
  }
83
84
 
85
+ /**
86
+ * @param {Array.<import("./Legend").Legend>} legends
87
+ * @returns {this} */
88
+ addLegends(legends) {
89
+ for (let legend of legends)
90
+ this.legends.push(legend)
91
+ return this
92
+ }
84
93
  }
@@ -7,6 +7,7 @@ import { select } from 'd3-selection'
7
7
  /**
8
8
  * A generic class to make a tooltip.
9
9
  * It is a div element, which can be moved under the mouse pointer and filled with some information in html.
10
+ * @module core
10
11
  */
11
12
  export class Tooltip {
12
13
  /**
@@ -8,6 +8,7 @@ import { Dataset } from '../core/Dataset.js'
8
8
  * A dataset composed of a COGeo file.
9
9
  * @see https://www.cogeo.org/
10
10
  *
11
+ * @module dataset
11
12
  * @author Joseph Davies, Julien Gaffuri
12
13
  */
13
14
  export class COGeo extends Dataset {
@@ -9,6 +9,7 @@ import { Dataset } from '../core/Dataset.js'
9
9
  /**
10
10
  * A dataset composed of a single CSV file (not tiled).
11
11
  *
12
+ * @module dataset
12
13
  * @author Joseph Davies, Julien Gaffuri
13
14
  */
14
15
  export class CSVGrid extends Dataset {
@@ -8,6 +8,7 @@ import { Dataset } from '../core/Dataset.js'
8
8
  * @todo
9
9
  * A dataset composed of a single GeoTiff file.
10
10
  *
11
+ * @module dataset
11
12
  * @author Joseph Davies, Julien Gaffuri
12
13
  */
13
14
  export class GeoTIFF extends Dataset {
@@ -1,16 +1,16 @@
1
1
  //@ts-check
2
2
  'use strict'
3
3
 
4
- /** @typedef {{ dims: object, crs: string, tileSizeCell: number, originPoint: {x:number,y:number}, resolutionGeo: number, tilingBounds:import("../core/GeoCanvas.js").Envelope }} GridInfo */
5
-
6
4
  import { Dataset } from '../core/Dataset.js'
7
5
 
8
6
  /**
9
7
  * A dataset composed of cells defined in javascript, or loaded outside of gridviz map.
10
8
  *
9
+ * @module dataset
11
10
  * @author Joseph Davies, Julien Gaffuri
12
11
  */
13
12
  export class JSGrid extends Dataset {
13
+
14
14
  /**
15
15
  * @param {number} resolution The dataset resolution in geographical unit.
16
16
  * @param {Array.<Object>} cells The cells.
@@ -20,7 +20,7 @@ export class JSGrid extends Dataset {
20
20
 
21
21
  /**
22
22
  * @private
23
- * @type {Array.<import("../core/MultiResolutionDataset.js").Cell>} */
23
+ * @type {Array.<import('../core/Dataset.js').Cell>} */
24
24
  this.cells = cells || []
25
25
  }
26
26
 
@@ -13,6 +13,7 @@ import { json, csv } from 'd3-fetch'
13
13
  /**
14
14
  * A tiled dataset, composed of CSV tiles.
15
15
  *
16
+ * @module dataset
16
17
  * @author Joseph Davies, Julien Gaffuri
17
18
  */
18
19
  export class TiledGrid extends Dataset {
package/src/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  // the application
5
5
  export { Map } from './core/Map.js'
6
- //export { GeoCanvas } from './GeoCanvas.js'
6
+ export { GeoCanvas } from './core/GeoCanvas.js'
7
7
  export { Style } from './core/Style.js'
8
8
  export { Layer } from './core/Layer.js'
9
9
  export { MultiResolutionDataset } from './core/MultiResolutionDataset.js'
@@ -25,8 +25,8 @@ export { SideStyle } from './style/SideStyle.js'
25
25
  //export { ContourStyle } from './style/ContourStyle.js'
26
26
  export { SideCategoryStyle } from './style/SideCategoryStyle.js'
27
27
  export { DotDensityStyle } from './style/DotDensityStyle.js'
28
- //export { TanakaStyle } from './style/TanakaStyle.js'
29
- //export { LegoStyle } from './style/LegoStyle.js'
28
+ export { TanakaStyle } from './style/TanakaStyle.js'
29
+ export { LegoStyle } from './style/LegoStyle.js'
30
30
  export { SquareColorWebGLStyle } from './style/SquareColorWebGLStyle.js'
31
31
  export { SquareColorCategoryWebGLStyle } from './style/SquareColorCategoryWebGLStyle.js'
32
32
  export { MosaicStyle } from './style/MosaicStyle.js'
@@ -9,6 +9,7 @@ import { Layer } from '../core/Layer.js'
9
9
  * See https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
10
10
  * https://www.maptiler.com/google-maps-coordinates-tile-bounds-projection/#6/27.88/44.48
11
11
  *
12
+ * @module layer
12
13
  * @author Julien Gaffuri
13
14
  */
14
15
  export class BackgroundLayer extends Layer {
@@ -7,6 +7,7 @@ import { Layer } from '../core/Layer.js'
7
7
  *
8
8
  * A map WMS background layer.
9
9
  *
10
+ * @module layer
10
11
  * @author Julien Gaffuri
11
12
  */
12
13
  export class BackgroundLayerWMS extends Layer {
@@ -5,6 +5,7 @@ import { Layer } from '../core/Layer.js'
5
5
  import { json } from 'd3-fetch'
6
6
 
7
7
  /**
8
+ * @module layer
8
9
  * @author Joseph Davies, Julien Gaffuri
9
10
  */
10
11
  export class GeoJSONLayer extends Layer {
@@ -6,6 +6,7 @@ import { Layer } from '../core/Layer.js'
6
6
  /**
7
7
  * A layer, which specifies a dataset to be shown with specified styles.
8
8
  *
9
+ * @module layer
9
10
  * @author Joseph Davies, Julien Gaffuri
10
11
  */
11
12
  export class GridLayer extends Layer {
@@ -20,6 +21,7 @@ export class GridLayer extends Layer {
20
21
 
21
22
  /** @type {import("../core/Dataset").Dataset|import("../core/MultiResolutionDataset").MultiResolutionDataset} */
22
23
  this.dataset = dataset
24
+
23
25
  /** @type {Array.<import("../core/Style").Style>} */
24
26
  this.styles = styles
25
27
 
@@ -121,6 +123,25 @@ export class GridLayer extends Layer {
121
123
  return this.dataset.getDataset(z, this.minPixelsPerCell);
122
124
  }
123
125
 
126
+
127
+
128
+ /**
129
+ * Set/get style stack.
130
+ *
131
+ * @param {undefined|import("../core/Style").Style|Array.<import("../core/Style").Style>} styles
132
+ * @returns { this | Array.<import("../core/Style").Style> }
133
+ */
134
+ styles_(styles) {
135
+ if (arguments.length === 0) return this.styles
136
+ if (arguments.length === 1)
137
+ if (Array.isArray(styles)) this.styles = styles
138
+ else this.styles = [styles]
139
+ else this.styles = arguments
140
+ return this
141
+ }
142
+
143
+
144
+
124
145
  /**
125
146
  * The default function returning cell information as HTML.
126
147
  * This is typically used for tooltip information.
@@ -13,6 +13,7 @@ import { csv } from 'd3-fetch'
13
13
  * If the label data is not in the expected format or in the same CRS as the grid, it can be corrected with the "preprocess" function.
14
14
  * The selection of the label, their style (font, weight, etc.) and color can be specified depending on their importance and the zoom level.
15
15
  *
16
+ * @module layer
16
17
  * @author Joseph Davies, Julien Gaffuri
17
18
  */
18
19
  export class LabelLayer extends Layer {
@@ -6,6 +6,7 @@ import { Legend } from '../core/Legend.js'
6
6
  /**
7
7
  * A legend element for color categrories.
8
8
  *
9
+ * @module legend
9
10
  * @author Joseph Davies, Julien Gaffuri
10
11
  */
11
12
  export class ColorCategoryLegend extends Legend {
@@ -7,6 +7,7 @@ import { Legend } from '../core/Legend.js'
7
7
  * A legend element for discrete color style.
8
8
  * Inspiration: https://observablehq.com/@d3/color-legend
9
9
  *
10
+ * @module legend
10
11
  * @author Julien Gaffuri
11
12
  */
12
13
  export class ColorDiscreteLegend extends Legend {
@@ -43,6 +44,7 @@ export class ColorDiscreteLegend extends Legend {
43
44
  //get colors and breaks
44
45
  const colors = this.colors(opts.viewScale)
45
46
  const breaks = this.breaks(opts.viewScale)
47
+ if (!breaks) return
46
48
 
47
49
  //classes
48
50
  const nb = colors.length
@@ -7,6 +7,7 @@ import { Legend } from '../core/Legend.js'
7
7
  * A legend element for continuous color style.
8
8
  * Inspiration: https://observablehq.com/@d3/color-legend
9
9
  *
10
+ * @module legend
10
11
  * @author Joseph Davies, Julien Gaffuri
11
12
  */
12
13
  export class ColorLegend extends Legend {
@@ -6,6 +6,7 @@ import { Legend } from '../core/Legend.js'
6
6
  /**
7
7
  * A legend element for segment orientation.
8
8
  *
9
+ * @module legend
9
10
  * @author Joseph Davies, Julien Gaffuri
10
11
  */
11
12
  export class OrientationLegend extends Legend {
@@ -8,6 +8,7 @@ import { max } from 'd3-array'
8
8
  /**
9
9
  * A legend element for proportional symbols.
10
10
  *
11
+ * @module legend
11
12
  * @author Joseph Davies, Julien Gaffuri
12
13
  */
13
14
  export class SizeLegend extends Legend {
@@ -198,10 +199,11 @@ export function sizeDiscreteViewScaleLegend(classNumber, opts = {}) {
198
199
  const f = opts.labelFormat || (x => x)
199
200
  const labelText = opts.labelText || defaultLabelText(f)
200
201
  const legends = []
202
+ const viewScaleFun = opts.viewScaleFun || (t => t) //TODO do it differently? At sizelegend level !
201
203
  for (let i = classNumber - 1; i >= 0; i--) {
202
204
  opts.title = i == classNumber - 1 ? opts.title : undefined
203
- opts.size = (viewScale) => viewScale.values[i]
204
- opts.label = (viewScale) => labelText(viewScale.breaks[i - 1], viewScale.breaks[i])
205
+ opts.size = (viewScale) => viewScaleFun(viewScale).values[i]
206
+ opts.label = (viewScale) => labelText(viewScaleFun(viewScale).breaks[i - 1], viewScaleFun(viewScale).breaks[i])
205
207
  legends.push(new SizeLegend(opts))
206
208
  }
207
209
  return legends
@@ -11,6 +11,7 @@ import { Style } from '../core/Style.js'
11
11
  * For a list of supported symbols, @see CompositionType
12
12
  * The symbol can be scaled depending on the cell importance.
13
13
  *
14
+ * @module style
14
15
  * @author Julien Gaffuri
15
16
  */
16
17
  export class CompositionStyle extends Style {
@@ -7,6 +7,7 @@ import { SideStyle } from './SideStyle.js'
7
7
 
8
8
  /**
9
9
  *
10
+ * @module style
10
11
  * @author Julien Gaffuri
11
12
  */
12
13
  export class ContourStyle extends SideStyle {
@@ -9,6 +9,7 @@ import { color } from 'd3-color'
9
9
 
10
10
  /**
11
11
  *
12
+ * @module style
12
13
  * @author Julien Gaffuri
13
14
  */
14
15
  export class DotDensityStyle extends Style {
@@ -7,6 +7,7 @@ import { SideStyle } from './SideStyle.js'
7
7
  /** @typedef {{x:number,y:number,or:"v"|"h",c1:import('../core/Dataset.js').Cell|undefined,c2:import('../core/Dataset.js').Cell|undefined}} Side */
8
8
 
9
9
  /**
10
+ * @module style
10
11
  * @author Julien Gaffuri
11
12
  */
12
13
  export class IsoFenceStyle extends Style {
@@ -77,57 +78,7 @@ export class IsoFenceStyle extends Style {
77
78
 
78
79
  //make sides
79
80
  /** @type {Array.<Side>} */
80
- const sides = SideStyle.buildSides(cells, resolution, this.angle % 180 != 90 && this.sVert, this.angle % 180 != 0 && this.sHor, true)
81
-
82
-
83
-
84
- /*const sides = []
85
-
86
- //make horizontal sides - except when angle%180=0
87
- //sort cells by x and y
88
- if (this.angle % 180 != 90 && this.sVert) {
89
- cells.sort((c1, c2) => (c2.x == c1.x ? c1.y - c2.y : c1.x - c2.x))
90
- let c1 = cells[0]
91
- for (let i = 1; i < cells.length; i++) {
92
- let c2 = cells[i]
93
-
94
- if ((c1.y + resolution == c2.y) && (c1.x == c2.x))
95
- //cells in same column and touch along horizontal side
96
- //make shared side
97
- sides.push({ x: c1.x + r2, y: c2.y, or: 'h', c1: c1, c2: c2 })
98
- else {
99
- //cells do not touch along horizontal side
100
- //make two sides: top one for c1, bottom for c2
101
- sides.push({ x: c1.x + r2, y: c1.y + resolution, or: 'h', c1: c1, c2: undefined })
102
- sides.push({ x: c2.x + r2, y: c2.y, or: 'h', c1: undefined, c2: c2 })
103
- }
104
-
105
- c1 = c2
106
- }
107
- }
108
-
109
- //make vertical sides - except when angle%180=90
110
- //sort cells by y and x
111
- if (this.angle % 180 != 0 && this.sHor) {
112
- cells.sort((c1, c2) => (c2.y == c1.y ? c1.x - c2.x : c1.y - c2.y))
113
- let c1 = cells[0]
114
- for (let i = 1; i < cells.length; i++) {
115
- let c2 = cells[i]
116
-
117
- if ((c1.x + resolution == c2.x) && (c1.y == c2.y))
118
- //cells in same row and touch along vertical side
119
- //make shared side
120
- sides.push({ x: c2.x, y: c1.y + r2, or: 'v', c1: c1, c2: c2 })
121
- else {
122
- //cells do not touch along vertical side
123
- //make two sides: right one for c1, left for c2
124
- sides.push({ x: c1.x + resolution, y: c1.y + r2, or: 'v', c1: c1, c2: undefined })
125
- sides.push({ x: c2.x, y: c2.y + r2, or: 'v', c1: undefined, c2: c2 })
126
- }
127
-
128
- c1 = c2
129
- }
130
- }*/
81
+ const sides = SideStyle.buildSides(cells, resolution, this.angle % 180 != 90 && this.sVert, this.angle % 180 != 0 && this.sHor)
131
82
 
132
83
  //
133
84
  if (sides.length == 0) return
@@ -163,15 +114,16 @@ export class IsoFenceStyle extends Style {
163
114
 
164
115
  //draw sides
165
116
  geoCanvas.ctx.lineCap = "round";
166
- for (let s of sides) {
117
+ for (let side of sides) {
118
+ const c1 = side.c1, c2 = side.c2, x = side.x, y = side.y
167
119
 
168
120
  //heights - in geo
169
- const hG1 = s.c1 ? this.height(s.c1, resolution, z, viewScale) : 0,
170
- hG2 = s.c2 ? this.height(s.c2, resolution, z, viewScale) : 0
121
+ const hG1 = c1 ? this.height(c1, resolution, z, viewScale) : 0,
122
+ hG2 = c2 ? this.height(c2, resolution, z, viewScale) : 0
171
123
 
172
124
  //compute totals for both cells
173
- const total1 = computeTotal(s.c1, cats),
174
- total2 = computeTotal(s.c2, cats)
125
+ const total1 = computeTotal(c1, cats),
126
+ total2 = computeTotal(c2, cats)
175
127
  if (total1 == 0 && total2 == 0) continue
176
128
 
177
129
  let cumul1 = 0, cumul2 = 0
@@ -179,8 +131,8 @@ export class IsoFenceStyle extends Style {
179
131
  //draw stripe of side s and category column
180
132
 
181
133
  //get values for both cells
182
- let v1 = s.c1 ? +s.c1[column] : 0
183
- let v2 = s.c2 ? +s.c2[column] : 0
134
+ let v1 = c1 ? +c1[column] : 0
135
+ let v2 = c2 ? +c2[column] : 0
184
136
  if (v1 == 0 && v2 == 0) continue
185
137
 
186
138
  //compute heights
@@ -191,26 +143,26 @@ export class IsoFenceStyle extends Style {
191
143
 
192
144
  //make path
193
145
  geoCanvas.ctx.beginPath()
194
- if (s.or == "h") {
146
+ if (side.or == "h") {
195
147
  //horizontal side - vertical section
196
148
  //bottom left
197
- geoCanvas.ctx.moveTo(s.x + h1 * cos + dx, s.y - r2 + h1 * sin + dy)
149
+ geoCanvas.ctx.moveTo(x + h1 * cos + dx, y - r2 + h1 * sin + dy)
198
150
  //top left
199
- geoCanvas.ctx.lineTo(s.x + h2 * cos + dx, s.y + r2 + h2 * sin + dy)
151
+ geoCanvas.ctx.lineTo(x + h2 * cos + dx, y + r2 + h2 * sin + dy)
200
152
  //top right
201
- geoCanvas.ctx.lineTo(s.x + h2n * cos + dx, s.y + r2 + h2n * sin + dy)
153
+ geoCanvas.ctx.lineTo(x + h2n * cos + dx, y + r2 + h2n * sin + dy)
202
154
  //bottom right
203
- geoCanvas.ctx.lineTo(s.x + h1n * cos + dx, s.y - r2 + h1n * sin + dy)
155
+ geoCanvas.ctx.lineTo(x + h1n * cos + dx, y - r2 + h1n * sin + dy)
204
156
  } else {
205
157
  //vertical side - horizontal section
206
158
  //bottom left
207
- geoCanvas.ctx.moveTo(s.x - r2 + h1 * cos + dx, s.y + h1 * sin + dy)
159
+ geoCanvas.ctx.moveTo(x - r2 + h1 * cos + dx, y + h1 * sin + dy)
208
160
  //bottom right
209
- geoCanvas.ctx.lineTo(s.x + r2 + h2 * cos + dx, s.y + h2 * sin + dy)
161
+ geoCanvas.ctx.lineTo(x + r2 + h2 * cos + dx, y + h2 * sin + dy)
210
162
  //top right
211
- geoCanvas.ctx.lineTo(s.x + r2 + h2n * cos + dx, s.y + h2n * sin + dy)
163
+ geoCanvas.ctx.lineTo(x + r2 + h2n * cos + dx, y + h2n * sin + dy)
212
164
  //top left
213
- geoCanvas.ctx.lineTo(s.x - r2 + h1n * cos + dx, s.y + h1n * sin + dy)
165
+ geoCanvas.ctx.lineTo(x - r2 + h1n * cos + dx, y + h1n * sin + dy)
214
166
  }
215
167
  //cg.ctx.closePath()
216
168
 
@@ -223,11 +175,11 @@ export class IsoFenceStyle extends Style {
223
175
 
224
176
  //TODO draw only one line
225
177
  //draw corner line
226
- //if (s.or == "h") {
227
- drawCornerLine(s.c1)
228
- drawCornerLine(s.c2)
229
- //if (this.angle > 0 && s.or == "h") drawCornerLine(s.c2)
230
- //else drawCornerLine(s.c2)
178
+ //if (side.or == "h") {
179
+ drawCornerLine(c1)
180
+ drawCornerLine(c2)
181
+ //if (this.angle > 0 && side.or == "h") drawCornerLine(c2)
182
+ //else drawCornerLine(c2)
231
183
  //}
232
184
  }
233
185
  }
@@ -4,7 +4,7 @@
4
4
  import { Style } from '../core/Style.js'
5
5
 
6
6
  /**
7
- *
7
+ * @module style
8
8
  * @author Julien Gaffuri
9
9
  */
10
10
  export class JoyPlotStyle extends Style {