Skip to content

Instantly share code, notes, and snippets.

@carlosrusso
Created July 4, 2017 17:24
Show Gist options
  • Save carlosrusso/31007ec7bc2d20fdd4391869d299d6fe to your computer and use it in GitHub Desktop.
Save carlosrusso/31007ec7bc2d20fdd4391869d299d6fe to your computer and use it in GitHub Desktop.
customMarker
define([
"require",
"cdf/AddIn",
"cdf/Dashboard.Clean"
], function(require, AddIn, Dashboard) {
"use strict";
var custom = {
name: "customMarker",
label: "A custom Marker addIn",
defaults: {
getUrl: function(tgt, st, opt) {
var isUpOrDown = st.data[3];
var baseUrl = "/pentaho/plugin/pentaho-cdf-dd/api/resources/system/workwisePentaho/static/custom/img/"
switch(isUpOrDown){
case "up": return baseUrl + "up.svg",
case "down": return baseUrl + "down.svg",
default: return baseUrl + "error.svg",
}
}
},
implementation: function(tgt, st, opt) {
var style = {
"icon-url": opt.getUrl(tgt, st, opt)
};
if(st.width != null) style.width = st.width;
if(st.height != null) style.height = st.height;
return style;
}
};
Dashboard.registerGlobalAddIn("NewMapComponent", "MarkerImage", new AddIn(custom));
return custom;
});
function(){
this.markerImageGetter = "customMarker";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment