[LinuxFocus-icon]
LinuxFocus article number 344
http://linuxfocus.org

[Photo of the Author]
by Katja Socher
<katja(at)linuxfocus.org>

About the author:

Katja is the German editor of LinuxFocus. She likes Tux, computer graphics, film & photography, travelling, Montréal and the sea. Her homepage can be found here.

Dia, a diagram creation program

[face texture]

Abstract:

In this article we take a look at dia, a diagram creation program.

_________________ _________________ _________________

 

What is dia?

Dia is a program for drawing lots of different kind of diagrams. It starts where your presentation tool stops, providing you with all important forms and shapes for lots of specific tasks.
The latest version as of this writing is dia 0.93.
If you have worked with other graphical programs under Linux like e.g. The Gimp before you will find working with dia very easy and straightforward.

 

Creating a flowchart diagram

In order to give you an impression of dia let's look at how to create a simple flowchart. We will not describe all possibilities dia offers. If you go to the dia homepage at http://www.gnome.org/projects/dia/ you will find very good documentation for the options and possibilities mentioned and not mentioned here.
Start dia if you haven't started it already. Now you will get a toolbar.

[dia's toolbar]

Under File you can open a new file or an already existing one. You can have open as many diagrams as you wish and also copy/paste from one to the next is no problem. I find this very handy. If you want to reuse parts of an already existing diagram you can easily copy/paste, you can look at slightly different versions of the same diagram to see which you like best, if you have a complex diagram and don't want to work with layers you could design everything in several different diagrams and then copy/paste it together etc. in case it is needed in one diagram..
In our case we choose "new" to create a new diagram from scratch. After clicking "new" a new empty diagram opens and you can start working.
In the main menu below the one with "File" you find all kind of operations like adding text or several more general objects that are useful for all types of diagrams. Then if you click on the field that has "Assorted" as its default you get a pop up menu with all the areas dia offers special objects for. Of course you are not restricted to use only one set for your diagram but are free to mix them as much as you please. To get the shapes of a flowchart for our diagram we click on "flowchart" and all possible shapes become visible.
In the first phase of creating the diagram we can concentrate entirely on the content and the general layout of our chart. After we are satisfied with this we will make the changes for the final design.
In a simple diagram we only need the decision and predefined process boxes that we want to fill with text and connect through arrows. Click on the decision box in the flowchart objects toolbar and then on the empty diagram. In the diagram you work similar like in an image of The Gimp. Left clicking on an object selects it. By right clicking a menu with your options appears and by clicking the middle mouse button you sometimes also get some more options, e.g. you can change the properties of an object, flip it horizontally or vertically, add a corner/ a segment to a line/curve etc..
Okay, you have added your first object. As it is an object from the flowchart menu it already knows about text and you can simply start adding your text inside. (If you use other objects you simply click on T in the main menu to add text and later align text and box with each other. To align them select them by drawing a big box around them. If both are really selected go to Objects-->Align and decide how the text should be aligned). Add all the objects you need and fill them with text until you are satisfied. To connect your objects with arrows you can choose between several line types. Depending on the kind of your diagram you will be able to easily decide which one is best for you. In the main menu at the bottom you can determine the general design of your line. If you want an arrow you simply choose an arrow in the right menu.
In case you want your lines "snap to grid" you go to the File menu in the main menu. There you find a field called "Preferences". Click on it and choose "snap to" under "Grid lines" if you want straight lines that snap to the grid lines. After that save your diagram as whateveryouwanttonameit.dia with "Save as". Then close it and reopen it again. (Changes will only get effective with the next diagram window that you open, not with already open ones.) If you now add your lines they will snap to the grid. Especially if you want to print your diagram afterwards you will find "snap to grip" very important to avoid strange looking lines.
That's all you need for a basic diagram. That was easy, wasn't it? So now you can work on the specific design. If you want to try several versions it's probably a good idea to save your diagram now as a .dia file in case you haven't done so already.
Let's see what we could change now to make our diagram look more interesting and to emphasis the important points.
Let's say we want to change the colour of the text. There are several options. To change the text of a single box select that box by a left click, then a click on the middle mouse button and on "Properties". A menu appears where you can change the style and colour of the line as well as the text colour, font (there are always three fonts available,sans, serif and monospace, other postscript fonts can be added by the user through a standard font requesters), size and orientation (left, centre, right).
If you want to change e.g. the colour of several objects at the same time you need to select the objects you want to select, then right click in the diagram-->Objects-->Group and then you can change the text or the look and feel of all those objects by right clicking again and then Objects-->Properties. (You always need to go to "Properties" to change the properties of your objects now).
To select your objects the best way depends on what kind of objects you want to change. If e.g. you want to change the line width of all decision boxes you can easily select them all by clicking on one and then right click, Select-->Same Type. Now all decision boxes in your diagram are selected. There are more options like this, read the manual to find out more. But if all else fails you can still click on each object you want to select while pressing shift down.
As an example I created a diagram that describes how you can contribute to LinuxFocus:
[contributetolf diagram]
Click on the diagram to see it in full size

To add images to your diagram that are in a normal image format like png, jpg, gif etc. you click on the image icon in the main menu and then on your diagram. A selection with the text "Broken image" appears. Now you click on the middle mouse button and on "properties" and then you can browse for an image in your files. After clicking "ok" or "apply" the image appears in your diagram.
To save your diagram in a format like png,jpg, gif etc. click File-->Export, then enter the name and the extension e.g. png that it should have. Click ok. A new window opens telling you the size of the image. If you want it bigger or smaller you can change the values here. Note however that if you make it too small your text won't be readable anylonger. If you want your diagram to be readable in a certain size you can orient yourself on the blue lines that indicate the size of one page while drawing.
To print your diagram you should first go to File-->Page Setup and scale the diagram down (with the scale option).

I find dia a very useful and helpful tool for creating diagrams. Still I am really missing the option to freely rotate objects. Some objects can at least be flipped horizontally or vertically but to have more options here really would be great. According to the dia website the programmers are already working on a solution though so you can probably expect this feature in any of the future versions of dia. Sometimes the undo button doesn't work properly and from time to time the program crashes. But taking into account that the current version isn't even 1.x yet it has all the potential to become an excellent program with a little bit of more time.
Happy diagramming!

 

References



Webpages maintained by the LinuxFocus Editor team
© Katja Socher
"some rights reserved" see linuxfocus.org/license/
http://www.LinuxFocus.org
Translation information:
en --> -- : Katja Socher <katja(at)linuxfocus.org>

2005-01-14, generated by lfparser_pdf version 2.51