Diaries
SVG Pie Chart
Posted by DesertDawg apropos on Sun Nov 11th, 2007 at 14:07:41 BST
Inspired by the following:
Internet Explorer below 50%, always, and dropping ... Posted by stelt apropos on Fri Oct 26th, 2007 at 13:33:10 BST At my SVG links resource http://svg.startpagina.nl Internet Explorer use is always below 50%. Quite often it's not even the first browser, but behind Firefox. Opera that keeps improving its already good SVG support is small, but growing and looking forward to having SVG support added to Safari in only hours is improving its numbers as well.
<svg onload='go()' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<text x='220' y='080'> 45.20% Mozilla </text>
<text x='220' y='100'> 00.61% Netscape, Mobile Wap, Other </text>
<text x='220' y='120'> 05.51% Safari </text>
<text x='220' y='140'> 04.95% Opera </text>
<text x='220' y='160'> 43.66% Microsoft Internet Explorer </text>
<script> <![CDATA[
pcarray='0.6 5.0 5.5 43.7 45.2' // percentages of pie pieces for each wedge
pc=pcarray.split(' ')
var n = pc.length // Number of pie wedges (centered at 0 0 and translated to 250 250)
var a = 0 // Angle of each wedge (even pie wedge angle = Math.PI*2/n)
var b = 0 // Start and accum angles - trailing edge (starts at 3:00 and goes CCW)
var c = 0 // Accum angles - forward edge (goes CCW)
var r = 100 // Radius of pie
colorarray='red yellow blue lime violet'
color=colorarray.split(' ')
function go()
{
for (i=0; i<n; i++)
{
clr=i;if(i>=color.length)clr=(i%color.length)
a = Math.PI*2*(pc[i]/100) // compute each pie wedge angle separately
c += a // accumulate the pie wedge angles - forward
var x1 = Math.round(r*Math.cos(b)) + ' ' // trailing
var y1 = Math.round(r*Math.sin(b)) + ' '
var x2 = Math.round(r*Math.cos(c)) + ' ' // forward
var y2 = Math.round(r*Math.sin(c)) + ' '
d = 'M0 0 '+ x1+' ' + y1+' ' + 'A' + r+' ' + r+' ' + ' 0 0 1 ' + x2+' ' + y2+' ' + 'L0 0'
dog = document.createElementNS('http://www.w3.org/2000/svg', 'path')
dog.setAttributeNS(null,'d', d )
dog.setAttributeNS(null,'fill',color[clr])
dog.setAttributeNS(null,'transform','translate(100,100)')
document.documentElement.appendChild(dog)
b += a // save the old accumulation
}}
//]]> </script>
</svg>
Permanent link to this story (1 comment)
Sighting of New SVG Logo
Posted by DesertDawg apropos on Mon Jan 8th, 2007 at 23:19:08 BST
Permanent link to this story (8 comments)
New SVG Logo
Posted by DesertDawg apropos on Thu Dec 28th, 2006 at 23:04:48 BST
<svg version='1.0' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<defs>
<g id='A'>
<line x1='200' y1='100' x2='200' y2='300' stroke='orange' stroke-width='27' fill='none' />
<circle cx='200' cy='100' r='20' fill='orange' />
<circle cx='200' cy='300' r='20' fill='orange' />
</g>
<g id='All'>
<line x1='200' y1='100' x2='200' y2='300' stroke='black' stroke-width='80' stroke-linecap='round' fill='none' />
<line x1='200' y1='100' x2='200' y2='300' transform='rotate(045,200,200)' stroke='black' stroke-width='80' stroke-linecap='round' fill='none' />
<line x1='200' y1='100' x2='200' y2='300' transform='rotate(090,200,200)' stroke='black' stroke-width='80' stroke-linecap='round' fill='none' />
<line x1='200' y1='100' x2='200' y2='300' transform='rotate(135,200,200)' stroke='black' stroke-width='80' stroke-linecap='round' fill='none' />
<use x='0' y='0' xlink:href='#A' transform='rotate(0)' />
<use x='0' y='0' xlink:href='#A' transform='rotate(45,200,200) ' />
<use x='0' y='0' xlink:href='#A' transform='rotate(90,200,200) ' />
<use x='0' y='0' xlink:href='#A' transform='rotate(135,200,200)' />
</g>
</defs>
<use x='0' y='0' xlink:href='#All' transform='translate(0,0) scale(1,1)' />
</svg>
Permanent link to this story (17 comments)
- Create an account
- About SVG.org
- Frequently Asked Questions
- SVG.org Content with RSS

- Get SVG Help on IRC
- SVG.Open Conferences
- SVG Phones (169 and counting)
- JSR 226 Phones (28 and counting)
- Adobe ends Support of Adobe SVG Viewer in 2 Months (sweety)
- Fantastic day (Peted)
- IE stoping me from using SVG as I would like (ADAC)
- SVG forum for enthusiast (iceman)
- Getting to know SVG (Poker)
- R&D Wireless Technology, Sr SW Engineer- Multimedia, SVG, ... (Riccione Resources)
- Scalable Vector Graphics (unilita)
- Learning SVG (iceman)
- A Simpler Example (Cyrille)
- JavaScript not performing SVG changes Incrementally (Cyrille)
| Votes: 151 | | | Comments: 12 |
| Results | | | Other Polls |
Friday July 11th
- Internet Explorer no longer #1 in marketshare (0 comments)
Wednesday June 25th
- Mozilla SVG speed (0 comments)
Wednesday June 11th
- my story (0 comments)
Saturday June 7th
- just wanna say "hello" (0 comments)
Monday May 26th
- Hi (0 comments)
Saturday May 24th
- Flex Compiler for Flash Player 10 Available (0 comments)
Saturday May 3rd
- Learning XML (0 comments)
Friday April 25th
- Phew (0 comments)
Thursday April 24th
- Time has come to revamp the web (0 comments)
Wednesday April 23rd
- SVG and Me (0 comments)
