Angularjs NVD3 Custom X Axis

I have the following plunker where I want to put X Axis labels on the next line. I have the following configuration in my controller to set up the x axis, but it doesn't work.

xAxis: {
    axisLabel: 'X Axis',
    tickFormat: function(d){
        var words = d.split(' '),label = '';

        for (var i=0; i< words.length; i++) {
            label += words[i] + "\n"; // does not work either
            // label += "<tspan class='x'>" + words[i] + "<tspan>"; // does not work either
        }

        return label;
     }
 }

      

How to make the code such that the x-axis does not overlap the labels. I am looking for the same result as this one , but I could not figure out how to apply this logic without touching the NVD3 directive I am using. Is it possible?

+3
javascript angularjs charts d3.js nvd3.js


source to share


No one has answered this question yet

Check out similar questions:

4523
Thinking in AngularJS if I have a jQuery background?
3178
AngularJS: Service vs provider vs factory
1690
How does data binding work in AngularJS?
1195
How do I access the $ scope variable in the browser console using AngularJS?
1073
How to use $ scope. $ Watch and $ scope. $ Apply in AngularJS?
998
What is the difference between "@" and "=" in scope in AngularJS?
969
What are the nuances of the scope of prototype / prototypal inheritance in AngularJS?
912
'this' vs $ scope in AngularJS controllers
2
How to rotate by y-axis label in nvd3 chart
0
d3.js & NVD3 axisLabel with £ (pound) symbol



All Articles
Loading...
X
Show
Funny
Dev
Pics