ASCIIsvg.js Sample file: Easy Scalable Vector Graphics

This page requires Internet Explorer 6 + Adobe SVGviewer or SVG enabled Mozilla/Firefox.

<script>
function drawPicture(){
  initPicture("figure1",-1,6,-1,6)
  origin = [50,50]
  unitlength = 20
  axes()
  a = [0,0]
  b = [5,5]
  marker = "dot"
  line(a,b)
  text(a,"a","belowright")

  text(b,"g","above")
  text(b,"b","right")
  text(b,"b","left")
  text(b,"b","below")
  text(b,"b","aboveleft")
  text(b,"b","aboveright")
  text(b,"b","belowleft")
  text(b,"b","belowright")
  stroke = "red"
  path([a,[0,5],b,[5,0]])
  stroke = "green"
  marker = "none"
  curve([a,[.25,0],[.5,.5],[1,1],[1.5,1.5]])
  stroke = "blue"
  circle([5,0],1)
  ellipse([0,5],1,2)
  stroke = "purple"
  rect([0,0],[2,2],null,.5,1)
  marker = "arrowdot"
  line(a,[5,0])

  initPicture("figure2",-2,2,-2)
  axes()
  stroke = "blue"
  p = []
  with (Math) 
    for (var x = -2; x < 2; x += 0.1)
      p[p.length] = [x, (x+1)*x*(x-1)]
  path(p)
}
</script>