Colored arrowheads

82 views
Skip to first unread message

Skoczek

unread,
Apr 21, 2012, 7:39:49 AM4/21/12
to JointJS
Hi,

Is there any possibility to change a color of arrowheads in JointJS ?
I constructing the arrow in the following way:

function graphArrow(score)
{
var color;
var size = 0.1*score;

if( score <= CriticalValue) color = '#FF2A2A';
else if( score <= WarningValue) color = '#FFE680';
else color = '#00FF00';

return {
interactive: false,
endArrow: { attrs: {size: size, fill:color, stroke: color }
},
attrs: {
'stroke-width': (15-size)/2,
'stroke-type':'solid',
fill:color,
stroke:color
}
};
};

But it doesn't work. Arrowhead is still black.
Does anyone have any ideas?

dave

unread,
Apr 21, 2012, 8:00:26 AM4/21/12
to JointJS
You're missing the 'type' option for the endArrow and also the 'size'
should not be inside the 'attrs' object but outside it instead.

This is the correct format for your case:

endArrow: { type: 'basic', size: size, attrs: { fill:color, stroke:
color } }


Cheers,
David

Skoczek

unread,
Apr 21, 2012, 11:29:20 AM4/21/12
to JointJS
Yes, it works and solves my issue.

Thank you David!
Reply all
Reply to author
Forward
0 new messages