Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/icondonut


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/icondonut

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

Project "icondonut.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, 18, 15, 12.0) // The depths for the sectors dim depths(-1) as double = array(30, 20, 10, 10.0) // 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 300 pixels dim c as new CDPieChartMBS(400, 300) // Use the semi-transparent palette for this chart c.settransparentcolors // Set the background to metallic light blue (CCFFFF), with a black border and 1 // pixel 3D border effect, c.setBackground(c.metalColor(&hccccff), &h000000, 1) // Set donut center at (200, 175), and outer/inner radii as 100/50 pixels c.setDonutSize(200, 175, 100, 50) // Add a title box using 15 pts Times Bold Italic font and metallic blue (8888FF) // background color dim t as CDTextBoxMBS t=c.addTitle("Weather Profile in Wonderland", "timesbi.ttf", 15) t.setBackground(c.metalColor(&h8888ff)) // 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.


The biggest plugin in space...