No labels in ForceDirected unless I override 'labelType' to 'HTML'

26 views
Skip to first unread message

Paul McGuinness

unread,
May 14, 2013, 8:56:54 AM5/14/13
to javascript-information...@googlegroups.com
Hi All,

This one has been driving me mad... unless I override the 'labelType' to 'HTML' (see below), I can't see any labels in my ForceDirected tree.

I'm using the standard code, with one extra line (highlighted). I've checked the obvious by setting the body background colour to black / white in case of CSS issues, but am getting nowhere.

Firebug doesn't seem to expose much in terms of 'canvas', so I can't even see if it has 'drawn' the labels.

Any suggestions?

Cheers,

Paul

var ua = navigator.userAgent,
iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
typeOfCanvas = typeof HTMLCanvasElement,
nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
textSupport = nativeCanvasSupport && (typeof document.createElement('canvas').getContext('2d').fillText == 'function');
labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML';
labelType='HTML'; // override...
nativeTextSupport = labelType == 'Native';
useGradients = nativeCanvasSupport;
animate = !(iStuff || !nativeCanvasSupport);



Reply all
Reply to author
Forward
0 new messages