Skip to content

Commit

Permalink
Update IFS_multi.html
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaffuri authored Mar 15, 2024
1 parent afeed91 commit d0bfd2d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions examples/test/IFS_multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@
const map = new gridviz.Map(document.getElementById('map'), { x: 4500000, y: 2900000, z: 3000 })
.addZoomButtons()

//the maximum resolution of the dataset
const maxResolution = 128000

//function that return a cell resolution
const resolutionFun = (cell) => cell.res * 1000

//define dataset
//set as resolution the maximum resolution
const dataset = new gridviz.CSVGrid(map, "http://localhost:1234/IFS.csv", maxResolution, { mixedResolution: resolutionFun })
//define mixed-resolution dataset
//set as resolution the maximum resolution of the dataset: 128000
//specify mixedResolution parameter as the function returning each cell resolution
const dataset = new gridviz.CSVGrid(map, "http://localhost:1234/IFS.csv", 128000, { mixedResolution: (cell) => cell.res * 1000 })

//make style
const style = new gridviz.ShapeColorSizeStyle({

//some random color
color: (cell) => "rgb(0,0," + (255 * Math.random()) + ")",

//size the cells according to their resolution
size: resolutionFun,
size: dataset.mixedResolution,

//apply an offset to ensure cell position
offset: (cell, resolution, z) => {
const d = resolution * (1 - resolutionFun(cell) / resolution) * 0.5
const d = resolution * (1 - dataset.mixedResolution(cell) / resolution) * 0.5
return { dx: -d, dy: -d }
},
})
Expand Down

0 comments on commit d0bfd2d

Please sign in to comment.