[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] multiple envelope plot?



Hey,

you have to check out the svn tree like described at
	http://sonenvir.at/help/svn

than it is in
	trunk/src/Framework/Classes/osx/ScatterView.sc
and
	trunk/src/Framework/Help/osx/ScatterView[3d].help.rtf
resp.

anyway I send it to the list since it is not that big...:

Attachment: ScatterView.sc
Description: Binary data


{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf330
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fnil\fcharset77 Monaco;\f2\fswiss\fcharset77 Helvetica;
}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue191;\red0\green0\blue191;
\red191\green0\blue0;\red0\green115\blue0;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b\fs36 \cf0 ScatterView
\f1\b0\fs28 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\fs24 \cf0 2005 by till bovermann\
bielefeld university\
\
plots a dataset into a view.\

\f1\fs18 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b\fs24 \cf0 *new (parent, bounds, data, specX, specY)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	returns a new ScatterView\
	
\f0\b parent
\f2\b0 	the Parent GUI element\
	
\f0\b bounds
\f2\b0 	the bounds (a Rect)\
	
\f0\b data
\f2\b0 		the data; format: [[aX, aY],[bX, bY],[cX, cY],[dx, dy], ... ]\
	
\f0\b specX
\f2\b0 	the ControlSpec indicating the Specification of the X-Axis\
	
\f0\b specY
\f2\b0 	the ControlSpec indicating the Specification of the Y-Axis\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 \
*newWindow (name, bounds, resizable, border, data, specX, specY)
\f2\b0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\fs18 \cf0 \
\cf2 	\cf3 ScatterView\cf2 .newWindow(data: \{\cf3 |i|\cf2  [i*0.01, 1.0.rand]\}!100)\

\f2\fs24 \cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 background(color)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set background-color\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 symbolColor(color)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set color of symbols\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 drawMethod(aSymbol)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set the method used to draw an item; either\
	
\f0\b aSymbol
\f2\b0 	one of \\fillRect, \\fillOval, \\lineTo\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 isHighlight(bool)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	switch for highlight on/off\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightItem(index)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set item to be highlighted.\
	Index could be either index or array of indices.\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightItemRel(val)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set highlighted item relative\
	
