unconed / MathBox.js

MathBox is a (work in progress) library for making presentation-quality math diagrams in WebGL.
MIT License
1.94k stars 127 forks source link

Add support for custom labels #15

Open steren opened 10 years ago

steren commented 10 years ago

Axes can have numerical labels, but there is a need to display axes names or any custom labels in space with a given style (color, size, but also left,right or centered alignment).

For example, compare this MathBox animation with this video where labels have been added on top of a screengrab of the webpage animation.

fourplusone commented 10 years ago

I've added experimental label support in my branch of mathbox.js: https://github.com/fourplusone/MathBox.js/tree/feature/labels Syntax is

.label({
    position: [x,y,z],
    text: "a^3+x"
})
steren commented 10 years ago

Nice work. That will be definitively helpful. Could you open a pull request on this repository with these changes?

Jeegliputh commented 10 years ago

http://lzd.kopeisk.info/math/math2/examples/Empty.html my program is not work :( . Could you help me? please...

yugo-ren commented 9 years ago

Is it possible to add an 'id' field and control the position of the label dynamically?

I tried addind id: 'foo' to JSON, and I can access and change position, text, etc. fields using mathbox.set("#foo"), but nothing changes in the box. I looked at the commit and couldn't really figure out if the labels refresh upon change.