The value of a Highcharts series does not match that of a Data Source

Encountering an issue with Highcharts where the value of this.y does not reflect the data source. The discrepancy is apparent in the image below. Uncertain if this is a bug or user error.

Screenshot illustrating the problem

You can view my Demo here: https://jsfiddle.net/xzjrkf1d/

Here is the Highcharts code snippet:

Highcharts.chart('ChartNational', {
chart: {
    type: 'waterfall'
},
title: {
    text: 'Company'
},
xAxis: {
    type: 'category'
},
yAxis: {
    labels: {
        formatter: function () {
            if (FilterValueType == "Full Amount") {
                var val = nFormatter(this.value);
                return val;
            } else {
                return Highcharts.numberFormat(this.value, 0, '.', ',');
            }
        }
    },
    title: {
        text: 'Value'
    },
    min: YAxisCel
},
legend: {
    enabled: false
},
tooltip: {
    pointFormat: '<b>{point.y}</b>',
    enabled: false
},
series: [{
    upColor: Highcharts.getOptions().colors[2],
    color: Highcharts.getOptions().colors[3],
    data: resultData,
    dataLabels: {
        enabled: true,
        formatter: function () {
            debugger
            if (FilterValueType == "Full Amount") {
                var val = nFormatter(this.y);
                return val;
            } else {
                return Highcharts.numberFormat(this.y, 0, '.', ',');
            }
            //return this.y;;
            //return Highcharts.numberFormat(this.y, 0, ',');
        },
        style: {
            fontWeight: 'bold'
        }
    },
    pointPadding: 0
}]

});

Desiring consistency between this.y values and Data Source.

Answer №1

After some investigation, I have identified the root cause of the issue.

The problem arose from mistakenly setting the value of the last array item isSum to true. By correcting this and adjusting the value to false, the this.y value is now aligned with the rest of the data.

ORIGINAL

{
    "name": "Total Compare",
    "type": "FFI",
    "orderBy": 9,
    "total_main": 0,
    "total_compare": 0,
    "y": 1664.691438,
    "color": "Blue",
    "isSum": true
}

CORRECTED

{
    "name": "Total Compare",
    "type": "FFI",
    "orderBy": 9,
    "total_main": 0,
    "total_compare": 0,
    "y": 1664.691438,
    "color": "Blue",
    "isSum": false
}

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

Can the .scroll function be turned off when a user clicks on an anchor link that causes the page to scroll?

I am currently developing a timeline page and I want to implement a feature similar to the chronological list of years displayed on the right side of this webpage: As part of this feature, I have set up a click event which adds a circle border around the ...

"Moisten" a JavaScript object instance using a JSON array, similar to the way PHP does

When populating PHP objects with data, I typically use the following method: public function hydrate(array $data){ foreach($data as $key=>$value){ $method = 'set'.ucfirst($key); if(METHOD_EXISTS($this,$method)){ ...

The submit function in Jquery is not functioning properly within the success callback of an Ajax request

After successfully submitting a form in AJAX using POST, I receive a new form that needs to be automatically submitted in jQuery. However, for some reason, the .submit() function seems to be ignored and I can't figure out why. I've tried adding ...

Wishing to retrieve the Enum Value instead of the name when parsing JSON data

Here's an example of an enum that I have: public enum Category { Fruit("F"), Vegetable("V"), Meat("M"), Dairy("D"); public String code; Category(String code) { this.code = code; } @Override public Strin ...

Extracting PNG file from response (bypassing standard JSON extraction)

Despite my efforts to find a solution, I am still unable to resolve this specific issue: I have implemented an Angular request (localhost:4200) to an API on Spring (localhost:8080). The HttpService successfully handles the requests, except when it comes to ...

Interacting with JSON API data in real-time using AJAX and the power of JQuery

I'm currently working on displaying data dynamically from an API, and everything is functioning well except for the "Next" and "Previous" links. I can't seem to get them to update the value count in the search bar. My problem lies in executing my ...

`Vue Component failing to display data from Blade File`

In my project using Laravel Blade, I am currently in the process of converting some blade files to Vue components. One challenge I encountered is trying to display a dynamically created page title on the screen from the Vue component rather than the blade ...

Tips for using jQuery dropdown menus

I am currently in the process of creating a prototype for a quick dropdown menu using jQuery. However, I have reached the limits of my knowledge on jQuery and could use some assistance in solving my issue. My objective is to have a dropdown animate down w ...

Tips on automatically setting the default value in select2.js dropdown selection

I have integrated the select2.js library to create a dropdown list in my project. I am trying to set the default selected value for the dropdown based on the data obtained from my URL. However, I am unsure of how to achieve this using select.js. In the Ja ...

Angular JS sending a message to various views, including a pop-up modal

One of the services I have created is designed to manage message broadcasting to controllers that require it. The service implementation: .factory('mySharedService', function($rootScope) { var sharedService = {}; sharedService.message = &a ...

Is it possible to efficiently update the innerHTML of multiple div elements using a single function?

Upon clicking a button, I am dynamically updating the content of multiple divs using innerHTML. Currently, the button triggers a new video source to load, but I also want to change other types of content in different divs at the same time. I wonder if cha ...

Is there a way for me to update a Link To containing a parameter by using history.push with a parameter inside a table cell?

Hey there! I'm working on some code and wondering if it's doable to replace the Link To with a history.push, including the following parameter, like so: <TableCell style={{width: '10%'}}> <Link to={`/run-id/${item.run_ ...

Obtaining personalized error messages from the backend with express: A step-by-step guide

I'm currently developing a Login App and I'm looking to implement custom error messaging on the Front End. Specifically, I want to display custom error messages when attempting to register with an email that is already in use or when entering a p ...

suggesting options comparable to addthis or sharethis

Could you please check out ? There is a sharing box in the bottom right corner that resembles ShareThis. However, as far as I know, ShareThis does not have options for embedding or submitting content. Does anyone happen to know which plugin is being used ...

Interpolating backticks in Javascript allows for constructing a URL containing empty spaces

When utilizing string interpolation with backticks to construct a URL that sends data to a django endpoint, the resulting URL contains unnecessary whitespace and a new line. The problematic JavaScript code is as follows: (function (window, document, unde ...

Having difficulty attaching events to Bootstrap 3 button radios in button.js

Struggling with extracting the correct value from a segmented control created using the radio button component of button.js in Twitter Bootstrap 3. Upon binding a click event to the segmented control and running $.serialize() on its parent form, I noticed ...

qunit timer reset

I have developed a user interface for manually launching qunit tests. However, I have noticed that the qunit test timer starts when displaying the interface, rather than when starting the actual test. For example: var myFunction = function (){ test ...

Creating instances of variables from an array in Java

Here's a Python example: myList = [1, 2, 3, 4] a, b, c, d = myList print a # -> 1 print d # -> 4 Can Java achieve a similar task? Perhaps in a more efficient manner than the following: int[] myList= {1, 2, 3, 4}; int a = myList[0]; int b = my ...

Converting a deeply nested dictionary into a pandas dataframe

I've been struggling to convert a deeply nested dictionary into a pandas DataFrame. I attempted to use a recursive function, similar to the one below, but my issue is that I lose track of the previous key while iterating over a KEY. I also experimen ...

Checking CORS permissions with a pre-flight OPTIONS request

During development, I implement a middleware called cors using the following syntax: app.use(cors({origin: 'http://localhost:8100'})); However, I have noticed that for every route request, two requests are being made as shown in the image below ...