canvas-gauges
canvas-gauges copied to clipboard
Avoid tick labels overlapping
Hello, when setting major ticks dynamically it may happen that labels overlaps. Is there any option or strategy to avoid this overlapping? Thanks
I've also ran into this issue, did you find a solution?
您的邮件我已收到,谢谢!
@andreapicaro
I was able to fix the labels overlapping by using the events that the library emits. I had to copy over a several methods from the library to modify the drawRadialNumbers method. Note I only implemented as much as I needed for my use case which was labels at the top of the gauge. (this does not handle labels overlapping vertically). I wouldn't consider this code a candidate for a PR since there are definitely additional cases to handle.
You can see the code here:
https://gist.github.com/jasekiw/d7fbe6d8637404355301901a1eee6e8d
example usage:
const gauge = new RadialGauge(gaugeOptions);
applyRadialNumbersOverride(gauge); // from the window object after linking in the script
gauge.draw();