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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:25:59+00:00 2026-06-14T09:25:59+00:00

I am trying to implement some kind of Zoom/Pan features to maps generated with

  • 0

I am trying to implement some kind of Zoom/Pan features to maps generated with the google geochart API. There are some scripts online to zoom/pan svg images, but I am not succeeding in implementing them to the SVGs that the geochart api generates.

I am trying the SVGPan library http://code.google.com/p/svgpan/

The code I’m using to append the script to the SVG is:

google.visualization.events.addListener(chart, 'ready', function () {

var script = document.createElementNS('http://www.w3.org/2000/svg', 'script');     
script.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'http://www.cyberz.org/projects/SVGPan/SVGPan.js');        
var svg = document.getElementsByTagName('svg')[0];
svg.appendChild(script);
}); 

Here’s the jsfiddle:

http://jsfiddle.net/cmoreira/CetaA/

With Firebug I can see the script is beeing place on the svg, but nothing happens, it doesn’t implement the features in the svg, as expected.

I am not sure if this line is correct, since I didn’t find any example online:

 var script = document.createElementNS('http://www.w3.org/2000/svg', 'script');

Am I doing something wrong, or what I’m trying to do will be impossible?

Thanks for you help!
Cheers
Carlos

  • 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-14T09:26:01+00:00Added an answer on June 14, 2026 at 9:26 am

    After some experiments, I was able to find a simple solution and since there were not any valuable answers so far, I decided to share what I have so far.

    I decided to do it with CSS, redrawing the map with different values on zoom in/out and hide the overflow with CSS.

    Here’s a working example:

    http://jsfiddle.net/cmoreira/CCUpf/

    CSS

    #canvas {
        width:400px;
        height:300px;
        overflow:hidden;
    }
    
    #visualization {
    top:0px;
    left:0px;
    }
    

    Zoom/Pan Javascript

    function zoomin() {
        mw = mw+50;
        mh = mh+50;
        x = x-25;
        y = y-25;
        document.getElementById('visualization').style.top = y +'px';
        document.getElementById('visualization').style.left = x +'px';
        drawVisualization(mw,mh);
     }
    
      function zoomout() {
        if(mw > 600) {
        mw = mw-50;
        mh = mh-50;
        x = x+25;
        y = y+25;
        document.getElementById('visualization').style.top = y +'px';
        document.getElementById('visualization').style.left = x +'px';
        drawVisualization(mw,mh);
        }
     }
    
     function left() {
         x = x-50;
         document.getElementById('visualization').style.left = x +'px';
     }
     function right() {
         x = x+50;
         document.getElementById('visualization').style.left = x +'px';
     }
      function up() {
         y = y-50;
         document.getElementById('visualization').style.top = y +'px';
     }
       function down() {
         y = y+50;
         document.getElementById('visualization').style.top = y +'px';
     }
    

    I know this is a very poor zoom/pan feature for the google geochart API, but it’s something, right?

    Any improvements to this simple aproach would be welcomed.
    Thanks!

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

Sidebar

Related Questions

I am trying to implement some kind of new Linux task scheduler so I
I'm currently trying to implement some kind of search system in a program of
I'm currently trying to implement some kind of file browser / explorer into a
I am trying to implement some kind of console menu wich has to retrieve
I'm trying to implement some kind of 'multiprocessing' in php for my task. The
I'm trying to implement some kind of drag and drop snap to grid similar
Currently I'm trying to implement some kind of object stream, similar to the structure
I am trying to implement some kind of background task queue in Django, because
I'm trying to implement some kind of caching in a PHP script that will
I'm kind of new in Spring and hibernate so I'm trying to implement some

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.