\f0\b val
\f2\b0 	in [0 .. 1.0]\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightSize(point)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set highlight extend\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightColor(color)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\b0 \cf0 	set color of highlighted item\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b\fs28 \cf0 Examples\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0\fs18 \cf0 \
(\
\cf4 var\cf0  numItems = 630;\
w = \cf4 SCWindow\cf0 .new(bounds: \cf4 Rect\cf0 (40, 40, 800, 150)).front;\
a = \cf4 ScatterView\cf0 (w, \cf4 Rect\cf0 (10, 10, 760, 100), \{\cf4 |i|\cf0  [sin(i/50), sin(0.05*i)]\}!numItems, [-1,1].asSpec, [-1,1].asSpec);\
a.isHighlight = \cf4 true\cf0 ;\
\cf4 SCSlider\cf0 (w, \cf4 Rect\cf0 (10, 120, 760, 10)).action_\{\cf4 |me|\cf0 \
	a.highlightItemRel = me.value;\
	w.refresh;\
	\cf5 // a.highlightItem = (me.value*numItems).asInteger.min(numItems-1);\cf0 \
\};\
a.drawMethod = \cf6 \\lineTo\cf0 ;\
a.symbolColor = \cf4 Color\cf0 .blue(0.7, 0.3);\
a.highlightSize = 10@10;\
w.refresh;\
)\
\
\
a.highlightItem = (1, 3..99);\
w.refresh;\
a.highlightRangeRel(0, 0.3);\
w.refresh;\
a.highlightRange(0, 100);\
w.refresh;\
\
(\
a.symbolSize = 30@3;\
a.drawMethod = \cf6 \\strokeOval\cf0 ;\
a.isHighlight = \cf4 false\cf0 ;\
w.refresh;\
)\
\
a.symbolColor = \cf4 Color\cf0 .red(0.2, 0.2);\
w.refresh\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf5 // dynamics\cf0 \
(\
l = \{\cf4 inf\cf0 .do\{\cf4 |i|\cf0 \
	a.symbolSize = (cos(i*0.1)*40+3)@(cos(i*0.1+1)*40+3);\
	\{w.refresh\}.defer;\
	0.1.wait;\
\}\}.fork\
)\
l.stop;\
\cf5 // end dynamics\cf0 \
\
(\
a.background = \cf4 Color\cf0 .gray(1,0.5);\
a.isHighlight = true;\
a.highlightSize = 6000@500;\
a.highlightColor = \cf4 Color\cf0 .green;\
a.symbolSize = 1;\
a.drawMethod = \cf6 \\lineTo\cf0 ;\
w.refresh;\
)\
\
\
\cf5 // reset the Data\cf0 \
(\
a.data = \{\cf4 |i|\cf0  [cos(i/50), sin(0.05*i)]\}!150;\
w.refresh;\
)\
\
\cf5 // use other drawMethods\cf0 \
a.drawMethod = \cf6 \\fillOval\cf0 ;\
w.refresh\
\
\
\cf5 // use two views stacked\cf0 \
(\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf4 var\cf0  numItems = 630;\
w = \cf4 SCWindow\cf0 .new(bounds: \cf4 Rect\cf0 (40, 40, 800, 150)).front;\
a = ScatterView(w, Rect(10, 10, 760, 100), \{|i| [sin(i/50), sin(0.05*i)]\}!numItems, [-1,1].asSpec, [-1,1].asSpec);\
b = ScatterView(w, Rect(10, 10, 760, 100), \{|i| [sin(i/21), sin(0.05*i)]\}!numItems, [-1,1].asSpec, [-1,1].asSpec);\
a.background = Color.gray(0, 0);\
a.isHighlight = \cf4 true\cf0 ;\
\cf4 SCSlider\cf0 (w, \cf4 Rect\cf0 (10, 120, 760, 10)).action_\{\cf4 |me|\cf0 \
	a.highlightItemRel = me.value;\
	w.refresh;\
	\cf5 //a.highlightItem = (me.value*numItems).asInteger.min(numItems-1);\cf0 \
\};\
a.drawMethod = \cf6 \\lineTo\cf0 ;\
a.symbolColor = \cf4 Color\cf0 .blue(0.7, 0.3);\
a.highlightSize = 10@10;\
w.refresh;\
)\
\
\
\
\
(\
\cf4 var\cf0  numItems = 630;\
w = \cf4 SCWindow\cf0 .new(bounds: \cf4 Rect\cf0 (40, 40, 800, 150)).front;\
a = \cf4 ScatterView\cf0 (w, \cf4 Rect\cf0 (10, 10, 760, 100), \{\cf4 |i|\cf0  [sin(i/50), sin(0.05*i)]\}!numItems, [-1,1].asSpec, [-1,1].asSpec);\
a.isHighlight = \cf4 true\cf0 ;\
\cf4 SCRangeSlider\cf0 (w, \cf4 Rect\cf0 (10, 120, 760, 10)).action_\{\cf4 |me|\cf0 \
	a.highlightRangeRel(me.lo, me.hi);\
	w.refresh;\
	\cf5 // a.highlightItem = (me.value*numItems).asInteger.min(numItems-1);\cf0 \
\};\
a.drawMethod = \cf6 \\lineTo\cf0 ;\
a.symbolColor = \cf4 Color\cf0 .blue(0.7, 0.3);\
a.highlightSize = 10@10;\
w.refresh;\
)\
}
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf330
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fnil\fcharset77 Monaco;
}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue191;\red96\green96\blue96;
\red0\green115\blue0;\red191\green0\blue0;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b\fs32 \cf0 ScatterView3d\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0\fs24 \cf0 till bovermann, uni bielefeld 2006
\f2\fs18 \
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b\fs24 \cf0 *new (parent, bounds, data, specX, specY, specZ, rotX, rotY, rotZ)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	returns a new ScatterView\
	
