Difference between revisions of "Images"

From JSXGraph Wiki
Jump to navigationJump to search
Line 1: Line 1:
 
<jsxgraph with="500" height="500">
 
<jsxgraph with="500" height="500">
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,5,5,-5],axis:true});
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,5,5,-5],axis:true});
picStr = "http://www.uni-bayreuth.de/layoutbilder_zentral/luftbild_campus2.jpg";
+
var urlImg = "http://www.uni-bayreuth.de/layoutbilder_zentral/luftbild_campus2.jpg";
var im = brd.createElement('image',[picStr, [-1,-1], [4,3] ]);  
+
var im = brd.create('image',[urlImg, [-1,-1], [2*2.67181,2] ]);  
 
</jsxgraph>
 
</jsxgraph>
 +
 +
===The JavaScript code===
 +
Images can be included with the command
 +
<source lang="javascript">
 +
var im = brd.create('image',[urlImg, [-1,-1], [2*2.67181,2] ]);
 +
</source>
 +
It has the parameters:
 +
* ''urlImage'': URL of the image. Data URLs are possible, but will not beshown in the Internet Explorer <8 and are restricted to max. 32kByte in the Internet Explorer 8.
 +
* ''[x,y]'': position of the lower left corner of the image.
 +
* ''[w,h]'': width and height of the image.
 +
<source lang="javascript">
 +
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,5,5,-5],axis:true});
 +
var urlImg = "http://www.uni-bayreuth.de/layoutbilder_zentral/luftbild_campus2.jpg";
 +
var im = brd.create('image',[urlImg, [-1,-1], [5,3] ]);
 +
</source>
 +
 +
[[Category:Examples]]

Revision as of 18:40, 21 December 2009

The JavaScript code

Images can be included with the command

var im = brd.create('image',[urlImg, [-1,-1], [2*2.67181,2] ]);

It has the parameters:

  • urlImage: URL of the image. Data URLs are possible, but will not beshown in the Internet Explorer <8 and are restricted to max. 32kByte in the Internet Explorer 8.
  • [x,y]: position of the lower left corner of the image.
  • [w,h]: width and height of the image.
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,5,5,-5],axis:true});
var urlImg = "http://www.uni-bayreuth.de/layoutbilder_zentral/luftbild_campus2.jpg";
var im = brd.create('image',[urlImg, [-1,-1], [5,3] ]);