Charts

How to Render 100,000+ Data Points in JavaScript Charts Without Slowing Down

When you try to render large datasets in JavaScript charts, you usually end up with slower, cluttered, and harder-to-interpret charts. In this case, choosing the fastest library is not the solution, because the problem rarely lies with the library itself.

Imagine opening a sales dashboard to check last weekend’s orders. It takes forever to load, and when you change the date range, the chart freezes. The problem isn’t the dashboard itself. 

It could be because you are asking the browser to process too much data.

A chart that performs well with a few hundred data points may not perform as well with high volumes of data. Often, you will not need to change libraries or lose key data. Instead, you need to change how you structure the data. 

Likewise, there are several things to consider when trying to display high volumes of data using JavaScript charts. Below are 7 tips to help make your charts perform better.

Why are JavaScript Charts Slow With High Volumes of Data?

 

Several processes happen when you try to display high volumes of data. The browser has to process each record, calculate positions, build graphics, draw labels, and manage interactions.

Creating thousands of graphics can cause performance issues due to the overhead of working with the DOM. This can turn into an SVG-based visuals problem. Processing large volumes of data can also block the browser’s main thread, causing lag in interaction.

Also, when you render large datasets in JavaScript charts, screen size can play a big role. If you are trying to show 100,000 values in a chart that is only 600px wide, you will end up with unnecessary clutter. Often you will not need to show every single piece of raw data to understand the trend.

7 Tips To Display High Volumes of Data Using JavaScript Charts

If your chart fails to get the message across, displaying more data won’t make it any better.

As datasets grow, keeping things clear becomes just as important as showing the numbers themselves. No matter how much data you’re working with, readability should never take a back seat. 

A well-built JavaScript chart can easily handle the challenge of rendering 100,000 data points in JavaScript without slowing things down. Here are seven proven and practical ways to make that happen:

1. Data Aggregation and Decimation

Deciding what data you need to show fixes half of the problem.

Data aggregation allows you to group multiple data points together by creating summary values. This is useful if you want to show trends over hours, days, or months.

On the flip side, data decimation means you reduce the number of data points you display but still keep key features. Min-Max decimation will keep local minima and maxima. Largest Triangle Three Buckets (LTTB) keeps the overall shape of the trend using triangle-area calculations.

These are both examples of data downsampling. Aggregation will give you summary values, whereas decimation will pick out key values.

Let’s understand this with an example: an IoT dashboard could use data aggregation to create hourly averages and Min-Max decimation to keep key variations.

A simplified Min-Max implementation looks like this:

function minMaxDecimate(data, bucketSize) {
  const result = [];

  for (let i = 0; i < data.length; i += bucketSize) {
    const bucket = data.slice(i, i + bucketSize);
    if (!bucket.length) continue;

    let min = bucket[0];
    let max = bucket[0];

    for (const point of bucket) {
      if (point.y < min.y) min = point;
      if (point.y > max.y) max = point;
    }

    const selected = min === max ? [min] : [min, max];
    selected.sort((a, b) => a.x - b.x);
    result.push(...selected);
  }

  return result;
}

const visibleData = minMaxDecimate(sensorReadings, 100);

In this example, the input is assumed to be sorted, with numeric x and y values. A production implementation should also account for viewport width, missing values, and bucket boundaries.

2. Correct Rendering Technique

This technique supports improved chart performance when dealing with large volumes of data in JavaScript charts. The three most popular techniques are SVG, Canvas, and WebGL.

Rendering methodHow it worksSuitable for
SVGUses individual DOM-based elementsInteractive charts with individually addressable elements
CanvasDraws graphics as pixelsDense visualizations with many graphical elements
WebGLUses GPU-accelerated graphicsGraphics-intensive visualization workloads

SVG is great for individual, interactive elements, but with many elements, it can impact performance due to DOM overhead.

If you have high-density visuals, Canvas might be a better choice because it avoids creating extra DOM elements. If your application has heavy graphics needs, consider WebGL.

There isn’t a single fastest solution. You will have to consider what type of chart you’re using, browser, device, and any interactivity needs.

For more insights, read our article, Canvas vs. SVG: Which Is Best for JavaScript Charts?

3. Reduce extra animations and markers

Markers, shadows, animations, and labels can be useful, but these also add overhead.

If you have a large amount of data in your line chart, adding markers to every data point can slow down the visualization. Repeating animations can also cause overhead.

Try removing any extra animations, reducing markers, and reducing the number of labels. However, keep useful tooltips and interactivity so users can still interact with individual data points.

4. Lazy load data

Users are unlikely to want to look at all the data at once. Instead, you can display a summary initially and load additional data as users zoom, pan, or change the date range.

This is commonly known as lazy loading.

For example, in an operations dashboard, you could show an aggregated view of the data over the last 30 days. When a user clicks on a specific day, we can request a more detailed version of the data.

Using range queries and aggregating data on the server can also reduce the data sent over the network and reduce client-side processing. This can help when trying to render large amounts of data in your JavaScript charts.

5. Reduce extra processing

Sometimes chart rendering slows down before it even starts. This can happen with repeated parsing, extra fields, unsorted data, and expensive processing.

  • Try sorting your data by x-axis value.
  • Remove any extra fields.
  • Have consistent data structures and indexes.
  • Avoid repeated processing.
  • Prepare your data in the correct format for your chart.

If you are dealing with a lot of numerical data, using typed arrays like Float32Array and Float64Array can be a good way to store your data in an efficient and predictable way. However, JavaScript chart rendering speed depends on how your charting library works.

6. Use Web Workers

