Platforms to show: All Mac Windows Linux Cross-Platform
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/wafermap
This example is the version from Fri, 9th Feb 2023.
Project "wafermap.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
EventHandler Sub Open()
// The diameter of the wafer
Const diameter = 20
Dim radius As Double = diameter / 2.0
// The random data array are for a square grid of 20 x 20 cells
Dim r As New CDRanSeriesMBS(2)
Dim zData() As Double = r.get2DSeries(diameter, diameter, 0, 100)
// We remove cells that are outside the wafer circle by setting them to NoValue
For i As Integer = 0 To zData.ubound
Dim x As Double = (i Mod diameter) + 0.5
Dim y As Double = (i - x) / diameter + 0.5
If ((x - radius) * (x - radius) + (y - radius) * (y - radius) > radius * radius) Then
// out of wafer, so clear value
zData(i) = CDBaseChartMBS.kNoValue
end if
Next
// Create an XYChart object of size 520 x 480 pixels.
Dim c As New CDXYChartMBS(520, 480)
// Add a title the chart with 15pt Arial Bold font
Call c.addTitle("Wafer Map Demonstration", "Arial Bold", 15)
// Set the plotarea at (50, 40) and of size 400 x 400 pixels. Set the backgound and border to
// transparent. Set both horizontal and vertical grid lines to light grey. (&hdddddd)
Dim p As CDPlotAreaMBS =c.setPlotArea(50, 40, 400, 400, -1, -1, CDBaseChartMBS.kTransparent, &hdddddd, &hdddddd)
// Create a discrete heat map with 20 x 20 cells
Dim layer As CDDiscreteHeatMapLayerMBS = c.addDiscreteHeatMapLayer(zData, diameter)
// Set the x-axis scale. Use 8pt Arial Bold font. Set axis color to transparent, so only the
// labels visible. Set 0.5 offset to position the labels in between the grid lines.
c.xAxis.setLinearScale(0, diameter, 1)
Call c.xAxis.setLabelStyle("Arial Bold", 8)
c.xAxis.setColors(CDBaseChartMBS.kTransparent, CDBaseChartMBS.kTextColor)
c.xAxis.setLabelOffset(0.5)
// Set the y-axis scale. Use 8pt Arial Bold font. Set axis color to transparent, so only the
// labels visible. Set 0.5 offset to position the labels in between the grid lines.
c.yAxis.setLinearScale(0, diameter, 1)
Call c.yAxis.setLabelStyle("Arial Bold", 8)
c.yAxis.setColors(CDBaseChartMBS.kTransparent, CDBaseChartMBS.kTextColor)
c.yAxis.setLabelOffset(0.5)
// Position the color axis 20 pixels to the right of the plot area and of the same height as the
// plot area. Put the labels on the right side of the color axis. Use 8pt Arial Bold font for
// the labels.
Dim cAxis As CDColorAxisMBS = layer.setColorAxis(p.getRightX + 20, p.getTopY, CDBaseChartMBS.kTopLeft, p.getHeight, CDBaseChartMBS.kRight)
call cAxis.setLabelStyle("Arial Bold", 8)
// 2x for higher DPI displays
c.setOutputOptions("bmpscale=2")
// Output the chart
pic = c.makeChartPicture
// drawn in paint event
End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
If pic <> Nil Then
// scale to window
g.DrawPicture pic, 0, 0, g.Width, g.Height, 0, 0, pic.Width, pic.Height
End If
End EventHandler
Property pic As Picture
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS ChartDirector Plugin.