Tk Library Source Code

View Ticket
Login
Ticket UUID: 40ae42af80c61618720510ba6648bef183e6b894
Title: Get canvas path name from plot id
Type: Bug Version: 8.5.14
Submitter: anonymous Created on: 2013-08-04 20:13:42
Subsystem: tklib: plotchart Assigned To: arjenmarkus
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2013-10-06 08:06:52
Resolution: None Closed By: arjenmarkus
    Closed on: 2013-10-06 08:06:52
Description:
Hi, in plotpriv.tcl, for instance ::Plotchart::WidthCanvas, it is used a piece of code to extract the canvas path name from the plot id, the expression used is:

set w [string range $w 2 end]

This expression assume that the first two character correspond to the index of the plot within the canvas and it may fails if for some reason the plot number has 3 digit, ie, 100. 

The expression to build the plot id is [format "%02d%s" $scaling($c,plots) $c] if $scaling($c,plots) has 3 or more digits then it results in an invalid identifier.

I have changed my copy of plotchart to use this expression:

string range $w [string first . $w] end

and it works as expected.

Bellow is a code to help reproducing the error, you have to resize the window until the error appears, eventually after the resize number 100.

package require Plotchart
canvas .c
pack .c -fill both -expand yes
bind .c <Configure> redraw
proc redraw { } {
  .c delete all
  ::Plotchart::createXYPlot .c {0 1 0.1} {0 1 0.1}
}
User Comments: arjenmarkus added on 2013-10-06 08:06:52:
DOne - implemented in version 2.2.1

Attachments: