Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mySymbols(){
- var symbol = d3.svg.symbol();
- var my_types = []; // our other types
- my_types.NewSymbolName = function(size){
- return 'Custom Symbol 1 Path'
- }
- var me = function(datum, index){
- var type = symbol.type(), size = symbol.size();
- if(type instanceof Function){
- type = type(datum, index);
- }
- if(size instanceof Function){
- size = size(datum, index);
- }
- // generating a built in type.
- if(d3.svg.symbolTypes.indexOf(type) !== -1) {
- return symbol(datum, index);
- }
- return my_types[type](size);
- };
- var my_size = symbol.size();
- me.size = function(size){
- if(arguments.length){
- symbol.size(size);
- return me;
- }
- return symbol.size();
- };
- var my_type = symbol.type();
- me.type = function(type){
- if(arguments.length){
- symbol.type(type);
- return me;
- }
- return symbol.type();
- };
- return me;
- };
Add Comment
Please, Sign In to add comment