\f0\b parent
\f1\b0 	the Parent GUI element\
	
\f0\b bounds
\f1\b0 	the bounds (a Rect)\
	
\f0\b data
\f1\b0 		the data; format: [[aX, aY],[bX, bY],[cX, cY],[dx, dy], ... ]\
	
\f0\b specX
\f1\b0 	the ControlSpec indicating the Specification of the X-Axis\
	
\f0\b specY
\f1\b0 	the ControlSpec indicating the Specification of the Y-Axis\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 \
*newWindow (name, bounds, resizable, border, data, specX, specY, specZ, rotX, rotY, rotZ)
\f1\b0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f2\fs18 \cf0 \
\cf2 	\cf3 ScatterView3d\cf2 .newWindow(data: \{\cf3 |i|\cf2  [i.rand*0.001, 1.0.rand, 1.0.rand]\}!1000)
\f1\fs24 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 \
background(color)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set background-color\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 symbolColor(color)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set color of symbols\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 drawMethod(aSymbol)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set the method used to draw an item; either\
	
\f0\b aSymbol
\f1\b0 	one of \\fillRect, \\fillOval, \\lineTo\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 isHighlight(bool)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	switch for highlight on/off\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightItem(index)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set item to be highlighted.\
	Index could be either index or array of indices.\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightItemRel(val)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set highlighted item relative\
	
\f0\b val
\f1\b0 	in [0 .. 1.0]\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightSize(point)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set highlight extend\
	\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f0\b \cf0 highlightColor(color)\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural

\f1\b0 \cf0 	set color of highlighted item\

\f2\fs18 \
(\cf2 \
\cf3 var\cf2  data;\
data = \{\{2.0.rand2\}!3\}!150;\
w = \cf3 SCWindow\cf2 .new(\cf4 "3D Scatterplot"\cf2 , \cf3 Rect\cf2 (40,40, 500, 500)).front;\
a = \cf3 ScatterView3d\cf2 (w, \cf3 Rect\cf2 (10,10, 450, 450), data, [-2, 2].asSpec);\
a.drawMethod = \cf5 \\fillRect\cf2 ;\
a.symbolSize = 3;\
a.symbolColor = \cf3 Color\cf2 .blue;\
a.background = \cf3 Color\cf2 .black;\
\
\cf6 // Y Slider\cf2 \
\cf3 SCSlider\cf2 (w, \cf3 Rect\cf2 (10, 470, 450, 10)).action_\{\cf3 |me|\cf2 \
	a.rotY = me.value * 2pi;\
	w.refresh;\
\};\
\cf6 // X Slider\cf2 \
\cf3 SCSlider\cf2 (w, \cf3 Rect\cf2 (470, 10, 10, 450)).action_\{\cf3 |me|\cf2 \
	a.rotX = me.value * 2pi;\
	w.refresh;\
\};\
\cf6 // Z Slider\cf2 \
\cf3 SCSlider\cf2 (w, \cf3 Rect\cf2 (490, 10, 10, 450)).action_\{\cf3 |me|\cf2 \
	a.rotZ = me.value * 2pi;\
	w.refresh;\
\};\
\cf0 )\
\
a.isHighlight = true\
a.highlightColor = Color.green;\
a.highlightSize = 10@10\
a.highlightItem = 99\
w.refresh}


hope that helps
Till

On 05 Mar 2006, at 23:14, Jascha Narveson wrote:



hm- i looked through the various directories on this site, and even did a site-specific google search, and couldn't find it. i found a ScatterView on another site which was written in Java, but i assume that's something different...?

if sending attachments to the list isn't desirable, you can send it to me off-list - i'd like to look at it.

j


On Mar 5, 2006, at 3:41 PM, Till Bovermann wrote:

You might wnat to have a look at the class I've written for sonenvir:

http://sonenvir.at

ScatterView
plots a dataset into a view.


this view may be added to a window several times...

hope that helps
Till