Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/chains and bars
Required plugins for this example: MBS ChartDirector Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /ChartDirector/chains and bars
This example is the version from Sun, 23th Sep 2017.
Project "chains and bars.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() // The data for the bar chart dim data(-1) as double = array(1.0, 0.6, 1.3, 1.6, 1.0) dim i,count as integer dim data1(-1) as double count=UBound(Data) data1.Append data(0) for i=1 to count data1.Append CDXYChartMBS.kNoValue data1.Append CDXYChartMBS.kNoValue data1.Append CDXYChartMBS.kNoValue data1.Append data(i) next // Create a XYChart object of size 600 x 250 pixels dim c as new CDXYChartMBS(600, 600) // Add a title to the chart using Arial Bold Italic font call c.addTitle("Noten", "arialbi.ttf") // Set the plotarea at (100, 30) and of size 400 x 200 pixels. Set the plotarea // border, background and grid lines to Transparent call c.setPlotArea(100, 30, 400, 540) // Add a bar chart layer using the given data. Use a gradient color for the bars, // where the gradient is from dark green (0x008000) to white (0xffffff) dim layer as CDBarLayerMBS layer = c.addBarLayer(data1,c.gradientColor(100, 0, 500, 0, &h008000, &hffffff)) layer.setBarWidth 5 // Swap the axis so that the bars are drawn horizontally c.swapXY(true) // Set the labels on the x axis dim textbox as CDTextBoxMBS textbox = c.xAxis.setLabels(data1) c.xAxis.setLabelStep 1 // Set the x axis label font to 10pt Arial Bold Italic textbox.setFontStyle("arialbi.ttf") textbox.setFontSize(10) for i=0 to count-1 // Add a spline layer to the chart dim layer2 as CDSplineLayerMBS layer2 = c.addSplineLayer dim data2(-1) as double data2.Append CDXYChartMBS.kNoValue dim j as integer for j=1 to count data2.Append CDXYChartMBS.kNoValue data2.Append CDXYChartMBS.kNoValue data2.Append CDXYChartMBS.kNoValue data2.Append CDXYChartMBS.kNoValue next dim b as double const a=1.0 // CosHMBS is in the MBS Xojo Util Plugin b=a*CosHMBS(-1.0/a) data2(i*4+0)=a*CosHMBS(-1.0/a)-b+(data(i)*4.0+data(i+1)*0.0)/4.0 data2(i*4+1)=a*CosHMBS(-0.5/a)-b+(data(i)*3.0+data(i+1)*1.0)/4.0 data2(i*4+2)=a*CosHMBS(0-0/a)-b+(data(i)*2.0+data(i+1)*2.0)/4.0 data2(i*4+3)=a*CosHMBS(0.5/a)-b+(data(i)*1.0+data(i+1)*3.0)/4.0 data2(i*4+4)=a*CosHMBS(1.0/a)-b+(data(i)*0.0+data(i+1)*4.0)/4.0 // Set the default line width to 2 pixels layer2.setLineWidth(2) // Add a data set to the spline layer, using blue (0000c0) as the line color, call layer2.addDataSet(data2, &h0000c0) next Backdrop=c.makeChartPicture End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

Feedback, Comments & Corrections

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

The biggest plugin in space...

MBS Xojo PDF Plugins

Start Chat