# Re: drawing graphs with dia

• From: Grégoire Dooms <dooms info ucl ac be>
• To: discussions about usage and development of dia <dia-list gnome org>
• Subject: Re: drawing graphs with dia
• Date: Sat, 12 Mar 2005 20:11:54 +0100

```Lars Clausen wrote:

```
```First option is exactly what I had in mind for after 0.95.  We have code
that does line-gap well for almost all objects, but only with lines.  The
various straight lines would work well with it, but getting arcs and
beziers to do the right thing would be tricky.
```
```For arc and bezier, I'm not sure what the right thing to do is.
I can suggest two things:
- Connect the endpoint to the central connection point,
trim the curve at the edge of the connected object
and draw the arrow like if the endpoint was there
- Preserve the slope the user set when the endpoint was connected to the
central CP,
```
connect the curve at the edge such that it aims at the central CP (with the
``` same slope).

```
For the line, the gap is perfect for my intended use, why did you comment out
```the GUI ?

```
instead of absolute-gap and fractional_gap we could use gap_offset and gap_proportion (liner factor) where this latter could apply to either the line/curve length or the autogap length.
```
To sum up:
offset / prop / target
.10 / 0 / self : constant gap of .10
0 / .1 / self : gap is 10% of length
.10 / .1 / self : gap is 10% of length + .10
0 / 0 /auto : arrow touches edge
.10 / 0 / auto : arrow is 10 away from edge
0 / -.5 / auto : arrow is halfway inside the object

positive values always increase the gap, negative decrease the gap.

```
```The main thing that's been holding me off is that I wanted to let all
objects have the virtual central CP.  Some objects have a dynamic number
of CPs, which makes it trickier.  We have some notes on this problem on
the TWiki.

```
Why does it need to be virtual ? ie. Why not a real central CP and multiple
```lines connected to it like with the ellipse object ?

```
```I would love it if you started looking at this.  I'd want to keep it
entirely #ifdef'ed until 0.95 is out (unless you code well and fast), but
I'm very interested in seeing some action on that front.  I do feel,
though, that it would be unfair not to mention the Graphviz package, which
is made for making graphs.  Doesn't have the editing abilities of Dia, but
is really good at autolayout.
```
Yeah I use it a lot too. The layout engines allow to output the graph in xdot format (dot format with positions and parmaters for the curves). But there is one awkward thing: if you modify the xdot file there is no way/option to use the graphviz renderer to display the modified graph as it always re-autolayout
```it (AFAIK).

```
```PS: I tried to compile CVS HEAD on 2005-03-11 and got this error:
widgets.c:30:27: dia-lib-icons.h: No such file or directory
(I did cvs up -d to update my cvs tree) should I check-out from scratch ?
```
```
Is that from today?  There's something about how automake doesn't quite
force the creation of it, but if you 'make dia-list-icons.h' in lib it's
created.
```
Works fine, I also had to autogen.sh in order to rebuild the configure script.
```
Thanks for the feedback.
Best regards,
--
Grégoire Dooms.

```