Startsidan  ▸  Texter  ▸  Teknikblogg

Anders Hesselbom

Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.

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

2009-11-01

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.

Categories: General

Tags: Monkeybone

One response to “Monkeybone: Creating a bar diagram using Notepad part 2/4”

  1. […] text. These files can be created by hand using any text editor, such as Notepad (shown here, here, here and […]

Leave a Reply

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



En kopp kaffe!

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Bjud på en kopp kaffe!

Om...

Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.

Hem   |   linktr.ee/hesselbom   |   winsoft.se   |   80tal.se   |   Filmtips