Platforms to show: All Mac Windows Linux Cross-Platform
/ChartDirector/High Resolution Chart Examples/softlightbar
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/softlightbar
This example is the version from Sun, 17th Mar 2012.
Project "softlightbar.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()
const f=4 // scale factor, 1 for screen and 4 or more for printing
// The data for the bar chart
dim data(-1) as double = array(450.0, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700)
// The labels for the bar chart
dim labels(-1) as string =array( "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005")
// Create a XYChart object of size 600 x 360 pixels
dim c as new CDXYChartMBS(f*600, f*360)
// Add a title to the chart using 18pts Times Bold Italic font
call c.addTitle("Annual Revenue for Star Tech", "timesbi.ttf", f*18)
// Set the plotarea at (60, 40) and of size 500 x 280 pixels. Use a vertical
// gradient color from light blue (eeeeff) to deep blue (0000cc) as background.
// Set border and grid lines to white (ffffff).
dim p as CDPlotAreaMBS= c.setPlotArea(f*60, f*40, f*500, f*280, c.linearGradientColor(f*60, f*40, f*60, f*280, &heeeeff, &h0000cc), -1, &hffffff, &hfffff)
p.setGridWidth f
// Add a multi-color bar chart layer using the supplied data. Use soft lighting
// effect with light direction from left.
dim b as CDBarLayerMBS
dim colors(-1) as integer
b=c.addBarLayer(data,colors)
b.setBorderColor(c.kTransparent, c.softLighting(c.kLeft))
// Set x axis labels using the given labels
call c.xAxis.setLabels(labels)
c.yAxis.setLinearScale 0, 3000, 500
// Draw the ticks between label positions (instead of at label positions)
c.xAxis.setTickOffset(0.5)
// Add a title to the y axis with 10pts Arial Bold font
call c.yAxis.setTitle("USD (millions)", "arialbd.ttf", f*10)
// Set axis label style to 8pts Arial Bold
call c.xAxis.setLabelStyle("arialbd.ttf", f*8)
call c.yAxis.setLabelStyle("arialbd.ttf", f*8)
// Set axis line width to 2 pixels
c.xAxis.setWidth(f*2)
c.yAxis.setWidth(f*2)
c.xAxis.setTickWidth(f*2)
c.xAxis.setTickLength(f*4)
c.yAxis.setTickWidth(f*1)
c.yAxis.setTickLength(f*4)
Backdrop=c.makeChartPicture
Width=f*600
Height=f*360
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
See also:
- /ChartDirector/High Resolution Chart Examples/cone
- /ChartDirector/High Resolution Chart Examples/legendpie2
- /ChartDirector/High Resolution Chart Examples/multivmeter
- /ChartDirector/High Resolution Chart Examples/polarzones
- /ChartDirector/High Resolution Chart Examples/pyramidrotation
- /ChartDirector/High Resolution Chart Examples/squareameter
- /ChartDirector/High Resolution Chart Examples/surface
- /ChartDirector/High Resolution Chart Examples/surfaceshading
- /ChartDirector/High Resolution Chart Examples/surfacewireframe
- /ChartDirector/High Resolution Chart Examples/threeddonutshading
The items on this page are in the following plugins: MBS ChartDirector Plugin.