Platforms to show: All Mac Windows Linux Cross-Platform

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/iconpie2
This example is the version from Thu, 6th Apr 2016.
Project "iconpie2.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 (28.0, 45, 5, 1, 12) // The labels for the pie chart dim labels(-1) as string = array( "Excellent", "Good", "Bad", "Very Bad", "Neutral") // The icons for the sectors dim icons(-1) as FolderItem icons.append FindFile("laugh.png") icons.append FindFile("smile.png") icons.append FindFile("sad.png") icons.append FindFile("angry.png") icons.append FindFile("nocomment.png") // Create a PieChart object of size 560 x 300 pixels, with a silver background, // black border, 1 pxiel 3D border effect and rounded corners dim c as new CDPieChartMBS(560, 300, CDPieChartMBS.silverColor, &h000000, 1) c.setRoundedFrame // Set the center of the pie at (280, 150) and the radius to 120 pixels c.setPieSize(280, 150, 120) // Add a title box with title written in CDML, on a sky blue (A0C8FF) background // with glass effect dim t as CDTextBoxMBS t=c.addTitle("<*block,valign=absmiddle*><*img="+c.GetPath(FindFile("doc.png"))+"*> Customer Survey: <*font=timesi.ttf,color=000000*>Do you like our <*font,color=dd0000*>Hyper<*super*>TM<*/font*> molecules?", "timesbi.ttf", 15, &h000080) t.setBackground(&ha0c8ff, &h000000, c.glassEffect) // Add a logo to the chart written in CDML as the bottom title aligned to the // bottom right call c.addTitle(c.kBottomRight,"<*block,valign=absmiddle*><*img="+c.GetPath(FindFile("molecule.png"))+"*> <*block*><*color=FF*><*font=timesbi.ttf,size=12*>Molecular Engineering"+EndOfLine.UNIX+"<*font=arial.ttf,size=10*>Creating better molecules") // Set the pie data and the pie labels c.setData(data,labels) // Set 3D style c.set3D // Use the side label layout method c.setLabelLayout(c.kSideLayout) // Set the label background color to transparent t=c.setLabelStyle t.setBackground(c.kTransparent) // 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}*> {label} ({percent|0}%)") // Explode the 3rd and 4th sectors as a group (index = 2 and 3) c.setExplodeGroup(2, 3) // Set the start angle to 135 degrees may improve layout when there are many // small sectors at the end of the data array (that is, data sorted in descending // order). It is because this makes the small sectors position near the // horizontal axis, where the text label has the least tendency to overlap. For // data sorted in ascending order, a start angle of 45 degrees can be used // instead. c.setStartAngle(135) // 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

Feedback, Comments & Corrections

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

The biggest plugin in space...

MBS FileMaker Plugins

Start Chat