The Google Charts Pie chart is shown as displaying "Other" at 100% instead of specific data

I've encountered an issue while using the Google Charts API to create a dynamic pie chart. Initially, everything was working smoothly as the chart displayed each segment accurately. However, upon adding more data, the pie chart started showing only one value - 'Other'.

Here is the JSON response from the server:

{
    "cols" : [{
            "id" : "",
            "label" : "Team",
            "type" : "string"
        }, {
            "id" : "",
            "label" : "Steps",
            "type" : "number"
        }
    ],
    "rows" : [
        {"c": [{"v": "Draper", "f": null}, {"v": "626528","f": null}]},
        {"c": [{"v": "Sterling", "f": null},{"v": "539165", "f": null}]},
        {"c": [{"v": "Pryce", "f": null}, {"v": "557399", "f": null}]},
        {"c": [{"v": "London", "f": null}, {"v": "807470", "f": null}]},
        {"c": [{"v": "Lynx Local", "f": null}, {"v": "428814", "f": null}]},
        {"c": [{"v": "Havas Health Software", "f": null}, {"v": "375235", "f": null}]}
    ]
}

This is the JavaScript code used to load the chart:


var jsonData = $.ajax({
    url: "/ChartData/OverallSteps",
    async: false
}).responseText;

var pieData = new google.visualization.DataTable(jsonData);

var pieOptions = {
    width: 600, 
    height: 320, 
    'legend': { position: 'right',alignment:'center' },
    is3D: true,
    sliceVisibilityThreshold: 1/10000, 
    chartArea: {left:0,top:0}
};

var pieChart = new google.visualization.PieChart(document.getElementById('teamPieChart'));
pieChart.draw(pieData, pieOptions);

Despite attempting to adjust the sliceVisibilityThreshold, I still couldn't resolve the issue. With only 6 series in total, the problem persists. Can anyone identify what might be causing this?

Answer №1

The issue lies in inputting your numbers as strings, which is not accepted:

"value" : "626528"

It should be entered as:

"value" : 626528

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

Is the "add" feature malfunctioning?

My code is experiencing an issue where the URL and ID are not being passed correctly from one function to another. When I click on a link that contains the add() function, it fails to capture the URL and ID. <a href="#" style="color:#FFF;" onclick="add ...

Replacing Elements in an Array

Currently, I am working on a JSON/HTML generator project aimed at displaying JSON data along with the associated HTML elements for users once they input the required data into the input fields. Despite identifying the issue, I am struggling to come up with ...

Expand or collapse Angular Material Accordion depending on selected Radio button choice

Is it possible to use a mat-accordion with radio buttons where each panel expands only when its corresponding radio button is selected? I have the radio buttons functioning correctly, but the panels are expanding and collapsing with every click rather than ...

Encountering a parsing issue: an unexpected token was found, expecting "," instead

I'm encountering a Parsing error that states: Unexpected token, expected ",". I've been unable to pinpoint where the missing "," is located. Please refer to the image below for the exact line of the error. const cartSlice = createSlice({ name ...

Having issues with the link page in react-router-dom?

Currently, I am utilizing the react-router-dom library to manage routers. However, I have encountered an issue where linking to another page does not change the page, but instead adds the new page right after the previous one as shown in the image below. W ...

What could be the reason why this XMLHttpRequest demo from Mozilla isn't functioning properly in Firefox 3?

Having some trouble with getting the sample code from Mozilla to work with a REST web service in Firefox 3.0.10. Surprisingly, it works fine in IE 8! Why is this not working? Does IE 8 support XMLHttpRequest? Most examples I've seen use ActiveX allo ...

Using $gte and $lte with number integers is causing an issue in mongodb

I need help retrieving documents that have at least one entry of 'cov.res.timestamp' within a specific range. {'cov.res.timestamp': { $gte: 1571424600, $lte: 1571597580 }} Currently, it seems to be listing docum ...

The error occurred in Commands.ts for Cypress, stating that the argument '"login"' cannot be assigned to the parameter of type 'keyof Chainable<any>))`

Attempting to simplify repetitive actions by utilizing commands.ts, such as requesting email and password. However, upon trying to implement this, I encounter an error for the login (Argument of type '"login"' is not assignable to parameter of t ...

Can the title of a page be modified without using HTML?

Is it possible to update the title of my website directly from the app.js file? (I am utilizing node.js and express.js) ...

Vue JS causing page to flash briefly before disappearing

I recently started exploring Vue and I'm working on creating a basic search function that takes a user input query and displays all matching users. To help me with this, I've been following a video tutorial for guidance. Despite not encounterin ...

Having issues when dynamically adding options to a multiselect dropdown

I'm working on dynamically adding options to a multiselect using AJAX: <select size='2' name="CraftCode" id=@ccrf class="form-control js-select manualentrydd" ></select> $.ajax({ type: "GET", url: "GetCraftCodes", data: ...

Implementing Angular2 with conditional loading

One of the requirements for my project is to redirect users to the login page before loading the Angular2 application, without actually loading it. The project is built using angular2-quicksart. After minifying the Angular2 js file: <script> va ...

Module not found in Node.js Express

Having trouble locating a module in Node.js Express Sample code provided below const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.lis ...

Indexing a JSON array column in MySQL with the possibility of non-JSON data present

In my MySQL 8 database, I have a multi-tenant setup. The primary table is called entity, and each tenant can configure additional fields such as field1, field2, and so on. These fields can be text fields, booleans, JSON arrays, and more. The JSON array con ...

Switching Tabs When a Button is Clicked

I am currently using a guide from the link provided to learn how to create tabs: http://www.w3schools.com/howto/howto_js_tabs.asp. function openTab(evt, tabName) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClass ...

jQuery's conditional always evaluates the first condition

One of the elements in my jQuery code is a conditional function designed to display a specific message with its own style when necessary: function msg(type, text) { if (type="success"){ $('.messageDisplay').attr('class', &a ...

Error encountered while creating a table from JSON data: Incompatible format - Object cannot be converted to TSV, only arrays allowed

After generating a json data set, my script attempts to display it in table format. The following code snippet shows an example of the generated data: echo ${conn_list[@]} | jq '.' { "host": { "name": "mike1", "node": "c04", " ...

Error: Trying to access properties of an undefined object (specifically 'promise.data.map')

Currently, I am in the process of writing unit tests for a project built with Angular version 1.2. For my controller tests, I have set up a mockService that returns a deferred promise. One of the service methods looks like this: function getItems() { ...

Creating a Dynamic Form with jQuery, AJAX, PHP, and MySQL for Multiple Input Fields

Success! The code is now functional. <form name="registration" id="registration" action="" method="post"> <div id="reg_names"> <div class="control-group"> <label>Name</label> <div class= ...

Experiencing an issue with Angular 14 when trying to install apollo-angular as

For the past two days, I've been attempting to set up apollo on an Angular application. Unfortunately, I keep encountering the following error: The package <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ea8b9a85868685c78b8 ...