var infoTemplate = new InfoTemplat(); infoTemplate.setTitle("<b>Cable: ${NAME}</b>"); infoTemplate.setContent("Capacity: ${CAPACITY_G:formatCapacity}"); function formatCapacity(value){ console.log("LALALALALAA"); var cap = ""; //1Tb = 1024Gb if (value >= 1024){ cap = value/1024 + "Tbps"; } else { cap = value + "Mbps"; } console.log("LALALALALALALA"); return cap; }
Solved! Go to Solution.
Are you using 3.7? graphic.attr() was introduced at 3.7 (we'll update the docs to say this).
Attr is also used to add attributes to a graphic's DOM node, it doesn't affect graphic.attributes (which I admit is confusing). If you want to add to or update a graphic.attributes, modify that object directly.
Do you know of an example of how to add a real attribute to a graphic? and I'll second the original poster here, graphic.attr is very confusing. What exactly is the point of adding an attribute to a graphic's DOM node?