Optimize the performance of your custom visualization components with these best practices.
Update the SDK
New API versions are released regularly. To take full advantage of the Quick BI platform, use the latest SDK versions, such as @quickbi/bi-open-sdk or @quickbi/bi-open-react-sdk.
Third-party Library CDN
When multiple custom visualization components depend on the same third-party libraries, host those libraries on a CDN to reduce component size and improve loading speed. For example, if you use ECharts to develop Chart A and Chart B.
On the custom visualization management page, modify the third-party library information for both Chart A and Chart B. Enter the ECharts CDN URL: https://g.alicdn.com/code/lib/echarts/5.4.0/echarts.min.js.

For professional mode, you must also modify the qbi.config.ts build configuration file. Add the third-party library to the externals configuration. Then, run npm run build && npm run bundle to generate and upload the development package.
export default defineConfig({
externals: {
lodash: '_',
react: 'React',
'react-dom': 'ReactDOM',
moment: 'moment',
// Set ECharts as an external dependency
echarts: 'echarts',
},
});
Use Built-in Libraries
The Quick BI custom visualization sandbox provides the following built-in libraries:
-
react - 16.12.0
-
react-dom - 16.12.0
-
lodash - 4.17.20
-
moment - 2.29.1
These libraries are exposed as global variables in the sandbox. For optimal performance, use these bundled versions instead of importing your own.
Reduce the Meta File Size
Avoid importing too many third-party libraries into meta.js. Quick BI executes meta.js for custom visualization components as soon as the host page loads, so the compiled size of meta.js must remain small.
Cache DOM Nodes
When you retrieve nodes from the DOM, cache them for reuse in later calculations or loop iterations. Caching improves application efficiency, provided you do not add or delete other nodes in the same area.
Avoid DOM Manipulation
Minimize DOM manipulation. Insertion operations such as prepend(), append(), and after() are expensive and should be used only when necessary.