Jump to content




[Bedrock] Pie Object(Also with circles Very Customizable)


1 reply to this topic

#1 Elsys656

  • Members
  • 17 posts

Posted 18 March 2015 - 06:06 AM

This is a pie chart object with multiple slices of various colours filled or unfilled circles

Requirements:
Circle.lua

Installation:
  • Copy code in spoiler to a file named Circle.lua place that in Objects folder of the CC Computer you wish to use it on
Features:
  • Filled or Unfilled circles of various colours simply initialize a Circle object to see the default blue unfilled circle
  • Pie charts containing one or more sections of various colour with optional percentage labels also with custom colour
  • Unfilled pie charts resulting in a rainbow circle(For whatever reason just wanted to keep that cause it seemed useful for something kinda like a Conkey Widget
Useage:

Create an Object in your View file of Type="Circle" or AddObject

Select a Subtype default is Circle if omitted

Subtype="Circle" or "Pie"

Set Colours for Text with

TextColour

Set Colours for subtype Circle with

ActiveColour

Set the Colour used to fill whatever is left of the Pie with

BackgroundColour

Whether or not to fill the Circle/Pie

Filled=true or false

The size of the Circle/Pie

Radius=# Max viewable by width is 22 Max viewable by Height is 8

Note:

DO NOT SET HEIGHT OR WIDTH UNLESS YOU WANT TO INTENTIONALLY CLIP THE CIRCLE

The setup for a pie is a little different if you want a single slice Pie you can do

Spoiler

If you want multiple slices you need to create a Percentages Table of the following format and assign it to
{
Percentages={
Percentage=# between 1-100,
Colour= A Colour string or CC colour
}
}
--[[add more associative tables for each slice
REMEMBER THAT IF YOU ADD SLICES AMOUNTING TO OVER 100 ANY THAT MAKE THE TOTAL GREATER THAN 100 WILL NOT BE DRAWN]]
program:GetObject('testCircle').Percentages = myTable

Screenshots:
Spoiler
Hope you enjoy it and find it useful, I'm going to possibly add Ellipses in the future and fill percentage say if you want a 2 pixel outline rather than one etc.

#2 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 18 March 2015 - 07:07 AM

Very cool ideed! It's nice to see you're liking Bedrock.

May I suggest the ability to make it square (as in 1.5 times wider than it is high), although the ellipses function should do that.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users