Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 10:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Pie Charts
PostPosted: April 5th, 2012, 3:41 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi Everyone,

Has anyone used OpusScript to draw a pie chart with different segments?



Thanks

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Pie Charts
PostPosted: April 5th, 2012, 4:51 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Just for anyone doing bar charts, this is the code for doing a horizontal bar chart:

On Show:
Code:
var pos = this.GetObjectDimensions()
XPos = pos.left
YPos = pos.top

Frame_HorBar.SetLineStyle(0)
Frame_HorBar.SetFillColour(0,156,70)
Frame_HorBar.DrawRectangle(XPos,YPos,BarChartOne*3,30)


On Var Change - BarChartOne:
Code:
Frame_HorBar.ClearDraw()
Frame_HorBar.DrawRectangle(XPos,YPos,BarChartOne*3,30)


The frame Frame_HorBar is 300 wide by 30 high. That is the reason BarChartOne is multiplied by 3, to fill it as percent.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Pie Charts
PostPosted: April 10th, 2012, 7:49 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Imc,
...an interesting challenge. Of course, there could be some clever ways to do this with scripting of the draw command. But that seems like heavy-lifting work to me.

For a limited scope of graphing, you could do cloning and some layered masking (e.g., using rotated frames to create the boundaries.).

But if your goal is simple enough, look at using Opus' built-in Borders (segments) Maybe you can achieve something useful with those. A little more definition of the goal and what you are working with will help attract answers.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Pie Charts
PostPosted: April 10th, 2012, 9:16 am 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Thanks Lar,

It would be for pulling data from a database or from online and displaying it on a pie chart with multiple segments in different colours, their size dynamic and dependent on the variables, also range of segments would range from 2 to 12.

Using the drawing tools I can draw circles, and lines, but getting it to draw arc segments is proving a challenge.




Thanks

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Pie Charts
PostPosted: April 10th, 2012, 12:19 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
There's a built-in example of a bar chart in Opus' exemplars.

As for drawing a pie chart, I don't see why not. You'd probably have to draw it manually as I think the ellipse function doesn't allow you to specify the size of the segment. Look at using polar co-ordinates.

Alternatively, to do it without mathematics, you could create the segments in a graphics or vector application and simply clone them with appropriate rotation. Or perhaps just a single 1° line that is cloned and rotated x times for each segment might work.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Pie Charts
PostPosted: April 10th, 2012, 9:16 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Here's a pie graph made by cloning and rotating a line around a point. Made it back in 2005 :-)
The black square with a hole in it is a mask that hides the rough edges of the circle. The line under the mask is only there for testing purposes. Move it off screen when using. Change the colour of the mask to match the background.

You could probably use circle sectors instead of lines; then control layering and rotation overlap to give the correct pie appearance...

cheers
Paul


You do not have the required permissions to view the files attached to this post.


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 49 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group