const _ = window._;
//TRY HIDING/SHOWING THW GRID
let showGrid = true;
let arrayCoords = [];
let firstDraw = false;
var axesFunction = function(){
var xaxis = board.create('axis',
[ [0,0],[1,0] ], {
label: {offset: [7, -10]}, // Doesn't do anything here.
drawZero:false // Doesn't do anything here.
}
);
xaxis.removeAllTicks();
board.create('ticks', [xaxis, 1], { // The number here is the distance between Major ticks
strokeColor:'#ccc',
majorHeight:-1, // Need this because the JXG.Options one doesn't apply
drawLabels:true, // Needed, and only works for equidistant ticks
label: {offset: [-12, -10]},
minorTicks:5, // The NUMBER of small ticks between each Major tick
drawZero:true
}
);
var yaxis = board.create('axis', [ [0,0],[0,1] ]);
yaxis.removeAllTicks();
board.create('ticks', [yaxis, 1], {
strokeColor:'#ccc',
majorHeight:-1, // Need this because the JXG.Options one doesn't apply
drawLabels:true, // Only works for equidistant ticks
label: {offset: [7, -2]},
minorTicks:1, // The NUMBER of small ticks between each Major tick
drawZero:false
}
);
};
let getMouseCoords = function(e, i) {
var cPos = board.getCoordsTopLeftCorner(e, i),
absPos = JXG.getPosition(e, i),
dx = absPos[0]-cPos[0],
dy = absPos[1]-cPos[1];
return new JXG.Coords(JXG.COORDS_BY_SCREEN, [dx, dy], board);
}
let down = function(e) {
firstDraw = false;
let i, coords;
if (e[JXG.touchProperty]) {
// index of the finger that is used to extract the coordinates
i = 0;
}
coords = getMouseCoords(e, i);
arrayCoords.splice(0,arrayCoords.length)
arrayCoords.push(Math.round(coords.scrCoords[1]), Math.round(coords.scrCoords[2]));//arrayCoords.push(temp[1]);
drawoncanvas();//call function
}
//JXG.Options.renderer = 'canvas';
//SETUP BOARD
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-10,10,10,-10], axis: false,
showCopyright: false,grid:false,renderer:'canvas'
});
if(showGrid){
board.addGrid();...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.