Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating LegoStyle tFun to V3 #142

Open
joewdavies opened this issue Nov 20, 2024 · 0 comments
Open

Migrating LegoStyle tFun to V3 #142

joewdavies opened this issue Nov 20, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@joewdavies
Copy link
Collaborator

How would I migrate Lego Style tFun to V3? the only example i could find uses thresholds:

    // get dataset if havent already
    if (!layer.dataset) getDataset(layer)

    //define style
    const styles = LegoStyle.get((cell) => cell[DATAFIELD], [100, 200, 500, 1000, 2000], ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#d95f0e', '#993404'])

    //define layer
    const gridLayer = new GridLayer(layer.dataset, styles, { minPixelsPerCell: 5, cellInfoHTML: TOOLTIPFUNCTION })

    //add layer to map
    gridvizMap.layers = [gridLayer]

    // redraw gridviz
    gridvizMap.redraw()

but the previous code did this:

    app.addLayerFromDataset(
        layer.dataset,
        LegoStyle.get(DATAFIELD, {
            tFun: (v, r, s, zf) => (v == 0 ? 0 : sExpRev((v - s.min) / (s.max - s.min), -7)),
            //colors: d3.schemeRdYlGn[10].reverse()
        }),
        {
            pixNb: 7,
            cellInfoHTML: TOOLTIPFUNCTION,
        }
    )
@joewdavies joewdavies added the documentation Improvements or additions to documentation label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant