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

Continued from here.

To finish this, I want to add some effects, and save it as a png file.

Adding shadows
To add shadows behind each bar, just add the Shadowed argument to each bar. Example:

DiagramBar #ff0000 X:25  Y:0 W:20 H:200 Label="Apples"  Value="1" Shadowed

Adding gradient background
To give the image a gradient background, replace the color argument with a VGrad or HGrad. VGrad does a vertical gradient and HGrad does a horizontal. Example:

The changes I have made is marked with bold font.

//Set image size and background color.
Clear 400x300 VGrad:#d0d0d0-#f0f0f0

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

//Create 5 bars.
DiagramBar #ff0000 X:25  Y:0 W:20 H:200 Label="Apples"  Value="1" Shadowed
DiagramBar #00ff00 X:95  Y:0 W:20 H:50  Label="Pears"   Value="2" Shadowed
DiagramBar #0000ff X:165 Y:0 W:20 H:150 Label="Oranges" Value="3" Shadowed
DiagramBar #ff00ff X:235 Y:0 W:20 H:180 Label="Peaches" Value="4" Shadowed
DiagramBar #f2f200 X:305 Y:0 W:20 H:100 Label="Grapes"  Value="5" Shadowed

This is the result:

If your pictures didn’t come out as expected, you can check the error log in the View window. This video shows these steps. Also, the png export feature is shown.

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

Leave a Reply

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