Skip to content

V2.0.0 - Canvas based Smartlabel

Compare
Choose a tag to compare
@priyanjitdey94 priyanjitdey94 released this 08 May 07:47
· 37 commits to master since this release
eafe44d

Canvas is used to carry out width calculations instead of div

This improvement stopped the costly reflows that were taking place while using HTML div elements. Canvas.measureText API is used to calculate the width of the text. This may lead to change in width calculations by 1-2px but it shouldn't be a problem. Developers at FusionCharts have not run into any problem due to this.

In browsers not supporting canvas, HTML div element is used as a fallback.

Improved caching mechanism

Smartlabel uses caching to store the dimensions to prevent multiple usage of the otherwise costly canvas APIs/HTML divs for same text. Minor improvements are made in caching mechanism to improve performance.

ID is not required while initialising smartlabel

To create multiple instances of smartlabel, id was provided in V1. The id was used to manage the instances within smartlabel. ID is deprecated, since the user should take care of the multiple instances.