Ich versuche, das folgende mit Raphael zu tun:Maßstab SVG-Bild zu passen Eltern und Änderung Spur Farbe an den verschiedenen Instanzen
1) ein SVG-Maßstab einen Elternteil div zu passen (in diesem Fall #bg
)
2) ändern sie die Farbe des Sensors bei verschiedenen Instanzen ... das ist, was ich bisher gemacht habe, aber es funktioniert nicht:
archtype.customAttributes.counter = function (counter, top) {
var motto = '';
switch(true) {
case(counter<=(top/10)):
motto = 'Very Poor !'
colour = '#BD2727'; //pretty sure this is wrong
break;
case(counter<=(5.61*top/10)):
motto = 'Poor'
colour = '#F79A38'; //pretty sure this is wrong
break;
case(counter<=(7.21*top/10)):
motto = 'Fair'
colour = '#FBDE07'; //pretty sure this is wrong
break;
case(counter<=(8.81*top/10)):
motto = 'Good'
colour = '#90C342'; //pretty sure this is wrong
break;
case(counter<=(9.61*top/10)):
motto = 'Excellent'
colour = '#1F9C4C'; //pretty sure this is wrong
break;
}
return {
counter: [counter,top],
text: Math.floor(counter) + '\n' + motto
}
}
Fiddle hier: http://jsfiddle.net/mwvLc0kb/4/