Page 1 of 1

Changing graphic Type

Posted: Thu Apr 28, 2016 10:29 pm
by DavJans
I'm sure this is child's play to most of you.

I can make a graphic with script easily enough but it makes a rectangle

Create graphic "L1"

I looked up changing properties..

set the <property> of <object> to <value>

so in my mind...

set the Type of "L1" to Line

but my mind is wrong :(

Re: Changing graphic Type

Posted: Fri Apr 29, 2016 3:28 am
by Opaquer
Hey DavJans!

So, I'm still a beginner, so I could be wrong, but I think I've got an idea :P

Your mind is right, just the wording isn't quite right - instead of set the Type of "L1", try using style, like this:

Code: Select all

set the style of graphic "L1" to "line"
Keep in mind that for a line, you need to have points so that it knows where to draw the line, so if you try that code and it disappears, you just need to add points, and you can do that by using the "points" property:

Code: Select all

set the points of graphic "L1" to "200,300"&cr&"180,72"
You need to have at least 2 points to make a line (I'm not sure if you can go with 3, I've never tested it :P), and you need to have each point on a new line, hence the use of cr :)

Hopefully this helps you out :)

Edit: I just tested it out, and you can have more than 2 points for a line graphic, as long as you've got each point on a new line :)!

Re: Changing graphic Type

Posted: Fri Apr 29, 2016 4:38 pm
by DavJans
Thank you, I'll try it out, You can have as many points as you want, I have a line graph already made that works, but I had to create each line manually before I could set the point in it. I just couldn't figure out how to create the line in the first place using code.

Re: Changing graphic Type

Posted: Fri Apr 29, 2016 6:09 pm
by dunbarx
A line can indeed have more than two points, and it will still be a line, though one might think it looks just like a polyLine.

Also, check out the "create" command to make new controls. And then play around with the "templateGraphic"

Craig Newman