[Tutor] How to create variable length bar chart ??

Asrarahmed Kadri ajkadri at googlemail.com
Wed Dec 6 21:43:11 CET 2006


I got that point, what I want is how the dimensions of the canvas would be
adjusted so as to incorporate this Y-axis variable length?

Do I need a scrollbar for that??

Thanks in advance.

Regards,
Asrarahmed Kadri

On 12/6/06, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
>
> "Asrarahmed Kadri" <ajkadri at googlemail.com> wrote in
>
> > What I want is the height of the bar chart should be determined
> > dynamically
> > (basically it means the length of the Y-axis), as per the number of
> > data-items being displayed.
>
> Hmm, I thought we ansdwered this recently...
>
> Anyhow you just calculate it.
> The height will be for an example with 3 bars:
>
> 3 times the height of a bar plus the inter bar space.
>
> You might want to add some extra height on at the top.
>
> Or you might want to have a bigger or smaller gap at top
> and bottom than between the bars but basically its a case
> of work out rthe pattern then calculate according to the data.
>
> The worst case is:
>
>
>                                <- top_gap
> XXXXXXXXXXXXX
>
> XXXXXXXXXXXX
>                                 <- gap_size
> XXXXXXXXXXXXXX        <- bar_size
>                                  <- bottom_gap
> -------------------------------- <-- X axis
>
>
> height = (bottom_gap+ top_gap) + ((N-1) * (bar_size+gap_size)) +
> bar_size
>
> HTH,
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.freenetpages.co.uk/hp/alan.gauld
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
To HIM you shall return.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061206/9082d462/attachment.html 


More information about the Tutor mailing list