ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Charting module
@ 2001-09-09 17:02 Giuseppe Bilotta
  2001-09-10 20:18 ` Hans Hagen
  2001-09-10 21:01 ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Giuseppe Bilotta @ 2001-09-09 17:02 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 2724 bytes --]

Hello,

I just began exploring the charting module. And here I am with a
couple of requests! :-)

What I basically have the need for is "half-grid" steps.

Say that I want a layout like the following

     X4X
      \
       +--XbX
      /
X2X  X1X  X3X
 |   | |   |
 \-+-/ \-+-/
   |     |
  XcX  /-+-\
       |   |
      XdX XaX

I would like to occupy as less space as possible, while still
retaining the "local centering" (that is, box c between box 1 and
2, box b between box 1 and 4, box d possibly aligned under box 1
and box a possibly under box 3). Also the link between 1-3 and d-a
should join in the middle before splitting again. Note that I can
achieve this by putting intermediate empty spaces between the main
(Roman-numbered) boxes, but this would leave too much space. With
the grid, we have

 Empty    Empty   "Box 4"   Empty    Empty
 Empty    Empty    Empty   "Box b"   Empty
"Box 2"   Empty   "Box 1"   Empty   "Box 3"
 Empty   "Box c"   Empty      0      Empty
 Empty    Empty   "Box d"   Empty   "Box a"

while with half-grid steps I could put the intermediate link box 0
(which btw shows as an empty dot; how to make it disappear so that
the conjunction is seamless?) and boxes b and c in a half-step,
reducing space waste.

A second question is about connection points. Despite the
recommendations in the manual about trying to avoid multiple
(outgoing) links per side (using e.g. [-b] or [+b]), I find this
possibility helpful, and actually essential in the above mentioned
example, where "Box 1" has two connection at the bottom (left and
right). (Yes I know I should rearrange the chart, but I don't want
to; I prefer it this way.)

However, these connections are too spaced away, because they are
at about 1/4, 3/4 of the side, which is essential if a third
connection (midpoint) is used, but sub-optimal when only two
connections are used (a better positioning in this case would be
to use a 1/3, 2/3 spacing). The suggestion resolves finally in
either giving the user the possibility to control position of the
connection points, or providing automatically the best position
depending on how many connection points are actually used. (And
what about allowing the users to have "as many connection points
per side as desired"? Imagine a (horrible?) thing with five
connection points: ++b, +b, b, -b, --b !)

Finally: why do corner radius and arrow size share the same value?
Is there a way to change the value for some connections only and
activate/deactivate arrows for specific connections? is there a
way to force a straight arrow even when by default it would come
out bended?

Btw, see attached file if you want to see how the chart is
currently implemented.

--
Giuseppe "Oblomov" Bilotta

[-- Attachment #2: gb-chart.tex --]
[-- Type: application/octet-stream, Size: 1947 bytes --]

%&cont-en

\usemodule[chart]

\setuppapersize[S6][S6]

\newif\ifpdf
\pdftrue
\ifx\pdfoutput\relax
    \pdffalse
\else
    \ifnum\pdfoutput=0
        \pdffalse
    \fi
\fi

\ifpdf
  \setupinteractionscreen[option=max]
  \setupbackgrounds[paper][text]
                   [background=color,backgroundcolor=darkyellow]
\fi


\setuppagenumbering[state=stop]

\starttext

\setupFLOWcharts[maxwidth=\textwidth,dx=\bodyfontsize,dy=\bodyfontsize]
\setupFLOWshapes[default=procedure]
\setupFLOWlines[radius=\bodyfontsize,arrow=no]

\startFLOWchart[gbchart]
    \startFLOWcell
       \name {boxone}
       \text {Box 1}
       \location {3,3}
       \connection[-bt]{boxc}
       \connection[+bt]{boxnull}
       \connection[tl]{boxb}
   \stopFLOWcell

   \startFLOWcell
       \name {boxtwo}
       \text {Box 2\\More text}
       \location {1,3}
       \connection[bt]{boxc}
   \stopFLOWcell

   \startFLOWcell
       \name {boxc}
       \text {Box c\\Even more\\Text}
       \location {2,4}
   \stopFLOWcell

   \startFLOWcell
       \name {boxthree}
       \text {Box 3\\More text}
       \location {5,3}
       \connection[bt]{boxnull}
   \stopFLOWcell

   \startFLOWcell
       \name{boxnull}
       \shape{0}
       \location {4,4}
       \connection[bt]{boxa}
       \connection[bt]{boxd}
   \stopFLOWcell
   
   \startFLOWcell
       \name {boxa}
       \text {Box a\\Even more\\Text}
       \location {5,5}
   \stopFLOWcell

   \startFLOWcell
       \name {boxd}
       \text {Box d\\Even more\\Text}
       \location {3,5}
   \stopFLOWcell

   \startFLOWcell
       \name {boxfour}
       \text {Box 4\\More text}
       \location {3,1}
       \connection[bl]{boxb}
   \stopFLOWcell

   \startFLOWcell
       \name {boxb}
       \text {Box b\\Even more\\Text}
       \location {4,2}
   \stopFLOWcell

\stopFLOWchart

\FLOWchart[gbchart]

\stoptext

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Charting module
  2001-09-09 17:02 Charting module Giuseppe Bilotta
@ 2001-09-10 20:18 ` Hans Hagen
  2001-09-11 12:38   ` Re[2]: " Giuseppe Bilotta
  2001-09-10 21:01 ` Hans Hagen
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2001-09-10 20:18 UTC (permalink / raw)
  Cc: ntg-context

