Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8270719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:40:01+00:00 2026-06-08T06:40:01+00:00

I am using JIT Infovis stacked or mono-valued piechart to do some data visualization.

  • 0

I am using JIT Infovis stacked or mono-valued piechart to do some data visualization. The stacked pie chart takes an object “obj” specifically with the following structure:

This is the hard coded version of jsonObj:

  var obj = {
        // labelID is unique in each case and may be multiple or just one
        'labelID': ['pVal'],
        'values': [{ //labelName is unique in each case and will only be one
            'labelName': 'name1',
            //there may be multiple or just one "values"
            //ex, 'values': [80, 40, 15, 10]
            'values': 80
        }, {
            'labelName': 'name2',
            'values': [20]
        }, {
            'labelName': 'name3',
            'values': [38]
        }, {
            'labelName': 'name4',
            'values': [58]
        }]
    };

I’m trying to dynamically populate “obj” with searched data returned to user. But I can not create an empty “obj” with the above specific structure to dynamically populate the data. I tried several times but don’t think I’m creating them correctly.
I have three values that I’m trying to dynamically populate into this “obj” but can’t get my arms around it. chartID[m], chartArrName[m], chartVal[m].

I need a correct empty “obj” that correspond to the structure defined above.

 var "obj" = {
        label: ['pVal'],
        values: [{
            label: [],
            values: []
        }]
    };
    for (m = 0; m <= chartArrID.length - 1; m++) {
        obj.values[m].label += chartArrName[m];
        obj.values[m].values += parseFloat(chartArrVal[m]);
        //json.push({label: chartArrName[m], values: parseFloat(chartArrVal[m])});
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:40:02+00:00Added an answer on June 8, 2026 at 6:40 am

    This is not a JSON object. JSON is a lightweight data interchange format. You are just using a object initializer syntax to create an object. You can add what you want of the fly.

    var myObj = {};
    myObj.name = "foo";
    myObj.books = [ "one", "two" ];
    myObj.emptyField = null;
    myObj.emptyArray = [];
    myObj["anotherField"] = "bar";   // this works too
    
    myObj.anotherArray = [];
    
    myObj.anotherArray[0] = {};  // you need to insert something in the first position!
    myObj.anotherArray[0].label = "aaa";
    myObj.anotherArray[0].value = "bbb";
    myObj.anotherArray[0].xyz = "ccc";
    
    myObj.anotherArray[1] = {};  // in the second too, of course!
    myObj.anotherArray[1].label = "ddd";
    myObj.anotherArray[1].value = "eee";
    myObj.anotherArray[1].xyz = "fff";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the JIT and making a spacetree, but the data the server returns
Using the stock Sun 1.6 compiler and JRE/JIT, is it a good idea to
I'm using JIT to render graphs. I'm using the RGraph feature. This JSON defines
When i using the keyword 'typeof' ( on reference type ) is the JIT
I'm trying to build a fast JIT using C/C++. It should translate mine bytecode
From http://code.google.com/p/unladen-swallow/wiki/ProjectPlan I quote: Using a JIT will also allow us to move Python
I am trying to parse some HTML using NekoHTML . The problem is that
I've embedded some C# code into an iphone objective-c app using monotouch. I'm able
I am using the Mono Tools from mono-tools.org and when I try to run
I'm wondering is there some kind of JIT-hack going on with System.Lazy to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.