markrcote / flot-tickrotor

Flot plugin to display angled X-axis tick labels. This repo is unmaintained in part due to flot being in a similar situation.
23 stars 39 forks source link

maxLabelHeight is not enough which is 135 angle or some angle. #21

Open devginie opened 8 years ago

devginie commented 8 years ago

maxLabelHeight is not enough which is 135 angle or some angle.

just set xaxis.rotateTicksPadding to an number in pixel.

var rotateTicks, rotateTicksRads, radsAboveHoriz, rotateTicksPadding;
...
                var opts = plot.getAxes().xaxis.options;
                if (opts.rotateTicks === undefined) {
                    return;
                }

                if (opts.rotateTicksPadding === undefined) {
                  rotateTicksPadding = 0;
                } else {
                  rotateTicksPadding = opts.rotateTicksPadding;
                }

                rotateTicks = parseInt(opts.rotateTicks, 10);
                if (rotateTicks.toString() != opts.rotateTicks || rotateTicks == 0 || rotateTicks >= 180) {
                    return;
                }
...
                  if (ticks[i].height > maxLabelHeight) {
                      maxLabelHeight = ticks[i].height + rotateTicksPadding;
                  }