-
Notifications
You must be signed in to change notification settings - Fork 263
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
layer.model.attributes.legend inconsistent #523
Comments
Anyone have any ideas about this, is there some other way that I'm supposed to create the Legend? |
@knownasilya. Could you please share some of your code with us? We'd like to see how you're using |
function createLayer(map, options) {
if (!options || !options.url || !options.name) {
throw 'Invalid layer declaration';
}
return new Promise(function (resolve, reject) {
var layer = cartodb.createLayer(map, options.url, {
scrollwheel: false,
cartodb_logo: false,
infowindow: false,
tooltip: false,
legends: false,
time_slider: false
});
layer.on('error', function (error) {
console.error('CartoDB Layer Error: ', error);
reject(error);
})
.on('done', function (layer) {
if (typeof layer.setInteraction === 'function') {
layer.setInteraction(false);
}
if (layer.pause) {
layer.pause();
layer.slider = new cdb.geo.ui.TimeSlider({
layer: layer
}).render();
}
if (layer.model.attributes.legend) {
let legendView = new cdb.geo.ui.Legend.Custom(layer.model.attributes.legend);
layer.legend = legendView.render();
}
layer.legendImage = options.legendImage;
layer.attribution = options.attribution || layer.options.attribution;
layer.id = options.id;
layer.idx = options.idx;
resolve(layer);
});
});
} |
@alonsogarciapablo have you had a chance to look at this? |
@knownasilya Thanks for sharing your code! I will take a look and let you know something soon. |
So I was able to do |
We have just released some new documentation for |
@alonsogarciapablo what exactly is a sublayer? And how is it create from the UI? |
When you create a map using the editor, it will be composed of:
You will see this clearly if you inspect a viz.json file. So |
Note: the last example has a typo, hashes within a hash (should be an array somewhere).. |
There has been no activity on this issue for several months and that's why are closing it (automatically). If you think this still needs to be addressed please reopen it. The good news is that we are now working on the next version of CARTO.js, stay tuned. |
A layer with type
torque
haslayer.model.attributes.legend
, but a layer with typenamedmap
does not. Not sure if this is related to #480. I'm usingcreateLayer
and a custom build from master (last week).cc @alonsogarciapablo
The text was updated successfully, but these errors were encountered: