-
Notifications
You must be signed in to change notification settings - Fork 46
setting different symbols/colors for subsets of catalog sources #200
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
Comments
That is a good idea, it is possible to return different 'shapes' (e.g. Circle, Polyline objects) from the shape function (see that example displaying proper motion arrow associated to sources within a same catalog object: https://aladin.cds.unistra.fr/AladinLite/doc/API/examples/show-proper-motions/) but not symbols like you want. Also, the |
@havok2063 - #262 is a little PR to allow you returning a string from the shape function which is partly what you need. I agree this is great to do the same for the color (accept a (s) => { ... }) but as it not been done yet, I will not close that issue. The first thing should be available in the soon release 3.6.1 version. |
@bmatthieu3 this is great, thanks! I'll take a closer look soon and wait for 3.6.1 to try it out. In the meantime, can you provide a small example of usage? Presumably it's a little different than my original pseudo-code. |
Normally your code example will be valid function setShape(source) {
if (source.type == 'a') {
return 'circle'
} else if (source.type == 'b') {
return 'square'
}
}
var cat = A.catalog({name: 'Catalog1', sourceSize: 18, shape: setShape});
aladin.addCatalog(cat); You can also return from setShape an Image or a HTMLCanvasElement, or even a A.circle/polygon/ellipse |
Awesome, thanks! |
Right now, you can only set a single symbol/shape for an entire catalog. It would be very useful to set different symbols for subsets of sources within a catalog. Currently you would need to create new catalogs for each data subset. Sometimes I want to differentiate sources but retain a single catalog. It would be useful to set a shape and size on a per source basis, something like
My use case is I want to set different symbols based on a particular property or condition of the source dataset, so I'd like to pass in a function that can act on each source, maybe something like
It could be useful to do this for several symbol properties like
shape
,size
andcolor
. Similar to this https://aladin.cds.unistra.fr/AladinLite/doc/API/examples/cat-custom-draw-function/ but without manually drawing on the canvas. I tried adapting this example but it doesn't quite work.The text was updated successfully, but these errors were encountered: