Example: /ChartDirector/iconpie

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/iconpie


Required plugins for this example: MBS ChartDirector Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /ChartDirector/iconpie

This example is the version from Thu, 6th Apr 2016.

Project "iconpie.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class PicWindow Inherits Window
EventHandler Sub Open() // The data for the pie chart dim data(-1) as double = array( 72.0, 18, 15, 12) // The depths for the sectors dim depths(-1) as double = array(30.0, 20, 10, 10) // The labels for the pie chart dim labels(-1) as string=array("Sunny", "Cloudy", "Rainy", "Snowy") // The icons for the sectors dim icons(-1) as FolderItem icons.append FindFile("sun.png") icons.append FindFile("cloud.png") icons.append FindFile("rain.png") icons.append FindFile("snowy.png") // Create a PieChart object of size 400 x 310 pixels, with a blue (CCCCFF) // vertical metal gradient background, black border, 1 pixel 3D border effect and // rounded corners dim c as new CDPieChartMBS(400, 310, CDPieChartMBS.metalColor(&hccccff, 0), &h000000, 1) c.setRoundedFrame // Set the center of the pie at (200, 180) and the radius to 100 pixels c.setPieSize(200, 180, 100) // Add a title box using 15 pts Times Bold Italic font, on a blue (CCCCFF) // background with glass effect dim t as CDTextBoxMBS t=c.addTitle("Weather Profile in Wonderland", "timesbi.ttf", 15) t.setBackground(&hccccff, &h000000, c.glassEffect) // Set the pie data and the pie labels c.setData data,labels // Add icons to the chart as a custom field c.addExtraField(icons) // Configure the sector labels using CDML to include the icon images c.setLabelFormat("<*block,valign=absmiddle*><*img={field0}*> <*block*>{label}"+EndOfLine.UNIX+"{percent}%<*/*><*/*>") // Draw the pie in 3D with variable 3D depths c.set3D depths // Set the start angle to 225 degrees may improve layout when the depths of the // sector are sorted in descending order, because it ensures the tallest sector // is at the back. c.setStartAngle(225) // Output the chart Backdrop=c.makeChartPicture End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

The items on this page are in the following plugins: MBS ChartDirector Plugin.


💬 Ask a question or report a problem