Generally, your JavaScript application will run on the main thread of the browser. If this thread is busy parsing or processing a large data set, this can cause your UI to freeze, tooltips to lag, and interactions to be unresponsive.

Web Workers can handle expensive preprocessing like aggregation, filtering, and decimation.

Data can be sent to workers either by using structured cloning or transferable objects. Transferable ArrayBuffers can be useful when working with large numerical data.

Canvas can also be used with OffscreenCanvas to render large datasets in JavaScript charts. However, this can vary between browsers and chart libraries.

Web Workers will not always help your charts. They are best used when processing data is causing you issues with interacting with your UI.

7. Optimize live data

When using live dashboards, you will have an ever-increasing amount of incoming data.

If you refresh your whole chart whenever a new data point comes through, you will end up with unnecessary re-renders. Try batching the data and refreshing at reasonable times.

Useful tips for JavaScript chart performance optimization:

  • Batch data.
  • Use incremental rendering/updating.
  • Use a running time window to avoid old data points.
  • Don’t re-create your whole chart configuration.
  • Monitor how much data is coming in.

This makes more sense in streaming applications. If you receive data faster than you can process it, you could start to build a backlog. Using backpressure can help by limiting/batching/prioritising data.

For example, in an operations dashboard, you could batch your incoming data from sensors and refresh your chart once a second.

Which JavaScript Chart Optimization should I use?

Depending on your performance issue, you can use different optimizations. Below is a basic table to help you decide.

Performance challengeRecommended techniqueMain benefit
Large historical time-series dataAggregation and binningSummarizes data over selected periods
Data with important peaks and troughsMin-Max decimationRetains significant variations
Large datasets with zoom and filtersLazy loadingReduces unnecessary data transfers
Too many graphical elementsReduce markers and animationsLowers rendering overhead
Heavy data transformationsWeb WorkersMoves processing off the main thread
Frequently changing recordsBatched or incremental updatesAvoids unnecessary full redraws

Identifying the issue will help you choose the right large data visualization for your needs. Your issue may be related to rendering, data transfer, or processing.

How FusionCharts & FusionTime help with large data sets?

FusionCharts lets you skip data in supported line, area, and column charts. PlotBinSize can be used to control how many points are plotted on your chart. LabelBinSize can be used to control how many labels are shown. These options help you to reduce visual clutter when you have more data points than can fit on your chart.

Next, FusionTime can automatically aggregate your time series data. It will group your data into bins based on how much space you have on your chart. It will then apply an aggregation function. Developers can choose the function (Sum, Average, Min, Max, First, Last) based on what they need.

On top of this, FusionTime also has real-time functionality via feedData. This allows new data to be added without re-creating your whole chart configuration.

This helps with different requirements. FusionCharts lets you skip data; FusionTime lets you aggregate historical time series data and real-time data.

You can also check out FusionCharts line, area, and column chart documentation, FusionTime aggregation documentation, and real-time documentation to learn more.

To explore these chart types and learn how to handle larger datasets more efficiently, refer to the FusionCharts chart documentation, FusionTime aggregation guide, and real-time chart documentation.

FAQs

1. How many data points can my JavaScript chart handle?

There is no set limit. It will depend on your charting library, chart type, rendering method, browser, device, and number of data series. A line chart with 100,000 data points may not work the same as a scatter chart.

2. How do I render 100,000 data points in JavaScript?

Prepare and sort your data. Use aggregation/decimation. Remove any unnecessary visuals. Load detailed data as required. Consider using Web Workers if you have expensive pre-processing. Test with realistic data.

3. What is better for large data sets in JavaScript charts? Canvas or SVG?

Canvas can help reduce DOM overhead when using lots of data. However, SVG can be useful if you want to keep individual elements interactive. Which is best will depend on your chart type, data density, and requirements.

4. What is the difference between data aggregation & data decimation?

Aggregation groups several data points together to form summary values. Decimation picks representative points from your data.

Final Thoughts

When it comes to large datasets, optimizing JavaScript charts is a key move in the entire game. To render large datasets in JavaScript charts, you must understand that data preparation, downsampling, rendering techniques, browser processing, and update strategies all influence performance. By identifying the bottleneck and applying the right optimization methods, you can build responsive visualizations without losing the information that matters.

Explore FusionCharts to see how its charting and time-series capabilities can support data-heavy applications.

Shamal Jayawardhana

Shamal Jayawardhana is a seasoned web development expert and technical content strategist with a proven track record of helping developers and digital creators thrive. With over five years of hands-on experience, he has worked with leading SaaS brands to produce high-impact tutorials, WordPress guides, and developer-focused resources.

Recent Posts

Meet the New FusionDev AI: From Prompt to Interactive Chart

Building a useful data visualization usually involves several steps:  Preparing the data Choosing the right…

2 days ago

6 Brilliant Data Visualizations That Changed the World

What would be your reaction if you got to know that a single piece of…

3 weeks ago

Are Dashboards Dying? How AI Is Changing the Way We Explore Business Data

Are dashboards dying because of AI? If yes, what is the future of dashboards? The…

1 month ago

FusionCharts 4.2.3 Released: Security Update and Fixes for Legends and Gantt Charts

FusionCharts 4.2.3 is now available with an important security dependency update and fixes for legend…

2 months ago

FusionCharts SDK Updates: Angular, Svelte, React Native, and Flutter

We released updated FusionCharts SDKs for Angular, Svelte, React Native, and Flutter to support newer…

2 months ago

React Gantt Chart Tutorial: Build an Interactive Project Timeline

Quick answer: Creating an interactive React Gantt chart is simple. First, you need to install…

2 months ago