模板:JSXGraph1
跳到导航
跳到搜索
用法
在页面中插入代码 {{JSXGraph1}}
用
<html></html>
包裹图表代码:
- 绘图区域
<div id="jxgbox" class="jxgbox" style="width:500px; height:400px;"></div>
- 用
<script></script>
包裹 javascript 代码绘图:- 定义绘画板
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 7, 5, -1], keepAspectRatio:true, axis:true});
,其中boundingbox: [-5, 7, 5, -1]
定义坐标系范围 [左x, 上y, 右x, 下y];keepAspectRatio:true
保持纵横比;axis:true
显示坐标图。 - 画点
var t = board.create('point',[4,6]);
- 画点
var p = board.create('point',[-2,-1],{name:"first", size:5, color:"FF0000"});
- 定义绘画板
效果