Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/patternarea


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/patternarea

This example is the version from Thu, 6th Apr 2016.

Project "patternarea.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 area chart dim data(-1) as double=array(3.0, 2.8, 4.0, 5.5, 7.5, 6.8, 5.4, 6.0, 5.0, 6.2, 7.5, 6.5, 7.5, 8.1, 6.0, 5.5, 5.3, 3.5, 5.0, 6.6, 5.6, 4.8, 5.2, 6.5, 6.2) // The labels for the area chart dim labels(-1) as string = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24") // Create a XYChart object of size 300 x 180 pixels. Set the background to pale // yellow (&hffffa0) with a black border (&h0) dim c as new CDXYChartMBS(300, 180, &hffffa0, &h000000) // Set the plotarea at (45, 35) and of size 240 x 120 pixels. Set the background // to white (&hffffff). Set both horizontal and vertical grid lines to black // (&H0&) dotted lines (pattern code &h0103) call c.setPlotArea(45, 35, 240, 120, &hffffff, -1, -1, c.dashLineColor(&h000000, &h000103), c.dashLineColor(&h000000, &h000103)) // Add a title to the chart using 10 pts Arial Bold font. Use a 1 x 2 bitmap // pattern as the background. Set the border to black (&h0). dim pattern1(1) as integer pattern1(0)=&hb0b0f0 pattern1(1)=&he0e0ff dim textbox as CDTextBoxMBS textbox= c.addTitle("Snow Percipitation (Dec 12)", "arialbd.ttf", 10) textbox.setBackground(c.patternColor(pattern1, 2),&h000000) // Add a title to the y axis call c.yAxis.setTitle("mm per hour") // Set the labels on the x axis. call c.xAxis.setLabels(labels) // Display 1 out of 3 labels on the x-axis. c.xAxis.setLabelStep(3) // Add an area layer to the chart dim layer as CDAreaLayerMBS layer = c.addAreaLayer // Load a snow pattern from an external file "snow.png". dim snowPattern as integer snowPattern = c.patternColor(FindFile("snow.png")) // Add a data set to the area layer using the snow pattern as the fill color. Use // deep blue (&h0000ff) as the area border line color (&H0000ff&) layer.addDataSet(data).setDataColor(snowPattern, &h0000ff) // Set the line width to 2 pixels to highlight the line layer.setLineWidth(2) // Output the chart Backdrop=c.makeChartPicture End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
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.


The biggest plugin in space...