'NVD3 D3.JS Issue. control Labels stop working after this: .controlLabels({"grouped":"Agrupadas","stacked":"Apiladas"});
I have been using this function to translate the control labels.
.controlLabels({"grouped":"Agrupadas","stacked":"Apiladas"});
It works, the labels change just fine, but, they stop working as well, that's the issue.
What could be the problem?
This is my graph http://codepen.io/neonpulp/pen/zBRdYz and below is the code too.
<script>
var long_short_data_plancalair = [
{
key: '1er trimestre',
color: "#438da7",
values: [
{
"label" : "Mapas de Calor Elaborados" ,
"value" : 15
}
]
},
{
key: '2do trimestre',
color: "#d86d18",
values: [
{
"label" : "Mapas de Calor Elaborados" ,
"value" : 50
}
]
}
];
var chart;
nv.addGraph(function() {
chart = nv.models.multiBarHorizontalChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.duration(250)
.margin({left: 295})
.stacked(true)
.controlLabels({"grouped":"Agrupadas","stacked":"Apiladas"});
chart.yAxis.tickFormat(d3.format(',.2f'));
chart.yAxis.tickFormat(function(d) { return d3.format(',f')(d)+ '%' });
chart.yAxis.axisLabel('');
chart.xAxis.axisLabel('').axisLabelDistance(20);
d3.select('#chart-plancalair svg')
.datum(long_short_data_plancalair)
.call(chart);
nv.utils.windowResize(chart.update);
chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });
chart.state.dispatch.on('change', function(state){
nv.log('state', JSON.stringify(state));
});
return chart;
});
</script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
