Interactive Highcharts tooltip experiencing intermittent glitches during dragging

I am working with two sets of data in a line chart using Highcharts. I am trying to customize the tooltip formatter, but whenever I drag a point, the tooltip starts glitching and flickering on and off repeatedly.

For reference, here is the JSFiddle link: http://jsfiddle.net/utnz2b9e/39/

The issue I am encountering is most noticeable when dragging a blue point on the right side of the chart. During dragging, the crosshair keeps switching back and forth between that point and the x-value of the last non-null data point of the other series. Moreover, the tooltip flickers, making it difficult to view.

Javascript -

var planChart;
var startDates = ["Fri, 11/6/15", "Sat, 11/7/15", "Sun, 11/8/15", "Mon, 11/9/15", "Tue, 11/10/15", "Wed, 11/11/15", "Thu, 11/12/15", "Fri, 11/13/15", "Sat, 11/14/15", "Sun, 11/15/15", "Mon, 11/16/15", "Tue, 11/17/15", "Wed, 11/18/15", "Thu, 11/19/15", "Fri, 11/20/15"];

 $(function () {
    planChart = {
        chart: {
            renderTo: 'container',
            animation: false
        },
        title: {
            text: ''
        },
        xAxis: {
            categories: startDates,
            crosshair: true,
        },
        yAxis: [{ // Primary yAxis
            labels: {
                style: {
                    color: '#20709e'
                },
                formatter:function() {
                    return Highcharts.numberFormat(this.value, 0, '', ',');
                }
            },
            title: {
                text: 'Data',
                margin: 30,
                style: {
                    color: '#20709e'
                }
            }
        }, { // Secondary yAxis
            gridLineWidth: 0,
            labels: {
                style: {
                    color: '#B9B9B9'
                },
                formatter:function() {
                    return Highcharts.numberFormat(this.value, 0, '', ',');
                }
            },
            title: {
                text: '',
            },
            opposite: true
        }],

        plotOptions: {
            series: {
                connectNulls: true,
                stickyTracking: false,
                marker: {
                    enabled: true,
                    symbol: 'circle'
                }
            },
            line: {
                cursor: 'ns-resize'
            }
        },

        tooltip: {
            shared: true,
            formatter: function () {
                var tooltipString = this.x + '<br/>';
                this.points.forEach(function(point) {
                    if (point.series.index == 0) {
                        var y = Math.round(point.y);
                        var roundingFactor = Math.min(100, Math.pow(10, y.toString().length - 2)); 
                        tooltipString += '<span style="color:' + point.color + '">\u25CF</span> ' + '<b> ' + Math.ceil(point.y / roundingFactor) * roundingFactor + '</b><br/>';
                    } else if (point.series.index == 1) {
                        var y = Math.round(point.y);
                        var roundingFactor = Math.min(100, Math.pow(10, y.toString().length - 2)); 
                        tooltipString += '<span style="color:' + point.color + '">\u25CF</span> ' + '<b> ' + Math.ceil(point.y / roundingFactor) * roundingFactor + '</b><br/>';
                    }
                })
                return tooltipString;
            }
        },

        credits: {
            enabled: false
        },

        series: [{
            name: '1',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, null, 18.3, 13.9, 9.6, 7.0, 7.0, 7.0],
            draggableY: true,
            yAxis: 0,
           dragMinY: 0,
            style: {
                color: '#20709e'
            }
        }, {
            name: '2',
            data: [null, null, 20, 30, 40, 40, 30, 34, 43, null, null, null, null, null, null],
            draggableY: true,
            yAxis: 0,
           dragMinY: 0,
            style: {
                color: '#20709e'
            }
        }]
    }
    $('.actualPlansPlot').highcharts(planChart);
     });
}

Answer №1

To enhance the user experience, consider including animation: false in the tooltip { } properties of your chart.

For more information, refer to the API: http://api.highcharts.com/highcharts/tooltip.animation

This adjustment will eliminate the animation that occurs each time the tooltip position changes, resulting in a smoother transition when adjusting data points.

Additionally, to avoid flickering caused by inconsistent number formatting, ensure all data points have a uniform number formatting applied.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discovering the nearest sibling using jQuery

