Platforms to show: All Mac Windows Linux Cross-Platform
/ChartDirector/High Resolution Chart Examples/threeddonutshading
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/High Resolution Chart Examples/threeddonutshading
This example is the version from Sun, 17th Mar 2012.
Project "threeddonutshading.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
createChart(4, "threeddonutshading4")
End EventHandler
Protected Sub CreateChart(img as integer, filename as string)
const f=4 // scale factor, 1 for screen and 4 or more for printing
dim w as new PicWindow
w.Title=filename
// The data for the pie chart
dim data(-1) as double = array(18.0, 30, 20, 15)
// The colors to use for the sectors
dim colors(-1) as integer
colors.Append &h66aaee
colors.Append &heebb22
colors.Append &hbbbbbb
colors.Append &h8844ff
// Create a PieChart object of size 200 x 200 pixels. Use a vertical gradient
// color from blue (0000cc) to deep blue (000044) as background. Use rounded
// corners of 16 pixels radius.
dim c as new CDPieChartMBS(200*f, 200*f)
c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight(), &h0000cc, &h000044))
c.setRoundedFrame(&hffffff, 16*f)
// Set donut center at (100, 100), and outer/inner radii as 80/40 pixels
c.setDonutSize(100*f, 100*f, 80*f, 40*f)
// Set the pie data
c.setData(data)
// Set the sector colors
c.setColors(c.kDataColor, colors)
// Draw the pie in 3D with a pie thickness of 20 pixels
c.set3D(20*f)
// Demonstrates various shading modes
select case img
case 0
call c.addTitle("Default Shading", "bold", 12, &hffffff)
case 1
call c.addTitle("Flat Gradient", "bold", 12, &hffffff)
c.setSectorStyle(c.kFlatShading)
case 2
call c.addTitle("Local Gradient", "bold", 12, &hffffff)
c.setSectorStyle(c.kLocalGradientShading)
case 3
call c.addTitle("Global Gradient", "bold", 12, &hffffff)
c.setSectorStyle(c.kGlobalGradientShading)
case 4
call c.addTitle("Donut Chart", "bold", 12*f, &hffffff)
c.setSectorStyle(c.kConcaveShading)
case 5
call c.addTitle("Rounded Edge", "bold", 12, &hffffff)
c.setSectorStyle(c.kRoundedEdgeShading)
case 6
call c.addTitle("Radial Gradient", "bold", 12, &hffffff)
c.setSectorStyle(c.kRadialShading)
case 7
call c.addTitle("Ring Shading", "bold", 12, &hffffff)
c.setSectorStyle(c.kRingShading)
end Select
// Disable the sector labels by setting the color to Transparent
call c.setLabelStyle("", 8, c.kTransparent)
// Output the chart
w.Backdrop=c.makeChartPicture
w.top=50+220*(img\4)
w.left=220*(img mod 4)
w.Width=200*f
w.Height=200*f
w.show
End Sub
End Class
Class PicWindow Inherits Window
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
See also:
- /ChartDirector/High Resolution Chart Examples/contour
- /ChartDirector/High Resolution Chart Examples/legendpie2
- /ChartDirector/High Resolution Chart Examples/linefill
- /ChartDirector/High Resolution Chart Examples/multivmeter
- /ChartDirector/High Resolution Chart Examples/pyramidrotation
- /ChartDirector/High Resolution Chart Examples/smallsectorpie
- /ChartDirector/High Resolution Chart Examples/softlightbar
- /ChartDirector/High Resolution Chart Examples/squareameter
- /ChartDirector/High Resolution Chart Examples/surfaceshading
- /ChartDirector/High Resolution Chart Examples/surfacewireframe
The items on this page are in the following plugins: MBS ChartDirector Plugin.