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 9119481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:24:21+00:00 2026-06-17T05:24:21+00:00

I am trying to display data of an an associative array in a table

  • 0

I am trying to display data of an an associative array in a table with d3.js
But i can’t get the individual values in the table.

This is part of my array:

    var twitterDays = 
  [ 
    { 
      0: 
      {
        0: 0,
        1: 0,
        2: 0,
        3: 0,
        4: 0,
        5: 0,
        6: 0,
        7: 0,
        8: 0,
        9: 0,
        10: 0,
        11: 0,
        12: 0,
        13: 0,
        14: 0,
        15: 0,
        16: 0,
        17: 0,
        18: 0,
        19: 0,
        20: 0,
        21: 0,
        22: 0,
        23: 0,
        "total": 0
      },
      "day": "monday"
    },
    { 
      1: 
      {
        0: 0,
        1: 0,
        2: 0,
        3: 0,
        4: 0,
        5: 0,
        6: 0,
        7: 0,
        8: 0,
        9: 0,
        10: 0,
        11: 0,
        12: 0,
        13: 0,
        14: 0,
        15: 0,
        16: 0,
        17: 0,
        18: 0,
        19: 0,
        20: 0,
        21: 0,
        22: 0,
        23: 0,
        "total": 0
      },
      "day": "tueday"
    }, etc etc

With d3.js I’am adding values to the different keys.

This is how I make the table:

var table = d3.select("#datavis").append("table").attr("class", "twitterTable");
var tbody = table.append("tbody");


var rows = tbody.selectAll("tr")
      .data(twitterDays)
        .enter()
        .append("tr").attr("class", function(d) { return d["day"] });

var monday = tbody.select(".monday")
        .data(d3.values(twitterDays[0][0]))
          .enter()
          .append("td")
          .text(d3.values(twitterDays[0][0]));

This is the part what needs to be changed i think: .text(d3.values(twitterDays[0][0]));

The problem is that i want the indivitual values (1 in each)in the “td” that is made, but instead i get all the values of all the values in each “td”..

This is what i get:

<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td>
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td> 
<td>39,25,20,11,9,8,2,3,9,36,36,48,57,58,51,50,75,63,67,58,62,74,67,64,992</td>
etc etc

i want it like so:

<td>39</td>
<td>25</td>
<td>20</td>
<td>11</td>
<td>9</td>
<td>8</td>
<td>2</td>
etc etc  
  • 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-17T05:24:22+00:00Added an answer on June 17, 2026 at 5:24 am

    I think that the line .text(d3.values(twitterDays[0][0])); should be:

    .text(function(d){return d});
    

    Because you already have the data, so it is that data you should include, not the whole vector again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to display data from table games_reviews but instead I am getting
I am trying to get to grips with how you display data from a
I'm trying to display data from a plist that is an array of dictionaries:
I am trying to display my data (images) in two columns of a table
I am trying to display grouped data in AdvancedDatagrid but the data does not
I'm trying to make a PDO query to display data. This is what i
I'm trying to display data from an array of objects obtained using another company's
I'm trying to display some data points using google graphs, but unfortunately there is
I am trying to display my data in a grouped table as below :
im trying to display data on the footer in jqgrid, but it only displays

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.