I want to draw axis line with comb-styled selection of inequality domain, like in this picture:
Is it possible with JSXGraph?
I want to draw axis line with comb-styled selection of inequality domain, like in this picture:
Is it possible with JSXGraph?
它还没有内置到 JSXGraph 中。但这是个好建议。这是一个实现(要内置,它必须重写为 JSXGraph 元素)。
const board = JXG.JSXGraph.initBoard('jxgbox', {
boundingbox: [-5, 5, 5, -5],
axis: true
});
var comb = function(board, [left, right, n, base, height]) {
var delta,
c = board.create('curve', [[0], [0]]);
delta = (right - left) / n;
c.updateDataArray = function() {
var s;
this.dataX = [];
this.dataY = [];
for (s = left; s + delta*0.5<= right; s += delta) {
this.dataX.push(s);
this.dataY.push(base);
this.dataX.push(s + delta);
this.dataY.push(base + height);
this.dataX.push(NaN); // Force a jump
this.dataY.push(NaN);
}
};
board.update();
return c;
};
var c1 = comb(board, [1, 3, 10, 0, 0.2]);
var c2 = comb(board, [-4, -1, 20, -2, 0.2]);
在此处查看实际操作:https ://jsfiddle.net/vcL7aepo/217/ 。