labelPadding: Number/Object

This property allows you to set the padding for crosshair label in axisY.

Default: 0
Example: 2, 4,…
  1. var chart = new CanvasJS.Chart("container", {
  2. .
  3. .
  4. axisY: {
  5. crosshair: {
  6. enabled: true,
  7. labelPadding: 2,
  8. .
  9. .
  10. }
  11. },
  12. .
  13. .
  14. });
  15. chart.render();

labelPadding can also be an object containing top, right, bottom and left properties for different padding along top, right, bottom and left sides, respectively.

  1. var chart = new CanvasJS.Chart("container", {
  2. .
  3. .
  4. axisY: {
  5. crosshair: {
  6. labelPadding: {
  7. top: 1,
  8. right: 1,
  9. bottom: 2,
  10. left: 2
  11. }
  12. }
  13. },
  14. .
  15. .
  16. });
  17. chart.render();

Try Editing The Code


If you have any questions, please feel free to ask in our forums.Ask Question