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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:34:07+00:00 2026-05-26T14:34:07+00:00

I am pretty new to protovis. I was trying to understand the example in

  • 0

I am pretty new to protovis. I was trying to understand the example in http://mbostock.github.com/protovis/docs/panel.html I can understand left(function() this.index * 10)is actually left(function(){return this.index * 10;}) and when the function is called a scope is passed to it thats this well and fine till now. BUt data(function(array) array) doesn’t takes the array from this. rather its passed to it. from where this array is passed ? I cannot understand the flow of the chain.

  • 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-05-26T14:34:08+00:00Added an answer on May 26, 2026 at 2:34 pm

    This is one of the many parts of Protovis that’s a bit confusing at first. When you add data to a mark, e.g.:

    var mark = new pv.Panel()
        .data([1,2,3]);
    

    the mark will be duplicated once for each item in the data array, and passed the corresponding item as the first argument to its functions, e.g.:

    new pv.Panel()
        .data([1,2,3])
        .title(function(d) { // <-- d is 1, 2, or 3
            return d;
        });
    

    Any child mark you attach to mark will also receive this data point, which can then be used by the child mark as the input argument for its functions, e.g.:

    new pv.Panel()
        .data([1,2,3])
      .add(pv.Label)
        .text(function(d) { // <-- d is 1, 2, or 3
            return d;
        });
    

    But child marks can also define their own data(), which will duplicate that mark accordingly. A child mark’s data can be totally independent, e.g.:

    new pv.Panel()
        .data([1,2,3])
      .add(pv.Label)
        .data([3,4,5])
        .text(function(d) { // <-- d is 3, 4, or 5
            return d;
        });
    

    But often, as in the example you link to, the parent will have a 2- or 3-d array as its data, and the child will base its data() on the sub-array it’s passed:

    new pv.Panel()
        .data([[1,2,3], [3,4,5]])
      .add(pv.Label)
        .data(function(d) { // <-- d is [1,2,3] or [3,4,5]
            return d;
        })
        .text(function(d) { // <-- d is either 1, 2, or 3, 
                            // OR 3, 4, or 5
            return d;
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im pretty new to jQuery (since a week) and don't understand why I can't
Im pretty new to Linux in general. Ive just been following this tutorial(http://net.tutsplus.com/tutorials/php/how-to-setup-a-dedicated-web-server-for-free/) to
I am pretty new to PHP and MySQL and I just can't figure this
I am pretty new to buddypress. I am trying to do something pretty simple
Im pretty new to REST but as far as i have gathered i understand
Pretty new to dependency injection and I'm trying to figure out if this is
Pretty new to sqlite (and sql). Trying to modify one table using another. create
Pretty new to jquery/javascript, but proficient in html/css... I have a list of siblings
Pretty new to C# but not new in programming in generally. I'm still trying
Am pretty new to web services and have been trying to implement Soap Faults.

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.