Hi,

I suppose that not all wishes have to be fulfilled at once -) Although 
charts offer you a couple of fancy features, it may be worth looking into 
denis' metapost macros too. [i still have to integrate it/interface it]

[btw, can you collect pending wishes / request so that we can discuss them 
at eurotex? we can look into it there]

i have to clean up this chart module a bit, esp since now metafun offers 
some means to do things easier [also in mp]

A remark about your file: these \ifnum\pdfoutput things are .... well 
rather ugly, so here's a better way:

\startmode [*interaction]

   your settings

\stopmode

those *'d modes are system modes and there are / will be a couple more. So, 
modes are the way to do conditional typesetting,

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Charting module
  2001-09-09 17:02 Charting module Giuseppe Bilotta
  2001-09-10 20:18 ` Hans Hagen
@ 2001-09-10 21:01 ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2001-09-10 21:01 UTC (permalink / raw)
  Cc: ntg-context

[-- Attachment #1: Type: text/plain, Size: 2430 bytes --]

Hi,

I'm willing to look into extensions later this year but we should then 
collect the wishes first. I know that for instance Tobias has some wishes 
with regards to straight lines [not that complicated] and i'm sure that 
Willy has some too.

while with half-grid steps I could put the intermediate link box 0
>(which btw shows as an empty dot; how to make it disappear so that

i see no quick hack [have to print the module] for the dot.

>A second question is about connection points. Despite the
>recommendations in the manual about trying to avoid multiple
>(outgoing) links per side (using e.g. [-b] or [+b]), I find this
>possibility helpful, and actually essential in the above mentioned
>example, where "Box 1" has two connection at the bottom (left and
>right). (Yes I know I should rearrange the chart, but I don't want
>to; I prefer it this way.)

this looks doable and is mostly a matter of interfacing

>However, these connections are too spaced away, because they are
>at about 1/4, 3/4 of the side, which is essential if a third
>connection (midpoint) is used, but sub-optimal when only two
>connections are used (a better positioning in this case would be
>to use a 1/3, 2/3 spacing). The suggestion resolves finally in
>either giving the user the possibility to control position of the
>connection points, or providing automatically the best position
>depending on how many connection points are actually used. (And
>what about allowing the users to have "as many connection points
>per side as desired"? Imagine a (horrible?) thing with five
>connection points: ++b, +b, b, -b, --b !)

horrible indeed but 1 / 2 / 3 / 5 connections as option are ok

>Finally: why do corner radius and arrow size share the same value?
>Is there a way to change the value for some connections only and
>activate/deactivate arrows for specific connections? is there a
>way to force a straight arrow even when by default it would come
>out bended?

i suppose that you looked into m-chart -) most is configurable in the mp 
module, so again it's mostly a matter of interfacing [and lazyness of me]

concerning changes in settings: you can change them in the flow and use 
grouping if needed, so you can have one connection with arrows and another 
with no arrows.

Also: for lovers of <angle brackets> i have a xml interface to flowcharts; 
combined with mathml and stepcharts and alike, this gives impressive chunks 
of xml

Hans

[-- Attachment #2: demo-001.tex --]
[-- Type: text/plain, Size: 2862 bytes --]

% output=pdftex interface=en

\usemodule[chart,mathml,steps]

\setupcolors[state=start] \setupbodyfont[lbr,8pt]
\setuplayout[width=middle,height=middle,backspace=1cm,topspace=1cm,header=0pt,footer=0pt]

\startbuffer[xml]
<flowchartdefinition identifier="test">
  <?context-flowchart-directive lines color darkgreen ?>
  <flowcell>
    <name> tex </name>
    <location> <x> 1 </x> <y> 1 </y> </location>
    <shape> action </shape>
    <text> &tex; </text>
    <connection> <type> rl </type> <name> context </name> </connection>
  </flowcell>
  <?context-begin-group a very important cell ?>
  <?context-flowchart-directive shapes framecolor darkred ?>
  <flowcell>
    <?context-flowchart-directive lines color darkyellow ?>
    <name> context </name>
    <location> <x> 2 </x> <y> 1 </y> </location>
    <shape> action </shape>
    <text>
      <stepchart>
        <cell> one   </cell> <text> even </text>
        <cell> two   </cell> <text> odd  </text>
        <cell> three </cell>
      </stepchart>
    </text>
    <connection> <type> rl </type> <name> rubish </name> </connection>
  </flowcell>
  <?context-end-group a very important cell ?>
  <flowcell>
    <name> rubish </name>
    <location> <x> 1 </x> <y> 2 </y> </location>
    <shape> action </shape>
    <text> <m> 1+2=3 </m> </text>
    <connection> <type> rl </type> <name> another </name> </connection>
  </flowcell>
  <flowcell>
    <?context-flowchart-directive lines color darkblue ?>
    <name> another </name>
    <location> <x> 2 </x> <y> 2 </y> </location>
    <shape> action </shape>
    <text>
      <math> <apply> <sin/> <apply> <plus/>
        <cn> 2 </cn> <ci> a </ci>
      </apply> </apply> </math>
    </text>
    <connection> <type> bt </type> <name> tex </name> </connection>
  </flowcell>
</flowchartdefinition>

<flowchart identifier="test"/>
\stopbuffer

\startbuffer[tex]
\startFLOWchart [test]
  \setupFLOWlines[color=darkgreen]
  \startFLOWcell 
    \name{tex}
    \location{1,1}
    \shape{action}
    \text{\TeX}
    \connect[rl]{context}
  \stopFLOWcell 
  \start
  \setupFLOWshapes[framecolor=darkred]
  \startFLOWcell 
    \setupFLOWlines[color=darkyellow]
    \name{context}
    \location{2,1}
    \shape{action}
    \text
      {\startSTEPchart
         \cell{one}  \text{even}
         \cell{two}  \text{odd}
         \cell{three} 
       \stopSTEPchart}
    \connect[rl]{rubish}
  \stopFLOWcell 
  \stop
  \startFLOWcell 
    \name{rubish}
    \location{1,2}
    \shape{action}
    \text{$1+2=3$}
    \connect[rl]{another}
  \stopFLOWcell 
  \startFLOWcell 
    \setupFLOWlines[color=darkblue]
    \name{another}
    \location{2,2}
    \shape{action}
    \text{$\sin(2+a)$}
    \connect[bt]{tex}
  \stopFLOWcell 
\stopFLOWchart

\FLOWchart[test]
\stopbuffer

\starttext

\processXMLbuffer[xml] \typebuffer[xml] \page 

\getbuffer[tex] \typebuffer[tex]

\stoptext

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re[2]: Charting module
  2001-09-10 20:18 ` Hans Hagen
