d3.etiquetas js axis-el color no cambia
Estoy creando mi eje con el siguiente texto, sin embargo, el color de las etiquetas no está cambiando correctamente; el color del texto permanece negro. ¿Alguien sabe por qué?
// create Axis
svg.selectAll(".axis")
.data(d3.range(angle.domain()[1]))
.enter().append("g")
.attr("class", "axis")
.attr("transform", function(d) { return "rotate(" + angle(d) * 180 / Math.PI + ")"; })
.call(d3.svg.axis()
.scale(radius.copy().range([-5, -outerRadius]))
.ticks(5)
.orient("left"))
.append("text")
.attr("y",
function (d) {
if (window.innerWidth < 455){
return -(window.innerHeight * .33);
}
else{
return -(window.innerHeight * .33);
}
})
.attr("dy", ".71em")
.attr("text-anchor", "middle")
.text(function(d, i) { return capitalMeta[i]; })
.attr("style","font-size:12px;")
.style("color","#DE3378"); <--------------- adding color attribute here...
EDITAR - tratando de colorear diferentes etiquetas de eje diferentes colores con el siguiente código, sin embargo esto no está funcionando correctamente...
.style(function() {
for (var i = 0; i < unhealthyArray.length; i++) {
if ($.inArray(unhealthyArray[i], capitalMeta) != -1)
return "fill","red";
else
return "fill","black";
}
});
23
1 answers
Necesita usar el atributo stroke
(para el contorno) o fill
(para el color de relleno). Vea por ejemplo este tutorial.
39
Author: Lars Kotthoff,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-21 14:42:42
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-21 14:42:42