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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:42:55+00:00 2026-06-03T19:42:55+00:00

I made a scatter plot, and want to add a link to each dot.

  • 0

I made a scatter plot, and want to add a link to each dot.

    chart.selectAll("scatter-dots")
      .data(data)
      .enter().append("circle")
        .attr("cx", function (d) { return x(d.position[0]); } )
        .attr("cy", function (d) { return y(d.position[1]); } )
        .attr("r", 4)
        .style("fill", "#666")
        .style("opacity", 0.5)
    .on("click", function(){
        var url = "http://somelink.com/link.php?id=";
        url += d.link_id;
        //$(location).attr('href', url);
        //window.location = url;    
    });

It works if I just put the pure String link such as
window.location = “http://stackoverflow.com”
However, if I add queries to the end of the URL from a variable, the page does not redirected.

Neither jquery nor javascript worked (as commented.)

I also tried an external js file, still fail.

This is in a PHP file, if this helps.

  • 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-03T19:42:57+00:00Added an answer on June 3, 2026 at 7:42 pm

    If it works with a static string then something is wrong with d.link_id. Try seeing what’s inside either by doing alert(d.link_id) or if you use a firebug or similars do console.log(d.link_id).

    Alternatively, you should use real anchors for linking your nodes instead of setting click events. This would go something like…

    chart.selectAll("scatter-dots")
      .data(data)
      .enter()
      .append("a")
        .attr("xlink:href", function(d) {return "http://somelink.com/link.php?id=" + d.link_id})
        .append("circle")
          .attr("cx", function (d) { return x(d.position[0]); } )
          .attr("cy", function (d) { return y(d.position[1]); } )
          .attr("r", 4)
          .style("fill", "#666")
          .style("opacity", 0.5)
    

    (I can’t seem to recall if this is the exact way of doing it, you might need to save the anchors in a variable and then append the circles to them.)

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

Sidebar

Related Questions

Here's a plot I made using matplotlib . It uses the bar and scatter
I made an Excel file with data on tab 2, and a chart on
I try to make a scatter chart but the data point is not exactly
I made a scatter plot and am trying to change the color of plotted
I`v made my webpart that works well (I can add it to page and
Made a new window application. Right-clicked Frameworks > Add Existing Frameworks. Selected Frameworks folder,
Made a simple server using TcpListen and would like to add SSL to the
I have a plot in pylab which I want to clip to the borders
I made of subclass of UIView called Bubble using which i want to draw
I made some changes in my master branch and want to bring those upstream.

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.