My HTML code snippet is as follows: $(".remove-post").click((event) => { $(event.target).fadeOut(); } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="side-bar"> <b ...

What is the best way to utilize a single component for validating two other components?

I am encountering an issue with my components setup. I have three components in total: GalleryAddComponent, which is used to add a new element, GalleryItemComponent, used to edit an element, and FieldsComponent, the form component utilized by both GalleryA ...

Google App Script - Mapping Error - TypeError: Property 'map' is not defined for this object

Thanks to the amazing insight from the community, I recently discovered this helpful tip on BatchUpdating background colors of a specific google sheet. Excited to apply this to my own sheet, I encountered an error saying: TypeError: Cannot read property & ...

The res.send() function is being executed prior to the async function being called in express.js

My current project involves creating an API that returns epoch time. I am using an express.js server for this, but the issue arises when the res.send() function is called before the getTimeStamp() function finishes executing. I tried looking up a solution ...

Managing AJAX Errors in PHPAJAX error handling tips for developers

My current code is only set up to display a general error message when an error occurs during execution. I want to improve it by returning specific error messages for different scenarios. However, I have not been able to find satisfactory solutions in my s ...

Click to refresh React list

Why is the display of the map function only updating on input change? Can someone provide an explanation? Even though I am using useEffect to refresh the page on stack change, it is not working. Only input field change is updating the display. import Reac ...

retrieve the path of any module within an npm monorepo

I am working on a project using an NPM monorepo structure which utilizes ECMAScript Modules (ESM): <root> |_package.json |_node_modules/ | |_luxon (1.28.0) |_packages/ |_pack1 | |_node_modules/ | | |_luxon (3.0.1) | |_main.js |_pack2 |_ ...

Tips for incorporating animation when opening a Jquery SimpleModal

The SimpleModal website features an animation-enabled example with the following sequence: 1. Display modal only 2. Fade in the overlay The code snippet for this animation is as follows: $("#the-div").modal({ onOpen: function (dialog) { dialog.overl ...

Translate data from two "contact form 7" date fields into JavaScript/jQuery to display the date range between them

NEW UPDATE: I was able to get it working, but the code is a bit messy. If anyone can help me clean it up, I would greatly appreciate it. <div class="column one-fourth" id="date-start">[date* date-start date-format:dd/mm/yy min:today+1days placeholde ...

Challenges encountered with the "load" event handler when creating a Firefox Extension

I am currently troubleshooting a user interaction issue with my Firefox extension. The tasks that my extension needs to complete include: Checking certain structures on the currently viewed browser tab Making backend server calls Opening dialogs Redirect ...

Retrieving sections from dynamic imports via a CDN link just like any other resources

I currently have a CDN set up to point to my base domain with a 1:1 mapping. I am in the process of building my bundle on the server and I want to load it using the CDN URL. After running npm run build, I am aiming for the following structure: public/ c ...

Various gulp origins and destinations

I am attempting to create the following directory structure -- src |__ app |__ x.ts |__ test |__ y.ts -- build |__ app |__ js |__ test |__ js My goal is to have my generated js files inside buil ...

Unlocking the Power of Dynamic Title Text in Your Content

Recently, I came across a tooltip code on Stack Overflow which I have been using. The issue I am facing is that the text in the title section is hardcoded and I need to customize it for different labels. How can I modify the code to make it flexible enough ...

Increment your ids automatically for bootstrap collapse components

To utilize Bootstrap's Collapse components effectively, it is necessary to have sections (or cards) with unique IDs assigned to allow for independent collapsing and expanding. My challenge lies in creating multiple sections, each representing a data p ...

What is the best way to compare two arrays that have elements of different data types?

Can someone help me compare two arrays in TypeScript to see if they are identical? I'm having trouble with the current code. Here's what I have: let props:(string|boolean)[]=['abc','def',true,false,'xyz'] let propsCo ...

Sending an image from a NodeJS socket server to another server: The ultimate guide

Hello there, I'm currently working on a new project and I could really use your input on a challenge I'm dealing with. Here's the situation: I have a web server running a socket.io module. The server is listening on port 3012 and streaming ...

What is the typical approach of JavaScript frameworks towards the 304 not-modified response?

Wondering about the inner workings of Jquery and web development in general. When a JavaScript file is requested and the server sends a 304 not-modified response, how does a framework handle it: Does it load the JS file from cache and run it? Or does it ...

Transferring information from the service layer to the controller

My goal is to transfer data from a service to a controller using AngularJS. Below is the code I am using: .controller('lista',function($scope,cetrams){ $scope.hola="This is it"; var test; var testfn = function(){ test = &apo ...

Universal - Permissible data types for function and constructor arguments

In many statically typed languages, it is common to specify a single type for a function or constructor parameter. For example: function greet(name: string) { ... } greet("Alice") // works greet(42) // error TypeScript is an extension of JavaScri ...

Modify the values of several dropdown menus (5 in total) at once using jQuery. The values will be dynamically retrieved from a JSON file

https://i.sstatic.net/9vjlz.png Dropdown values for the first dropdown are 1, 2, 3, 4, 5. Dropdown values for the second dropdown are 25, 26, 27, 28, 29. Dropdown values for the third dropdown are 35, 36, 37, 38, 39. The goal is to have each dropdown load ...