模板: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"});
- 定義繪畫板
效果