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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:56:55+00:00 2026-05-31T10:56:55+00:00

As far as I know, there is currently no way to display SVG polygons

  • 0

As far as I know, there is currently no way to display SVG polygons in the Raphael Javascript library. I’m building an application that needs to read in SVGs and them display them in Raphael, however, many of these SVGs use polygons.

For example, I’m reading in an SVG with a polygon in this format:

<polygon points="260.5,627.75 259.563,628.313 258.625,628.563 258.25...

So, I’m wondering…is there a way to convert the polygon points into a path which I could draw in Raphael? I’ve seen a few applications using python and PHP, but so far I can’t find anything that is strictly javascript.

Any help would be greatly appreciated.
Thanks

  • 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-31T10:56:56+00:00Added an answer on May 31, 2026 at 10:56 am

    See Paper.path. You can specify your own path. E.g. a red triangle:

    paper.path('M 50 0 L 100 100 L 0 100 Z').attr('fill', 'red')
    

    In response to your edit:

    You should be able to take the points attribute, as a string, and replace all coordinates in the format x,y with L x,y — that’ll make a valid path for SVG. You might want a moveTo command initially though. So, this:

    260.5,627.75 259.563,628.313 258.625,628.563
    

    Would become:

    M 260.5,627.75 L 259.563,628.313 L 258.625,628.563
    

    Raphael seems to want integers, not decimals. So it would have to be:

    M 260,627 L 259,628 L 258,628
    

    To make this happen:

    var polygonPoints = '260.5,627.75 259.563,628.313 258.625,628.563';
    var convertedPath = polygonPoints.replace(/([0-9.]+),([0-9.]+)/g, function($0, x, y) {
        return 'L ' + Math.floor(x) + ',' + Math.floor(y) + ' ';
    }).replace(/^L/, 'M'); // replace first L with M (moveTo)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I know, there is currently no JAXB implementation which would work
As far as I know there is no way to migrate existing Facebook comments
as far as i know there are cross domain restictions that wont allow you
As far as I know there is no way to do this, but I
As far as I know, there's no way to get url hash in a
I'm doing some stuff that uses snow clusters. Currently the only way I know
As far as i know, there is no direct equivalent in C#. My current
As far as I know there's some kind of Linux in the Chrome OS
I am working on a Metro app, and as far as I know there
So far I know that FileSystemWatcher can look into a folder and if any

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.