How to deal with overlapping X-axis labels in DOJO

2019-08-02 06:13发布

问题:

I have recently starting using the dojo library, and I am currently having some formatting problems with my x-axis labels. A few of the labels have longer names, and thus there is some overlap going on. Is there some way to have the labels automatically space themselves, or for longer labels to appear below the others so that they do not overlap the other labels?

I have tried using the rotation property, bu I was not satisfied with the result. While it did prevent overlapping, it also significantly reduced the area taken up by the actual chart.

回答1:

You can also rotate the labels but using the "rotation" attribute.

e.g.

YourChartDefinition.addAxis("x", 
                            {vertical   : false,
                             minorTicks : true,
                             includeZero: false,
                             font: "normal normal bold 8pt Arial",
                             rotation: -30,
                             labels: labels_for_axis
                            }      
                           );


回答2:

The label shortening rules can be specified by parameters as follows: http://dojotoolkit.org/reference-guide/dojox/charting.html#axis-label-shortening