Changeset 2300 for branches/blt4
- Timestamp:
- Jul 8, 2011, 6:09:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/histogram.tcl
r2297 r2300 35 35 36 36 protected method Build {} 37 private method Clear { }37 private method Clear { {comp ""} } 38 38 private method ParseData { comp } 39 39 … … 335 335 } 336 336 337 # 338 # ParseData -- 339 # 340 # Parse the components data representations. The following 341 # elements may be used <xy>, <xhw>, <namevalue>, <xvector>, 342 # <yvector>. Only one element is used for data. 343 # 337 344 itcl::body Rappture::Histogram::ParseData { comp } { 338 345 # Create new vectors or discard any existing data … … 344 351 set xydata [$_hist get ${comp}.xy] 345 352 if { $xydata != "" } { 353 # Fast way of parsing x/y pairs. Set a temporary vector using the 354 # entire as a list of values (newlines treated as whitespace). 355 # Then split the vector into the x and y vectors required. 346 356 set tmp [blt::vector create \#auto] 347 357 $tmp set $xydata … … 354 364 set xhwdata [$_hist get ${comp}.xhw] 355 365 if { $xhwdata != "" } { 366 # Slow way of parsing x, h, and w values. The third value is 367 # optional to can't simply load the values into a vector. 356 368 foreach line [split $xhwdata \n] { 357 369 set n [scan $line {%s %s %s} x h w] … … 396 408 } 397 409 398 itcl::body Rappture::Histogram::Clear {} { 399 foreach name [array names _widths] { 400 blt::vector destroy $_widths($name) 401 } 402 array unset _widths 403 foreach name [array names _yvalues] { 404 blt::vector destroy $_yvalues($name) 405 } 406 array unset _yvalues 407 foreach name [array names _xvalues] { 408 blt::vector destroy $_xvalues($name) 409 } 410 array unset _xvalues 411 array unset _xlabels 412 array unset _comp2hist 413 } 414 410 itcl::body Rappture::Histogram::Clear { {comp ""} } { 411 if { $comp == "" } { 412 foreach name [array names _widths] { 413 blt::vector destroy $_widths($name) 414 } 415 array unset _widths 416 foreach name [array names _yvalues] { 417 blt::vector destroy $_yvalues($name) 418 } 419 array unset _yvalues 420 foreach name [array names _xvalues] { 421 blt::vector destroy $_xvalues($name) 422 } 423 array unset _xvalues 424 array unset _xlabels 425 array unset _comp2hist 426 return 427 } 428 if { [info exists _widths($comp)] } { 429 blt::vector destroy $_widths($comp) 430 } 431 if { [info exists _yvalues($comp)] } { 432 blt::vector destroy $_yvalues($comp) 433 } 434 if { [info exists _xvalues($comp)] } { 435 blt::vector destroy $_xvalues($comp) 436 } 437 array unset _xvalues $comp 438 array unset _yvalues $comp 439 array unset _widths $comp 440 array unset _xlabels $comp 441 array unset _comp2hist $comp 442 } 443
Note: See TracChangeset
for help on using the changeset viewer.