I forward this message to the list, so hope some others can help too..

> > > to have column with the maximum lenght (in my case 580 pixels).
> >
> > What is length refer to ? I mean, the width or height ?
>
> Is this important? Well, my columns start left an go to the right side.
> So this pixel value is third value in the "filledRectangle" data.
>
> filledRectangle(100,90,$column_lenght+100,100,$black);
>
> > > All the other values should be drawn in relation to that.
> > So what is the relation ? Is that the "length" is $max_percent_value or
what
> > ?
>
> Perhaps I shoud describe it with some values. If I get for examples the
percent
> values 20%, 10% and 5% and the maximum lenght is not 580 but 500 pixel the
> 20%-value should get a column with the length of 500 pixels, the 10%-value
> should get a column with 250 pixels, and the 5%-values 125 pixels.
>
> Is this description of my problem better to understand?
>

Yes, that's clear, and seems that's mathmatics problem, have you tried to
use round ( ) ?

> > > I thougt I can make a factor and then multiply all the
> > > other values with this on to get this result. My code looks like
> > > this:
> > >
> > > my $factor = (580/$max_percent_value)
> > >
> > > my $column_lengt_a = $percent_value_a * $factor;
> > > my $column_lengt_b = $percent_value_b * $factor;
> > > my $column_lengt_c = $percent_value_c * $factor;
> > > .....

You can try to use a loop for simplifying the above...

> > > My Prob:
> > > I does not work every time. On some data input the columns are bigger
than
> > 580 pixel.

Such as what kind of data ? above 100% ? In case, does $max_percent_value
something like 0.2 or 20 for representing 20%, and what about the
percent_value_x ?

> > >
> > > I also try, calculate without storing the factor in a string
> > > (avoid mistakes by rounding...I don't know) like this:
> > >
> > > my $maximum_pixel = 580;
> > > my $column_lengt_a = $percent_value_a * $maximum_pixel;
> > >

but this cannot let the hightest % give 580 pixels. You better have another
new try for your first idea. =)

Rgds,
Connie


Reply via email to