Skip to main content
Version: v26

Best Practices

This article describes the best practices for integrating the library into your website or mobile application.

Separate Additional Features from the Library

The library is used to display charts, prices, and technical analysis tools. You can find a list of included features in the Key features article.

If you need additional features like chats, special symbol lists, hot deals, advertisements, etc., you should implement them outside of the library. You can still integrate them to the library using the API.

Choose an Appropriate Data Connection Approach

Pay attention to the differences between implementing a datafeed in JavaScript via the Datafeed API and using the predefined implementation with a server that responds in the UDF format. Refer to the following topic for more information: Connecting Data. If you need really fast data updates or data streaming, you can use WebSockets.

Provide Correct Amount of Data

Most issues with the library appear because data is provided incorrectly. Consider the following topic for more information: Datafeed API. Note that when you specify Marks, you should provide data that matches the requested range.

Consider the Chart's Size

The smallest meaningful size that the library supports is 500×500 px. Avoid making charts smaller because they look messy. We recommend that you hide some UI elements if you need charts smaller than those mentioned above. Refer to the Widget Constructor topic for more information on how to specify the chart's size.

Localize Your Chart

The library supports a variety of languages. Use the one that fits your users' needs.

Enable Debug Logs during Development

Set the debug property to true in Widget Constructor to enable logs. We recommend that you enable the debug mode during the development and disable this mode in the production to speed up the code execution.

If You Face Issues

First, you should update your library's build to the latest version. If the issues still appear, the steps below can help you to debug them:

  1. Set the debug property to true in Widget Constructor to enable logs.
  2. Check that you provide data correctly. Pay special attention to symbology as it is the most common place to make a mistake.
  3. Review the output of our demo data service and compare this output to yours to ensure your backend behaves correctly.

You can also search your issue among the GitHub Issues 🔐 (restricted access) and the Discord discussions.

Avoid Using Undocumented Features

All features that are not mentioned in the documentation are subject to change without any warnings and backward compatibility. Also, altering the source code is strictly prohibited by the legal agreement you signed.

Avoid Using Demo Datafeed on a Production Website

The demo datafeed is not designed for real usage. It might be unstable and cannot withstand high loads.

Speed Up Load Times

We recommend that you use the following protocols to speed up load times:

  • HTTP/2 or higher
  • TLS 1.3 or higher

Also, you can compress the library's HTML files using Gzip or Brotli when sending them to a client.

Set Minimum Expiration Time for charting_library.js

All files in the library contain hash in their names except charting_library.js that you add to your HTML files. When you update the library to a newer version, all file names are changed as well. If a browser loads charting_library.js from the cache, then all the links in this file are broken. The expiration time for this file should be set to the minimum to prevent its caching.