in reply to Win32::OLE X-Axis range question

print $_,$/ for ronge(qw( 3.0 4.0 0.1 )); sub ronge { my( $lll, $rrr, $iii ) = @_; my @rrr = $lll; while( $lll <= $rrr ){ $lll += $iii; push @rrr, sprintf '%.1f', $lll; } return @rrr; } __END__ 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0

Replies are listed 'Best First'.
Re^2: Win32::OLE X-Axis range question
by Anonymous Monk on Mar 12, 2009 at 16:39 UTC
    I would like to change my $Range variable to be dynamic. I am still not sure how I would do that if for instance I would want to have a range from 1.0 to 8.0 with 0.1 increments.
      I don't follow
        Currently, I have hardcoded the range from 3.0 to 4.0 with 0.1 increment as follows.
        $Range->{value} = [['voltage', "cell($cell_addr)"], [3.0, $icell_hash{$cell_addr}{' 3.00'}], [3.1, $icell_hash{$cell_addr}{' 3.10'}], [3.2, $icell_hash{$cell_addr}{' 3.20'}], [3.3, $icell_hash{$cell_addr}{' 3.30'}], [3.4, $icell_hash{$cell_addr}{' 3.40'}], [3.5, $icell_hash{$cell_addr}{' 3.50'}], [3.6, $icell_hash{$cell_addr}{' 3.60'}], [3.7, $icell_hash{$cell_addr}{' 3.70'}], [3.8, $icell_hash{$cell_addr}{' 3.80'}], [3.9, $icell_hash{$cell_addr}{' 3.90'}], [4.0, $icell_hash{$cell_addr}{' 4.00'}],
        But if a user specified he wanted the range from 1.00 to 2.00 with a 0.1 increment for the X-axis then I would like the Range variable to look liks this. I just don't know how to change it other then hardcoding it in the code myself.
        $Range->{value} = [['voltage', "cell($cell_addr)"], [1.0, $icell_hash{$cell_addr}{' 3.00'}], [1.1, $icell_hash{$cell_addr}{' 3.10'}], [1.2, $icell_hash{$cell_addr}{' 3.20'}], [1.3, $icell_hash{$cell_addr}{' 3.30'}], [1.4, $icell_hash{$cell_addr}{' 3.40'}], [1.5, $icell_hash{$cell_addr}{' 3.50'}], [1.6, $icell_hash{$cell_addr}{' 3.60'}], [1.7, $icell_hash{$cell_addr}{' 3.70'}], [1.8, $icell_hash{$cell_addr}{' 3.80'}], [1.9, $icell_hash{$cell_addr}{' 3.90'}], [2.0, $icell_hash{$cell_addr}{' 4.00'}],
        I would like to have the code change thru some type of loop on runtime.