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

Need to override function writeQuery with custom function #65

Open
ghost opened this issue Oct 31, 2018 · 2 comments
Open

Need to override function writeQuery with custom function #65

ghost opened this issue Oct 31, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 31, 2018

@uyanga-gb I have a requirement to override writeQuery method in the mapd crossfilter libray.
Can you suggest a way in which I can override the writeQuery method in the crossfilter js using custom function by inheriting in new object without making changes in this mapd-crossfilter.js

@biovisualize
Copy link
Contributor

That's a general javascript question, but here's one way we are extending mapd crossfilter with custom methods in Immerse:

function getTopN(column) {
  const group = this.dimension(column)
    .order("val")
    .group()
    .reduceCount(column)

  return group
    .topAsync(NUM_DEFAULT_CATEGORIES, 0, null, true)
    .then(results => results.map(result => result.key0))
}


export function extendCrossfilter(crossfilter) {
  crossfilter.getTopN = getTopN.bind(crossfilter)
  return crossfilter
}

@ghost
Copy link
Author

ghost commented Oct 31, 2018

Actually the issue is I want group by.... with having clause for ILIKE on array Column, So I need to have facility to create group by.. having queries through crossfilter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant