Warning: count(): Parameter must be an array or an object that implements Countable in /customers/5/2/b/winsoft.se/httpd.www/wp-includes/post-template.php on line 284

Monkeybone: Creating a bar diagram using Notepad part 2/4

Continued from here.

Bars can be added to a diagram using the DiagramBar instruction. DiagramBar differs from the Bar instruction in that it use a virtual coordinate system (from a previous Diagram instruction) with its zero position in the left bottom corner, as opposed to the image itself that has its zero position in the top left corner. Like the Bar instruction, the DiagramBar instruction takes a color, position and size. Adding these lines (bold) will create five bars on the diagram.

//Set image size and background color.
Clear 400x300 #e0e0e0

//Create a white diagram.
Diagram #ffffff X:25 Y:40 W:350 H:230

//Create 5 bars.
DiagramBar #ff0000 X:25  Y:0 W:20 H:200
DiagramBar #00ff00 X:95  Y:0 W:20 H:50
DiagramBar #0000ff X:165 Y:0 W:20 H:150
DiagramBar #ff00ff X:235 Y:0 W:20 H:180
DiagramBar #f2f200 X:305 Y:0 W:20 H:100

Your picture should now look like this.

Unlike the Bar instruction, the DiagramBar instruction does not understand the HFill or the VFill argument.

If you are doing this in notepad, you might want to make use of automatic X positioning. By changing the X position to X:Auto/5, Monkeybone calculates the X position for you, assuming that 5 bars will be added. I don’t recommend that you use this feature when you are automating the diagram creation, but it is a time saver when you are working with notepad. Just enter X:Auto/n where n is the total number of bars. Example:

DiagramBar #334455 X:Auto/2 Y:0 W:30 H:120
DiagramBar #556677 X:Auto/2 Y:0 W:30 H:130

Continued here.

One thought on “Monkeybone: Creating a bar diagram using Notepad part 2/4

Leave a Reply

Your email address will not be published. Required fields are marked *