0

有谁知道在使用JSXGraph时如何在多边形的任意边界上放置标签?

我正在寻找实现这样的东西:

带标签的多边形

我正在创建一个像这样的多边形(脚本通过 board.jc.parse 解释):

A = point(-5,-5) << withLabel:false, visible:false>>;
B = point(-5,5) << withLabel:false, visible:false>>;
C = point(5,5) << withLabel:false, visible:false>>;
D = point(5, -5) << withLabel:false, visible:false>>;
polygon(A,B,C,D);

我想我可以做这样的事情(在点上放一个标签,然后将它移动几个像素),但是...... blehk,它很难看。我想将标签附加到多边形的一侧或线条本身。

// Don't want to do it this way
text(A.X(), A.Y(), 'label')  << id: 'TT1' >>;
4

1 回答 1

1

在 JessieCode / JSXGraph 中,可以使用属性子对象“borders”设置多边形边界的标签:

A = point(-5, -5) << withLabel:false, visible:false>>;
B = point(-5, 5) << withLabel:false, visible:false>>;
C = point(5, 5) << withLabel:false, visible:false>>;
D = point(5, -5) << withLabel:false, visible:false>>;

polygon(A,B,C,D) << 
    borders: <<
        names: ['a', 'b', 'c', 'd'],
        withLabel: true
    >>
>>;
于 2014-11-10T09:13:01.737 回答