Tk Library Source Code

View Ticket
Login
Ticket UUID: 1903306
Title: xyplot xconfig / yconfig -scale not working
Type: Bug Version: None
Submitter: pfvogel Created on: 2008-02-27 18:25:10
Subsystem: tklib :: plotchart Assigned To: arjenmarkus
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2014-12-15 08:20:42
Resolution: Fixed Closed By: arjenmarkus
    Closed on: 2014-12-15 08:20:42
Description:
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
User Comments: arjenmarkus added on 2014-12-15 08:20:42:
Fixed in version 2.3.3: 

A call to worldCoordinates was needed to reset the scaling, so that the values are mapped to the appropriate screen coordinates.

arjenmarkus added on 2008-03-07 14:39:38:
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)

arjenmarkus added on 2008-02-28 15:31:15:
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.