Colorful circles: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<jsxgraph width="600" height="600"> | <jsxgraph width="600" height="600"> | ||
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]}); | JXG.Options.point.zoom = true; | ||
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1], takeFirst: false}); | |||
var i, h, s, v; | var i, h, s, v; | ||
brd.suspendUpdate(); | |||
for (i=0;i<100;i++) { | for (i=0;i<100;i++) { | ||
h = Math.random()*360; | h = Math.random()*360; | ||
s = Math.random(); | s = Math.random(); | ||
v = 1.0; | v = 1.0; | ||
brd. | brd.create('point',[Math.random(),Math.random()], | ||
{ | { | ||
withLabel:false, | withLabel:false, | ||
Line 14: | Line 16: | ||
strokeColor:JXG.hsv2rgb(h,s,v), | strokeColor:JXG.hsv2rgb(h,s,v), | ||
fillColor:JXG.hsv2rgb((h+180)%360,s,v), | fillColor:JXG.hsv2rgb((h+180)%360,s,v), | ||
highlightFillColor:JXG.hsv2rgb(h,s,v), | highlightFillColor:JXG.hsv2rgb(h,s,v), | ||
fillOpacity:0.7, | fillOpacity:0.7, | ||
Line 21: | Line 21: | ||
}); | }); | ||
} | } | ||
brd.unsuspendUpdate(); | |||
</jsxgraph> | </jsxgraph> | ||
===The underlying JavaScript code=== | ===The underlying JavaScript code=== | ||
<source lang="javascript"> | <source lang="javascript"> | ||
JXG.Options.point.zoom = true; | |||
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]}); | var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]}); | ||
var i, h, s, v; | var i, h, s, v; | ||
Line 32: | Line 34: | ||
s = Math.random(); | s = Math.random(); | ||
v = 1.0; | v = 1.0; | ||
brd. | brd.create('point',[Math.random(),Math.random()], | ||
{ | { | ||
withLabel:false, | withLabel:false, |
Latest revision as of 20:08, 14 November 2020
The underlying JavaScript code
JXG.Options.point.zoom = true;
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-0.1,1.1,1.1,-0.1]});
var i, h, s, v;
for (i=0;i<30;i++) {
h = Math.random()*360;
s = Math.random();
v = 1.0;
brd.create('point',[Math.random(),Math.random()],
{
withLabel:false,
face:'circle',
size:Math.random()*65,
strokeColor:JXG.hsv2rgb(h,s,v),
fillColor:JXG.hsv2rgb((h+180)%360,s,v),
highlightFillColor:JXG.hsv2rgb(h,s,v),
fillOpacity:0.7,
highlightFillOpacity:0.4
});
}