LiveCode
  • Why LiveCode?
  • Customers
  • Resources
  • Education
  • Consulting
  • Pricing
  • Blog
  • Login
  • Try LiveCode
Back to
  • slides
  • tutorial

Planning the Widget

Topic Progress:
← Back to Lesson

Pie Chart Examples

Everyone is familiar with pie charts, but before we start implementing the pie chart widget we’ll look at a couple of examples.

Google Docs

pie1

Libre Office

pie2

The Pie Chart information

There are 2 main pieces of information required to draw the pie chart

  • List of values
  • Labels associated with each value

In the examples we looked at, the value and labels were:

  • January = 1
  • February = 2
  • March = 3
  • April  = 5
  • May = 8
  • June = 13

The Pie Chart layout

The usual layout for pie charts is to have

  • Chart on the left
  • List of labels on the right

Because the user can resize the widget there are some considerations for us

  • Ensure the labels are shown
  • Make the pie chart the maximum size while showing all the labels
  • If the widget is taller than it is wide display the labels below the chart
  • Allow the user to choose whether to show the labels or not, to provide flexibility within apps

pie3pie4pie5

Pie Chart properties and messages

Through planning our widget we have identified 3 properties the widget needs

  • List of values
  • List of labels
  • Boolean value specifying whether the labels should be shown or not

We also want the widgets to respond to user actions. We could simply provide a mouseUp message but for a pie chart this is not particularly informative. Instead a useful message would tell the user that the chart had been clicked, and which sector was clicked on. So we will send a message with a parameter

  • sectorClicked pSectorNumber

The colors used for sectors will be assigned by the widget. A possible extension of the widget would be to make these colors settable by the user.

← Previous Topic

← Previous Topic Next Topic →
  •  
  •  
  • (0)
  •  

Expand All | Collapse All
Lessons Status
1 - Hello World Library
  • Introduction
  • Installing a Text Editor
  • Creating an LCB library
  • LCB library definition
  • LCB handler definitions
  • Compiling and testing a library in LiveCode
  • LCB metadata
  • Installing an LCB Library
  • Packaging and sharing an LCB library
  • Including an LCB library in a standalone
  • Conclusion
2 - Extended Hello World Library
  • Introduction
  • Explicit Types
  • LCB Lists and Arrays
  • Type Conversion between LCB and LiveCode Script
  • Using Explicit Typing in the Library
  • Passing Parameters to the Library
  • Using Lists in the Library
  • Documenting the Library
  • Browsing the Documentation
  • Conclusion
3 - Rotated Text Widget
  • Introduction
  • Defining a Widget
  • LCB Module Level Variables
  • Widget Properties
  • Widget Handlers
  • LCB Canvas Operations
  • Compiling and Testing the Widget
  • Installing the Widget and adding it to a Stack
  • Including the Widget in a Standalone
  • Conclusion
4 - Extended Rotated Text Widget
  • Introduction
  • Integrating Properties
  • Accessing LiveCode Control Properties
  • Handling Mouse Events
  • Saving and Loading Widgets
  • Read Only Properties
  • Documenting the Widget
  • Conclusion
5 - Pie Chart Widget
  • Introduction
  • Planning the Widget
  • Widget Properties
  • The OnCreate Handler
  • The OnPaint Handler
  • Responding to Mouse Events
  • Saving and Loading the Widget
  • Installing and Including the Widget in a Standalone
  • Documenting the Widget
  • Conclusion
6 - Modifying the Line Graph Widget
  • Introduction
  • Duplicating the Line Graph Widget
  • Additional Color Properties
  • Filling the area below the line
  • Adding graph marker mouse events
  • Conclusion
7 - Additional Resources
  • Extending LiveCode Guide
  • LiveCode Builder Language Reference
  • LiveCode Builder Style Guide
  • LiveCode Documentation Format
 
There are no available downloads for this topic.
 

Login

LiveCode

  • Why LiveCode?
  • Pricing
  • Customer Stories
  • Extensions
  • LiveCode in Education
  • LiveCode in Business

Looking for LiveCode FileMaker?

LiveCode for FM

Resources

  • Docs
  • API (Language Dictionary)
  • Lessons
  • Sample Stacks
  • Forums
  • Stackoverflow
  • User Groups
  • Support
  • Directory
  • LiveCode Services

About

  • About
  • Meet The Team
  • Careers at LiveCode
  • Contact us

Recent Posts

  • LiveCode 10.0.3 rc-2: Play Store Compatibility
  • Android Support Updated, New Create Preview Release
  • 2 Releases: Deployment Begins With DP-7
  • LiveCode Classic 10.0.1 Stable and 10.0.2-rc-1 Released
  • Create Progress – the Three D’s
Sitemap
Terms Privacy Policy EULA
Brought to you by LiveCode Ltd, Registered in Scotland, No. SC200728