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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:00:45+00:00 2026-05-21T03:00:45+00:00

Using Protovis, I generate a candlestick chart similar to this: http://vis.stanford.edu/protovis/ex/candlestick-full.html . I need

  • 0

Using Protovis, I generate a candlestick chart similar to this: http://vis.stanford.edu/protovis/ex/candlestick-full.html. I need to annotate the chart for a specific candlestick. For instance, I could draw triangle at the position of the 12:00 candlestick. How do I find the position (left and bottom) of that specific candlestick?

  • 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-21T03:00:46+00:00Added an answer on May 21, 2026 at 3:00 am

    I believe the standard protovis approach to this is to make the annotation mark a child mark of the data point you’re interested in, then set its visible property to only display for the data point you’re interested in. For the candlestick example, it might look like this:

    // the thin line of the candlestick
    var candlestick = vis.add(pv.Rule)
        .data(vix)
        .left(function(d) x(d.date))
        .bottom(function(d) y(Math.min(d.high, d.low)))
        .height(function(d) Math.abs(y(d.high) - y(d.low)))
        .strokeStyle(function(d) d.open < d.close ? "#ae1325" : "#06982d");
    
    // the thick line of the candlestick
    candlestick.add(pv.Rule)
        .bottom(function(d) y(Math.min(d.open, d.close)))
        .height(function(d) Math.abs(y(d.open) - y(d.close)))
        .lineWidth(10);
    
    // the annotation mark
    candlestick.add(pv.Dot)
        .size(40)
        .shape("triangle")
        .left(function() {
            // candlestick here refers to the parent instance
            return candlestick.left()
        })
        .top(function() {
            // candlestick here refers to the parent instance
            // this is 10px from the top of the candlestick
            return h - candlestick.bottom() - candlestick.height() - 10;
        })
        .visible(function(d) {
            // only show the mark for the data we care about - here, June 12
            // (month is 0-based)
            return d.date.getUTCMonth() == 5 && d.date.getUTCDate() == 12;
        });
    

    The other option, if you need to get the data outside of the protovis context (e.g. you want to show a div there with HTML text) would be to grab the data as it’s being defined (e.g. in the bottom and height property functions of the candlestick definition) and store it in a global variable. This is pretty ugly, though.

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

Sidebar

Related Questions

using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using RestKit 0.10.1, I have objects served similar to this json format: {objects: [
I'm using the protovis library (http://mbostock.github.com/protovis/) to draw a graph. I uploaded the code
Using CI for the first time and i'm smashing my head with this seemingly
@using(Html.BeginForm(About, User, FormMethod.Post , new { id=aboutme})) { <fieldset> <ul> <li> <label class=block>About me</label>
Using range() in Underscore I can make something like this: _.range(10); >> [0, 1,
Using PostgreSQL 8.4 and with a table such as this: create table log (
Does anyone know where to find basic helper functions for using Protovis? I'm thinking
I am using the example found on protovis site to display the nodes of
Using this code, the following execution yields strange results: C 100 R W The

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.