Menu

#1020 xyplot xconfig / yconfig -scale not working

open
5
2008-02-27
2008-02-27
Paul Vogel
No

Using the xconfig or yconfig command with the -scale option results in an "Unknown or invalid value" error.

Script showing problem:

package require Tk
package require Plotchart

canvas .c
pack .c

set s [Plotchart::createXYPlot .c {0 100 10} {0 100 10}]
$s xconfig -scale {0 200 20}

The problem is in Plotchart::AxisConfig, in the file plotaxis.tcl around line 492. The "idx" value is the index into a list with a single value per option, and it is used to index into the axis_option_values which has two values per option. One possible fix is to multiply the idx by 2 before using it on the axis_option_values.

set clear [lindex $axis_option_clear $idx]
>> set idx [expr {2 * $idx}]
set values [lindex $axis_option_values [incr idx]]

Also, in the plotaxis.tcl file there is "console show" and "puts" command in the Plotchart::DrawXaxis routine which seem out of place.

Thanks,
-paul

Discussion

  • Arjen Markus

    Arjen Markus - 2008-02-28

    Logged In: YES
    user_id=400048
    Originator: NO

    The console show/puts commands are already gone - they were indeed way out of place,
    except for debugging purposes ;).

    The -scale option is more serious: I will look into this. Thanks for reporting it.

     
  • Arjen Markus

    Arjen Markus - 2008-03-07

    Logged In: YES
    user_id=400048
    Originator: NO

    I have been looking into this:
    - The fix you suggest solves the immediate syntactical problem
    - The scale values for the axis remain unchanged though - you get the same axis back.
    - When I fixed that bit, I got strange results (the wrong range, only a part of the labels I
    expected drawn).
    - The code as it is is too naive: I need to change a few private variables in the scaling array
    as well (they hold the transformation from world coordinates to pixels)