我怎样才能遮蔽 JSXGraph 板的部分?

How can I shade sections of a JSXGraph board?

我有一个 jsxgraph 板,设置了一些简单的线条,如下所示:

我想遮蔽它的一部分,例如,蓝线和虚线之间的白色区域。最好的方法是什么?我查看了 the API but none of the provided elements jumped out at me, and I haven't seen any examples so far that do what I'm trying to do. Is the Inequality element easily extendable to multiple lines?

您可以使用多边形并隐藏多边形的边和顶点。这是一个例子:

    var board = JXG.JSXGraph.initBoard("jxgbox", {
        boundingbox: [-1, 5, 5, -1],
        axis: true
    });

    var p1 = board.create('point', [2, 1]);
    var shade = board.create('polygon', [p1, [0,p1.Y()], [0,4]],
            {
                borders: {visible: false},
                vertices: {visible: false}
            }
        );

如果您需要与坐标轴相交,您可以使用 board.defaultAxes.xboard.defaultAxes.y.