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/texturedonut
This example is the version from Thu, 6th Apr 2016.
Project "texturedonut.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(18.0,45,28)
// The labels for the pie chart
dim labels(-1) as string=array("Marble", "Wood", "Granite")
// The icons for the sectors
dim texture(-1) as FolderItem
texture.append FindFile("marble3.png")
texture.append FindFile("wood.png")
texture.append FindFile("rock.png")
// Create a PieChart object of size 400 x 330 pixels, with a metallic green
// (88EE88) background, black border and 1 pixel 3D border effect
dim c as new CDPieChartMBS(400, 330, CDPieChartMBS.metalColor(&h88ee88), &h000000, 1)
// Set donut center at (200, 160), and outer/inner radii as 120/60 pixels
c.setDonutSize(200, 160, 120, 60)
// Add a title box using 15 pts Times Bold Italic font and metallic deep green
// (008000) background color
dim t as CDTextBoxMBS
t=c.addTitle("Material Composition", "timesbi.ttf", 15)
t.setBackground(c.metalColor(&h008000))
// Set the pie data and the pie labels
c.setData(data,labels)
// Set the colors of the sectors to the 3 texture patterns
c.setColor(c.kDataColor + 0, c.patternColor(texture(0)))
c.setColor(c.kDataColor + 1, c.patternColor(texture(1)))
c.setColor(c.kDataColor + 2, c.patternColor(texture(2)))
// Draw the pie in 3D with a 3D depth of 30 pixels
c.set3D(30)
// Use 12 pts Arial Bold Italic as the sector label font
call c.setLabelStyle("arialbi.ttf", 12)
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.