mbhall88 / masters_project

0 stars 0 forks source link

Legend on donut chart - species name too long #3

Closed mbhall88 closed 7 years ago

mbhall88 commented 7 years ago

On the donut chart within the analysis route, the species name does not truncate like the rest of the areas of the chart.
Maybe look at changing the layout/design of this legend.

mbhall88 commented 7 years ago

The issue here was that I didn't realise the variable d that was being handled in the text function for the legend was the species name and that I didn't need to try and extract it with d.data.species as I was doing. Here is the fix:

.text(function(d){
    // parse the species label if it is longer than 30 characters
    if(d.length > 30){
        d = d.substr(0, 27) + "...";
    }
    return d;
});