Example: /ChartDirector/yzonecolor extreme

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/yzonecolor extreme


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/yzonecolor extreme

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

Project "yzonecolor extreme.xojo_binary_project"
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 chart dim data(-1) as double = array(30, 28, 40, 55, 75, 68, 54, 60, 50, 62, 75, 65, 75, 89, 60, 55, 53, 35, 50, 66, 56, 48, 52, 65, 62.0) // The labels for the 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 500 x 300 pixels, with a pale yellow // (&hffffc0) background, a black border, and 1 pixel 3D border effect dim c as new CDXYChartMBS(500, 330, &hffffc0, &h000000, 1) // Set the plotarea at (55, 50) and of size 420 x 205 pixels, with white // background. Turn on both horizontal and vertical grid lines with light grey // color (&hc0c0c0) c.setPlotArea(55, 50, 420, 205, &hffffff).setGridColor(&hc0c0c0, &hc0c0c0) // Add a legend box at (55, 25) (top of the chart) with horizontal layout. Use 8 // pts Arial font. Set the background and border color to Transparent. dim legendBox as CDLegendBoxMBS legendBox = c.addLegend(55, 25, false, "", 8) legendBox.setBackground(CDXYChartMBS.kTransparent) // Add keys to the legend box to explain the color zones legendBox.addKey("Normal Zone", &h8033FF33) legendBox.addKey("Alert Zone", &h80FF3333) // Add a title box to the chart using 13 pts Arial Bold Italic font. The title is // in CDML and includes embedded images for highlight. The text is white // (&hffffff) on a black background, with a 1 pixel 3D border. dim path as string path=c.GetPath(FindFile("star.png")) c.addTitle("<*block,valign=absmiddle*><*img="+path+"*><*img="+path+"*> Y Zone Color Demo <*img="+path+"*><*img="+path+"*><*/*>", "arialbi.ttf", 13, &hffffff).setBackground(&h000000, -1, 1) // Add a title to the y axis call c.yAxis.setTitle("Energy Concentration (KJ per liter)") // 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 a title to the x axis using CDML call c.xAxis.setTitle("<*block,valign=absmiddle*><*img="+c.GetPath(FindFile("clock.png"))+"*> Elapsed Time (hour)<*/*>") // Set the axes width to 2 pixels c.xAxis.setWidth(2) c.yAxis.setWidth(2) dim c1 as integer = c.yZoneColor(10, &h80FF3333, &h80EE4433) dim c2 as integer = c.yZoneColor(20, c1, &h80CC5533) dim c3 as integer = c.yZoneColor(30, c2, &h80AA7733) dim c4 as integer = c.yZoneColor(40, c3, &h80888833) dim c5 as integer = c.yZoneColor(50, c4, &h8077AA33) dim c6 as integer = c.yZoneColor(60, c5, &h8066CC33) dim c7 as integer = c.yZoneColor(70, c6, &h8044EE33) dim c8 as integer = c.yZoneColor(80, c7, &h8033FF33) call c.addAreaLayer(data, c8) // Add a custom CDML text at the bottom right of the plot area as the logo c.addText(475, 255,"<*block,valign=absmiddle*><*img="+c.GetPath(FindFile("small_molecule.png"))+"*> <*block*><*font=timesbi.ttf,size=10,color=804040*>Molecular"+endofline.unix+"Engineering<*/*>").setAlignment(CDXYChartMBS.kBottomRight) // 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

See also:

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


💬 Ask a question or report a problem