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/donut
This example is the version from Sun, 17th Mar 2012.
Project "donut.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(20.0, 10, 15, 12)
// The labels for the pie chart
dim labels(-1) as string=array("Labor", "Licenses", "Facilities", "Production")
// Create a PieChart object of size 560 x 280 pixels, with a silver background,
// black border, 1 pxiel 3D border effect and rounded corners
dim c as new CDPieChartMBS(560, 280, CDPieChartMBS.silverColor, &H000000, 1)
c.setRoundedFrame
// Add a title box using 15 pts Times Bold Italic font in white color, on a deep
// blue (0000CC) background with reduced-glare glass effect
dim t as CDTextBoxMBS
t=c.addTitle("Donut Chart Demonstration", "timesbi.ttf", 15, &hffffff)
t.setBackground(&h0000cc, &h000000, c.glassEffect(c.kReducedGlare))
// Set donut center at (280, 140), and outer/inner radii as 110/55 pixels
c.setDonutSize(280, 140, 110, 55)
// Set 3D effect with 3D depth of 20 pixels
c.set3D(20)
// Set the label box background color the same as the sector color, with
// reduced-glare glass effect and rounded corners
t=c.setLabelStyle
t.setBackground(c.kSameAsMainColor, c.kTransparent, c.glassEffect(c.kReducedGlare))
t.setRoundedCorners
// Set the sector label format. The label consists of two lines. The first line
// is the sector name in Times Bold Italic font and is underlined. The second
// line shows the data value and percentage.
c.setLabelFormat("<*block,halign=left*><*font=timesbi.ttf,size=12,underline=1*>{label}<*/font*><*br*>US$ {value}K ({percent}%)")
// Set the pie data and the pie labels
c.setData(data,labels)
// Use the side label layout method
c.setLabelLayout(c.kSideLayout)
// Output the chart
Backdrop=c.makeChartPicture
End EventHandler
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.