{"id":25269,"date":"2024-05-30T08:53:50","date_gmt":"2024-05-30T08:53:50","guid":{"rendered":"https:\/\/www.highcharts.com\/blog\/?p=25269"},"modified":"2026-01-13T11:56:53","modified_gmt":"2026-01-13T11:56:53","slug":"real-time-data-visualization-using-highcharts","status":"publish","type":"post","link":"https:\/\/www.highcharts.com\/blog\/tutorials\/real-time-data-visualization-using-highcharts\/","title":{"rendered":"Real-time data visualization using Highcharts"},"content":{"rendered":"<p>Real-time data visualization has become a critical tool for businesses and developers. Whether it&#8217;s monitoring financial markets, tracking live sports scores, or keeping an eye on server health, the ability to visualize data as it happens can provide significant advantages.<\/p>\n<p>Highcharts JavaScript charting library excels in this area by offering various ways to implement real-time data updates, making it an ideal choice for developers seeking to build interactive and responsive applications.<\/p>\n<p>In this post we\u2019ll look at leveraging Highcharts for real-time data visualization, including some practical examples. Whether you&#8217;re a developer working with JavaScript, .NET, React or other common frameworks, we\u2019re confident you\u2019ll find the inspiration you need.<\/p>\n<p>Highcharts also integrates seamlessly with popular languages such as Python, R, PHP and Java, as well as mobile platforms like iOS and Android. Additional support for frameworks like Svelte, Angular, and Vue, makes it a versatile tool for various development environments.<\/p>\n<p>To see more demos and get an even better understanding of the opportunities Highcharts offers, please head over to the <a href=\"https:\/\/www.highcharts.com\/demo\">demo section<\/a> of our website or read up on the <a href=\"https:\/\/www.highcharts.com\/docs\/index\">technical documentation<\/a> on how to get started. Once you get the hang of it, the <a href=\"https:\/\/api.highcharts.com\/highcharts\/\">API reference<\/a> will help you customize your charts in no time.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Challenges in visualizing real-time data<\/strong><\/h2>\n<p>Visualizing real-time data involves managing latency, ensuring synchronization, and handling frequent updates. High-frequency data streams can strain both client and server resources. Bandwidth consumption and performance issues are also concerns, particularly on slower networks. Handling large data volumes requires decisions on how to display and manage older data. Maintaining a smooth user experience, even with frequent updates, and ensuring robust error handling and resilience are crucial for reliability.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Key features and benefits<\/strong><\/h2>\n<p>Highcharts efficiently manages real-time data with built-in features for data streaming and updates. It supports integration with WebSockets and server-sent events, offers options for handling large data volumes, and ensures high performance with low latency. Highcharts provides rich interactivity, cross-browser compatibility, and accessibility features, making it a versatile tool for various devices. Its well-documented API facilitates quick implementation and customization. Highcharts also ensures stability and error handling, making it a reliable choice for real-time data visualization.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Practical examples<\/strong><\/h2>\n<p>In Highcharts, there are primarily <strong>two methods for handling live data<\/strong> feeds from a server:<\/p>\n<h3><strong>Option 1: Using data module with polling<\/strong><\/h3>\n<p>The first method involves using the data module with polling. This approach is straightforward and relies primarily on configuration settings. By specifying the data source and the polling interval, Highcharts automatically retrieves and updates the chart with new data at regular intervals. This method is particularly convenient for scenarios where a simple, out-of-the-box solution is sufficient, as it requires minimal coding and setup.<\/p>\n<p>The demo below &#8220;Live data from dynamic CSV&#8221; showcases a real-time data visualization example using an area spline chart. It demonstrates how to dynamically update the chart by fetching data from a CSV file hosted at a specified URL. The example includes features like polling for updates, setting the data refresh rate, and customization options for the chart&#8217;s appearance and accessibility. The demo is interactive, allowing users to modify the data source and polling interval to see live updates in the chart.<\/p>\n<p>&nbsp;<\/p>\n<p><iframe style=\"width: 100%;\" title=\"Live Data\" src=\"https:\/\/www.highcharts.com\/samples\/embed\/highcharts\/demo\/live-data\" height=\"700\" frameborder=\"no\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\">&nbsp;<\/p>\n<p><\/iframe><\/p>\n<h3><strong>Here\u2019s how to recreate this chart<\/strong><\/h3>\n<p>For all basic instructions see <a href=\"https:\/\/www.highcharts.com\/docs\/getting-started\/installation\">Highcharts installation documentation<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>1. Load the required files<\/strong><\/p>\n<pre><code>&lt;script src=\"https:\/\/code.highcharts.com\/highcharts.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/code.highcharts.com\/modules\/data.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/code.highcharts.com\/modules\/accessibility.js\"&gt;&lt;\/script&gt;\r\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Note that this example also includes some additional scripts, namely the <\/span><a href=\"https:\/\/www.highcharts.com\/docs\/working-with-data\/data-module\"><span style=\"font-weight: 400;\">Data module (docs)<\/span><\/a><span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">and <\/span><a href=\"https:\/\/www.highcharts.com\/docs\/accessibility\/accessibility-module\"><span style=\"font-weight: 400;\">Accessibility module (docs)<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><strong>2. Create containers for the chart and other elements<\/strong><\/p>\n<pre><code>&lt;figure class=\"highcharts-figure\"&gt;\r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;p class=\"highcharts-description\"&gt;\r\n\t\tDatasets formatted in CSV or JSON can be fetched remotely using the\r\n\t\t&lt;code&gt;data&lt;\/code&gt; module. This chart shows how a chart can also be\r\n\t\tconfigured to poll against the remote source.\r\n    &lt;\/p&gt;\r\n&lt;\/figure&gt;\r\n\r\n&lt;div class=\"ld-form\"&gt;\r\n\t&lt;div class=\"ld-row\"&gt;\r\n\t\t&lt;label class=\"ld-label\"&gt;\r\n\t\t\tEnable Polling\r\n\t\t&lt;\/label&gt;\r\n\t\t&lt;input type=\"checkbox\" checked=\"checked\" id=\"enablePolling\"\/&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;div class=\"ld-row\"&gt;\r\n\t\t&lt;label class=\"ld-label\"&gt;\r\n\t\t\tPolling Time (Seconds)\r\n\t\t&lt;\/label&gt;\r\n\t\t&lt;input class=\"ld-time-input\" type=\"number\" value=\"2\" id=\"pollingTime\"\/&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;div class=\"ld-row\"&gt;\r\n\t\t&lt;label class=\"ld-label\"&gt;\r\n\t\t\tCSV URL\r\n\t\t&lt;\/label&gt;\r\n\t\t&lt;input class=\"ld-url-input\" type=\"text\" id=\"fetchURL\"\/&gt;\r\n\t&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>3. Add some CSS to control the size and style of your container and other elements<\/strong><\/p>\n<pre><code>.highcharts-figure {\r\n    min-width: 360px;\r\n    max-width: 800px;\r\n    margin: 1em auto;\r\n}\r\n\r\n.ld-form {\r\n    max-width: 800px;\r\n    margin: 1em auto;\r\n}\r\n\r\n.ld-row {\r\n    margin: 0.3em 0;\r\n}\r\n\r\n.ld-row input {\r\n    line-height: 1.5em;\r\n    padding: 0.375rem 0.75rem;\r\n    border: 1px solid rgba(128, 128, 128, 0.3);\r\n    border-radius: 0.25rem;\r\n    color: #495057;\r\n}\r\n\r\n.ld-label {\r\n    width: 200px;\r\n    display: inline-block;\r\n}\r\n\r\n.ld-url-input {\r\n    width: 400px;\r\n    max-width: calc(100% - 2rem);\r\n}\r\n\r\n.ld-time-input {\r\n    width: 40px;\r\n}\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>4. Load and initialize the chart<\/strong><\/p>\n<pre><code>const defaultData = 'https:\/\/demo-live-data.highcharts.com\/time-data.csv';\r\nconst urlInput = document.getElementById('fetchURL');\r\nconst pollingCheckbox = document.getElementById('enablePolling');\r\nconst pollingInput = document.getElementById('pollingTime');\r\n \r\nfunction createChart() {\r\n    Highcharts.chart('container', {\r\n        chart: {\r\n            type: 'areaspline'\r\n        },\r\n        title: {\r\n            text: 'Live Data'\r\n        },\r\n        accessibility: {\r\n            announceNewData: {\r\n                enabled: true,\r\n                minAnnounceInterval: 15000,\r\n                announcementFormatter: function (\r\n                    allSeries,\r\n                    newSeries,\r\n                    newPoint\r\n                ) {\r\n                    if (newPoint) {\r\n                        return 'New point added. Value: ' + newPoint.y;\r\n                    }\r\n                    return false;\r\n                }\r\n            }\r\n        },\r\n        plotOptions: {\r\n            areaspline: {\r\n                color: '#32CD32',\r\n                fillColor: {\r\n                    linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },\r\n                    stops: [\r\n                        [0, '#32CD32'],\r\n                        [1, '#32CD3200']\r\n                    ]\r\n                },\r\n                threshold: null,\r\n                marker: {\r\n                    lineWidth: 1,\r\n                    lineColor: null,\r\n                    fillColor: 'white'\r\n                }\r\n            }\r\n        },\r\n        data: {\r\n            csvURL: urlInput.value,\r\n            enablePolling: pollingCheckbox.checked === true,\r\n            dataRefreshRate: parseInt(pollingInput.value, 10)\r\n        }\r\n    });\r\n\r\n    if (pollingInput.value &lt; 1 || !pollingInput.value) {\r\n        pollingInput.value = 1;\r\n    }\r\n}\r\n\r\nurlInput.value = defaultData;\r\n\r\n\/\/ We recreate instead of using chart update to make sure the loaded CSV\r\n\/\/ and such is completely gone.\r\npollingCheckbox.onchange = urlInput.onchange =\r\n   pollingInput.onchange = createChart;\r\n\r\n\/\/ Create the chart\r\ncreateChart();\r\n<\/code><\/pre>\n<h3><\/h3>\n<h3><strong>Option 2: Using API methods<\/strong><\/h3>\n<p>The second method offers more flexibility and control, involving the manual setup of a data connection. This can be done using WebSockets, AJAX calls, or any other custom data retrieval mechanism. By leveraging Highcharts&#8217; API methods, developers can programmatically update the chart as new data becomes available. This approach is ideal for applications that require more intricate handling of data streams, custom update logic, or integration with other parts of an application. It allows for finer control over the data update process, including how and when the data is displayed, making it suitable for complex, real-time data visualization needs.<\/p>\n<p>For a full example of real-time data visualization using API methods, please visit our documentation here:\u00a0 <a href=\"https:\/\/www.highcharts.com\/docs\/working-with-data\/live-data\">https:\/\/www.highcharts.com\/docs\/working-with-data\/live-data<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Conclusion and additional resources<\/strong><\/h2>\n<p>Highcharts offers a comprehensive set of tools and features for real-time data visualization. Its flexibility and ease of integration make it a top choice for developers looking to create dynamic, interactive charts. Whether you&#8217;re building a financial dashboard, a network monitoring tool, or an IoT application, Highcharts provides the functionality and performance needed to handle real-time data efficiently.<\/p>\n<p>As you explore the possibilities of real-time data visualization with Highcharts, remember to consider the specific needs of your application and audience. By leveraging Highcharts&#8217; capabilities, you can create engaging, informative, and responsive visualizations that bring your data to life.<\/p>\n<p>To explore the capabilities of Highcharts and start creating your climate data visualizations, visit the<a href=\"https:\/\/www.highcharts.com\/demo\"> Highcharts demo section<\/a> and the <a href=\"https:\/\/www.highcharts.com\/docs\/working-with-data\/live-data\">technical documentation on using live data<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/docs\/index\">Documentation \u2013 Getting started with Highcharts<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/demo\">Demo\/example section<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/api.highcharts.com\/highcharts\/\">Highcharts API reference<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/products\/highcharts\/\">Highcharts\u00ae Core product page<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><strong>Related posts<\/strong><\/h2>\n<ul>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/blog\/post\/stock-chart-examples-using-highcharts-stock\/\">Stock chart examples using Highcharts Stock<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/blog\/post\/intraday-chart-examples-using-highcharts\/\">Intraday chart examples using Highcharts<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/blog\/tutorials\/big-data-visualization-using-highcharts\/\">Big data visualization using Highcharts<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/blog\/dashboards\/dashboard-examples-using-highcharts-dashboards\/\">Dashboard examples using Highcharts\u00ae Dashboards<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/blog\/post\/javascript-chart-examples-using-highcharts\">JavaScript chart examples using Highcharts<\/a><\/li>\n<li style=\"margin-left: 20px; margin-bottom: 20px;\"><a href=\"https:\/\/www.highcharts.com\/blog\/inspirations\/javascript-data-visualization-with-highcharts\/\">JavaScript data visualization with Highcharts<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Real-time data visualization has become a critical tool for businesses and developers. Whether it&#8217;s monitoring financial markets, tracking live sports scores, or keeping an eye on server health, the ability to visualize data as it happens can provide significant advantages. Highcharts JavaScript charting library excels in this area by offering various ways to implement real-time [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":25357,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"meta_title":"","meta_description":"","hc_selected_options":[],"footnotes":""},"categories":[210],"tags":[1094,1031,1100],"coauthors":[695],"class_list":["post-25269","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-highcharts-core","tag-javascript","tag-performance"],"_links":{"self":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts\/25269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/comments?post=25269"}],"version-history":[{"count":4,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts\/25269\/revisions"}],"predecessor-version":[{"id":26453,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts\/25269\/revisions\/26453"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/media\/25357"}],"wp:attachment":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/media?parent=25269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/categories?post=25269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/tags?post=25269"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/coauthors?post=25269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}