Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/threeddonut
Function:
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/threeddonut
This example is the version from Sun, 17th Mar 2012.
Project "threeddonut.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 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") // The colors to use for the sectors dim colors(-1) as integer colors.Append &h66aaee colors.Append &heebb22 colors.Append &hcccccc colors.Append &hcc88ff // Create a PieChart object of size 600 x 320 pixels. Use a vertical gradient // color from deep blue (000066) to blue (0000cc) as background. Use rounded // corners of 20 pixels radius. dim c as new CDPieChartMBS(600, 320) c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight, &h000066, &h0000cc)) c.setRoundedFrame(&hffffff, 20) // Add a title using 18 pts Times New Roman Bold Italic font in white (ffffff) // color. Set top/bottom margins to 8 pixels. dim title as CDTextBoxMBS = c.addTitle("Donut Chart Demonstration", "timesbi.ttf", 18, &hffffff) title.setMargin(0, 0, 8, 8) // Add a separator line in white color just under the title call c.addLine(10, title.getHeight, c.getWidth - 11, title.getHeight,&hffffff) // Set donut center at (300, 170), and outer/inner radii as 120/60 pixels c.setDonutSize(300, 170, 120, 60) // Draw the pie in 3D with a pie thickness of 25 pixels c.set3D(25) // Set the pie data and the pie labels c.setData(data, labels) // Set the sector colors c.setColors(CDPieChartMBS.kDataColor, colors) // Use local gradient shading for the sectors c.setSectorStyle(CDPieChartMBS.kLocalGradientShading) // Set sector border color to same as fill color. Set label join line color to // white (ffffff) c.setLineColor(CDPieChartMBS.kSameAsMainColor, &hffffff) // Use the side label layout method, with the labels positioned 16 pixels from // the donut bounding box c.setLabelLayout(CDPieChartMBS.kSideLayout, 16) // 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. call c.setLabelFormat("<*block,halign=left*><*font=timesbi.ttf,size=12,underline=1*>{label}<*/font*><*br*>US$ {value}K ({percent}%)") // Set the label box background color the same as the sector color. Use soft // lighting effect with light direction from right. Use rounded corners. dim t AS CDTextBoxMBS = c.setLabelStyle t.setBackground(CDPieChartMBS.kSameAsMainColor, CDPieChartMBS.kTransparent, CDPieChartMBS.softLighting(CDPieChartMBS.kRight)) t.setRoundedCorners // 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

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins