Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/simpletreemap


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

This example is the version from Fri, 9th Feb 2023.

Project "simpletreemap.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
EventHandler Sub Open() // Data for the tree map Dim data() As Double = Array(25.0, 18, 15, 12, 8, 30, 35) // Labels for the tree map Dim labels() As String = Array("Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta") // Colors for the tree map Dim colors() As Integer = Array( CType(&hff5555, Integer), &hff9933, &hffff44, &h66ff66, &h44ccff, &h6699ee, &hdd99dd) // Create a Tree Map object of size 400 x 400 pixels Dim c As New CDTreeMapChartMBS(400, 400) // Set the plotarea at (10, 10) and of size 380 x 380 pixels c.setPlotArea(10, 10, 380, 380) // Obtain the root of the tree map, which is the entire plot area Dim root As CDTreeMapNodeMBS = c.RootNode // Add first level nodes to the root. root.setData(data, labels, colors) // Get the prototype (template) for the first level nodes. Dim nodeConfig As CDTreeMapNodeMBS = c.getLevelPrototype(1) // Set the label format for the nodes to show the label and value with 8pt Arial Bold font in // black color (000000) and center aligned in the node. nodeConfig.setLabelFormat("{label}<*br*>{value}", "Arial Bold", 8, &h000000, CDBaseChartMBS.kCenter) // Set the node fill color to the provided color and the border color to white (ffffff) nodeConfig.setColors(-1, &hffffff) // 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.


The biggest plugin in space...