Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/scatterlabels
Function:
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/scatterlabels
This example is the version from Sun, 17th Mar 2012.
Project "scatterlabels.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class PicWindow Inherits Window
EventHandler Sub Open() // The XY points for the scatter chart dim dataX(-1) as double = array(150, 400, 300, 1500, 800.0) dim dataY(-1) as double = array(0.6, 8, 5.4, 2, 4.0) // The labels for the points dim labels(-1) as string = array("Nano"+endofline.unix+"100", "SpeedTron"+endofline.unix+"200 Lite", "SpeedTron"+endofline.unix+"200", "Marathon"+endofline.unix+"Extra", "Marathon"+endofline.unix+"2000") // Create a XYChart object of size 450 x 400 pixels dim c as new CDXYChartMBS(450, 400) // Set the plotarea at (55, 40) and of size 350 x 300 pixels, with a light grey // border (&hc0c0c0). Turn on both horizontal and vertical grid lines with light // grey color (&hc0c0c0) call c.setPlotArea(55, 40, 350, 300, &hffffff, -1, &hc0c0c0, &hc0c0c0, -1) // Add a title to the chart using 18 pts Times Bold Itatic font. call c.addTitle("Product Comparison Chart", "timesbi.ttf", 18) // Add a title to the y axis using 12 pts Arial Bold Italic font call c.yAxis.setTitle("Capacity (tons)", "arialbi.ttf", 12) // Add a title to the x axis using 12 pts Arial Bold Italic font call c.xAxis.setTitle("Range (miles)", "arialbi.ttf", 12) // Set the axes line width to 3 pixels c.xAxis.setWidth(3) c.yAxis.setWidth(3) // Add the data as a scatter chart layer, using a 15 pixel circle as the symbol dim layer as CDScatterLayerMBS layer = c.addScatterLayer(dataX, dataY, "Server BBB", c.kCircleSymbol, 15, &hff3333, &hff3333) // Add labels to the chart as an extra field call layer.addExtraField(labels) // Set the data label format to display the extra field layer.setDataLabelFormat("{field0}") // Use 8pts Arial Bold to display the labels dim textbox as CDTextBoxMBS = layer.setDataLabelStyle("arialbd.ttf", 8) // Set the background to purple with a 1 pixel 3D border textbox.setBackground(&hcc99ff, CDXYChartMBS.kTransparent, 1) // Put the text box 4 pixels to the right of the data point textbox.setAlignment(CDXYChartMBS.kLeft) textbox.setPos(4, 0) // Output the chart Backdrop=c.makeChartPicture End EventHandler
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

Feedback, Comments & Corrections

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




Links
MBS Xojo PDF Plugins