Naar inhoud springen

Module:SVG example/doc

Uit Wikibooks

(MediaWiki:Scribunto-doc-page-header)

Dit is de documentatiepagina voor Module:SVG example.


This module is meant to demonstrate the syntax of mw.svg.new() for use in Extension:Scribunto. (@ mediawiki)

Cirkel

Wikicode

{{#Invoke:SVG example|drawCircle}}

Lua

local p = {}

function p.drawCircle()
  local svg = mw.svg.new()
  return svg:setAttribute( 'width', '100px' )
            :setAttribute( 'height', '100px' )
            :setContent( '<circle cx="50" cy="50" r="45" style="fill:green;" />' )
            :setImgAttribute( 'alt', 'SVG image' )
            :toImage() -- Gives the image
end

return p 

Resultaat

SVG image


Grafiek

Wikicode

{{#Invoke:SVG example|drawGraph}}

Lua

(zie Module:SVG example)

Resultaat

Informatie afkomstig van Wikibooks NL, een onderdeel van de Wikimedia Foundation.