@ 2001-09-11 12:38   ` Giuseppe Bilotta
  2001-09-12  6:28     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe Bilotta @ 2001-09-11 12:38 UTC (permalink / raw)
  Cc: ntg-context

Monday, September 10, 2001 Hans Hagen wrote:

HH> Hi,

HH> I suppose that not all wishes have to be fulfilled at once -) Although 
HH> charts offer you a couple of fancy features, it may be worth looking into 
HH> denis' metapost macros too. [i still have to integrate it/interface it]

Where are denis' metapost macros?

HH> [btw, can you collect pending wishes / request so that we can discuss them 
HH> at eurotex? we can look into it there]

Uh ... I might get a look to old posts and see which wishes have
not been implemented, yes. A stupid question about EuroTeX: how
shall I dress up?

HH> A remark about your file: these \ifnum\pdfoutput things are .... well
HH> rather ugly, so here's a better way:

HH> \startmode [*interaction]

HH>    your settings

HH> \stopmode

HH> those *'d modes are system modes and there are / will be a couple more. So, 
HH> modes are the way to do conditional typesetting,

Uh ... I do use modes. Is there a mode active in PDF-production
mode? If not, you could add it to the wish list :-)

--
Giuseppe "Oblomov" Bilotta


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re[2]: Charting module
  2001-09-11 12:38   ` Re[2]: " Giuseppe Bilotta
@ 2001-09-12  6:28     ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2001-09-12  6:28 UTC (permalink / raw)
  Cc: ntg-context

At 02:38 PM 9/11/2001 +0200, Giuseppe Bilotta wrote:

>Uh ... I might get a look to old posts and see which wishes have
>not been implemented, yes. A stupid question about EuroTeX: how
>shall I dress up?

pretty informal

>Uh ... I do use modes. Is there a mode active in PDF-production
>mode? If not, you could add it to the wish list :-)

hm, i'll think about that one, since dvi -> ps -> pdf is also pdf -)

there is \jobsuffix to test for [dvi|pdf]

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-09-12  6:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-09 17:02 Charting module Giuseppe Bilotta
2001-09-10 20:18 ` Hans Hagen
2001-09-11 12:38   ` Re[2]: " Giuseppe Bilotta
2001-09-12  6:28     ` Hans Hagen
2001-09-10 21:01 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).