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/fontpie
This example is the version from Thu, 6th Apr 2016.
Project "fontpie.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(25.0, 18, 15, 12, 8, 30, 35) // The labels for the pie chart dim labels(-1) as string=array("Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities", "Production") // Create a PieChart object of size 480 x 300 pixels dim c as new CDPieChartMBS(480, 300) // Use a blue marble pattern as the background wallpaper, with a black border, // and 1 pixel 3D border effect c.setBackground(c.patternColor(FindFile("marble.png")), &h000000, 1) // Set the center of the pie at (150, 150) and the radius to 100 pixels c.setPieSize(150, 150, 100) // Add a title to the pie chart using Times Bold Italic/15 points/deep blue // (0x000080) as font, with a wood pattern as the title background dim t as CDTextBoxMBS t=c.addTitle("Project Cost Breakdown", "timesbi.ttf", 15, &h000080) t.setBackground(c.patternColor(FindFile("wood.png"))) // Draw the pie in 3D c.set3D // Add a legend box using Arial Bold Italic/11 points font. Use a pink marble // pattern as the background wallpaper, with a 1 pixel 3D border. The legend box // is top-right aligned relative to the point (465, 70) dim b as CDLegendBoxMBS b = c.addLegend(465, 70, true, "arialbi.ttf", 11) b.setBackground(c.patternColor(FindFile("marble2.png")), c.kTransparent, 1) b.setAlignment(c.kTopRight) // Set the default font for all sector labels to Arial Bold/8 pts/dark green // (0x008000). t=c.setLabelStyle("arialbd.ttf", 8, &h008000) // Set the pie data and the pie labels c.setData(data, labels) // Explode the 3rd sector c.setExplode(2, 40) // Use Arial Bold/12 pts/red as label font for the 3rd sector dim s as CDSectorMBS s=c.sector(2) t=s.setLabelStyle("arialbd.ttf", 12, &hff0000) // Use Arial/8 pts/deep blue as label font for the 5th sector. Add a background // box using the sector fill color (SameAsMainColor), with a black (0x000000) // edge and 2 pixel 3D border. s=c.sector(4) t=s.setLabelStyle("arial.ttf", 8, &h000080) t.setBackground(c.kSameAsMainColor, &h000000, 2) // Use Arial Italic/8 pts/light red (0xff9999) as label font for the 6th sector. // Add a dark blue (0x000080) background box with a 2 pixel 3D border. s=c.sector(0) t=s.setLabelStyle("ariali.ttf", 8, &hff9999) t.setBackground(&h000080, c.kTransparent, 2) // Use Times Bold Italic/8 pts/deep green (0x008000) as label font for 7th // sector. Add a yellow (0xFFFF00) background box with a black (0x000000) edge. s=c.sector(6) t=s.setLabelStyle("timesbi.ttf", 8, &h008000) t.setBackground(&hffff00,&h000000) // 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 Xojo Chart Plugins

Start Chat