« Return to Thread: Exception in barchart

Re: Exception in barchart

by Christian Schneiker-2 :: Rate this Message:

Reply to Author | View in Thread

Hi Jan,

Here is a code snippet of Dietmar's DDK for bar_chart from which I get
the error.

dislog_bar_chart(Title, Distribution, Limit) :-
   name_append(Title, ' Distribution', Title_Distribution),
   new(W, auto_sized_picture(Title_Distribution)),
%  send(W, size, size(700, 600)),
   length(Distribution, N),
   dislog_bar_chart_required_scale(
      Distribution, Limit, Scale),
   !,
   send(W, display,
      new(BC, bar_chart(vertical, 0, Scale, 300, N))),
   forall( member([A, Colour]-Amount, Distribution),
      send(BC, append,
         bar_group(A,
            bar('', Amount, Colour))) ),
   send(W, open).

dislog_bar_chart_required_scale(
      Distribution, Limit, Scale) :-
   findall( Amount,
      member(_-Amount, Distribution),
      Amounts ),
   maximum(Amounts, X),
   ( X < Limit,
     Scale is Limit
   ; round(X/100+0.5, 0, Y),
     Scale is Y * 100 ).


> That is weird. I'd like to see a program to reproduce this. It might
> point at some deeper trouble.
>
> Cheers --- Jan
>

Christian
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

 « Return to Thread: Exception in barchart