Changeset f5b207c in tol for tolbase


Ignore:
Timestamp:
Feb 23, 2013, 9:42:44 AM (14 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
954ece1
Parents:
4865c64
Message:

fixes #1369, refs #1450 ::SetGraphDialog::CheckGraphicable should check only if there are columns with Real data

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@5658 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/toltk/setgraph.tcl

    r4865c64 rf5b207c  
    451451  ::SetGraphDialog::InitData $tableset
    452452
    453   switch [CheckGraphicable] {
    454     0 {
     453  if {![CheckGraphicable] } {
    455454      tk_messageBox -type ok -icon warning -title [mc Warning]\
    456455          -message [mc "Set not graphicable"]
    457       return 0
     456      return ""
     457  }
     458  # fill listX and listY
     459  # TICKET 1450
     460  #::SetGraphDialog::SetDataVarList
     461  switch $type {
     462    0 {
     463      # custom
     464      set lstLines {}
     465      set len [llength $pairs]
     466      for {set i 0} {[expr $i < $len]} {incr i} {
     467        set xy   [lindex $pairs $i]
     468        set name [lindex $names $i]
     469        if {![string length $name]} {
     470          set name "Column [expr $i + 1]"
     471        }
     472        lappend lstLines [::SetGraphDialog::AddLine \
     473                              [expr [lindex $xy 0] - 1] \
     474                              [expr [lindex $xy 1] - 1] \
     475                              $name          \
     476                              $lstLines]
     477      }
    458478    }
    459479    1 {
    460       # fill listX and listY
    461       # TICKET 1450
    462       #::SetGraphDialog::SetDataVarList
    463       switch $type {
    464         0 {
    465           # custom
    466           set lstLines {}
    467           set len [llength $pairs]
    468           for {set i 0} {[expr $i < $len]} {incr i} {
    469             set xy   [lindex $pairs $i]
    470             set name [lindex $names $i]
    471             if {![string length $name]} {
    472               set name "Column [expr $i + 1]"
    473             }
    474             lappend lstLines [::SetGraphDialog::AddLine \
    475               [expr [lindex $xy 0] - 1] \
    476               [expr [lindex $xy 1] - 1] \
    477               $name          \
    478               $lstLines]
    479           }
    480         }
    481         1 {
    482           # all to one
    483           ::SetGraphDialog::GrapthAllLine 1 0 $names
    484         }
    485         2 {
    486           # all to generic
    487           ::SetGraphDialog::GrapthAllLine 0 0 $names
    488         }
    489         3 {
    490           # even to odd
    491           ::SetGraphDialog::GrapthEvenUneven $names
    492         }
    493       }
    494       # build info to graph
    495       if [llength $data(selected)] {
    496         ::SetGraphDialog::SetSelection
    497         set info [list vectors $data(vectors) names $data(names) xTicks $data(xTicks)]
    498         set instance [::SetGraph::Create $path $info $set $tableset $fileGCF $title]
    499         bind $path <Destroy> +[list ::SetGraphDialog::OnDestroyGraph $data(nameVectors)]
    500         return $instance
    501       } else {
    502         set msg [mc "There are no data to draw"]
    503         ::TolConsole::HciWriter "<W>$msg</W>"
    504       }
    505     }
     480      # all to one
     481      ::SetGraphDialog::GrapthAllLine 1 0 $names
     482    }
     483    2 {
     484      # all to generic
     485      ::SetGraphDialog::GrapthAllLine 0 0 $names
     486    }
     487    3 {
     488      # even to odd
     489      ::SetGraphDialog::GrapthEvenUneven $names
     490    }
     491  }
     492  # build info to graph
     493  if [llength $data(selected)] {
     494    ::SetGraphDialog::SetSelection
     495    set info [list vectors $data(vectors) names $data(names) xTicks $data(xTicks)]
     496    set instance [::SetGraph::Create $path $info $set $tableset $fileGCF $title]
     497    bind $path <Destroy> +[list ::SetGraphDialog::OnDestroyGraph $data(nameVectors)]
     498    return $instance
     499  } else {
     500    set msg [mc "There are no data to draw"]
     501    ::TolConsole::HciWriter "<W>$msg</W>"
     502    return ""
    506503  }
    507504}
    … …  
    523520  ::SetGraphDialog::InitData $tableset
    524521
    525   switch [CheckGraphicable] {
    526     0 {
    527       tk_messageBox -type ok -icon warning -title [mc Warning]\
    528           -message [mc "Set not graphicable"]
    529       return 0
    530     }
    531     1 {
    532       DrawDialog
    533       if [llength $data(vectors)] {
    534         set info [list vectors $data(vectors) names $data(names) xTicks $data(xTicks)]
    535         set Instance [::SetGraph::Create $path $info $set $tableset]
    536         bind $path <Destroy> +[list ::SetGraphDialog::OnDestroyGraph $data(nameVectors)]
    537         return $Instance
    538       } else {
    539         return 0
    540       }
    541     }
     522  if {![CheckGraphicable]} {
     523    tk_messageBox -type ok -icon warning -title [mc Warning]\
     524        -message [mc "Set not graphicable"]
     525    return 0
     526  }
     527  DrawDialog
     528  if [llength $data(vectors)] {
     529    set info [list vectors $data(vectors) names $data(names) xTicks $data(xTicks)]
     530    set Instance [::SetGraph::Create $path $info $set $tableset]
     531    bind $path <Destroy> +[list ::SetGraphDialog::OnDestroyGraph $data(nameVectors)]
     532    return $Instance
     533  } else {
     534    return 0
    542535  }
    543536}
    … …  
    627620# RETURN:
    628621#    0 if the set isn't graphicable
    629 #    1 if there are some posibilities for choosing columns (assistant will be
     622#    !0 if there are some posibilities for choosing columns (assistant will be
    630623#   drawn)
    631624#/////////////////////////////////////////////////////////////////////////////
    632625  variable data
    633626
    634   #Para poder graficar =>
    635   # debe haber al menos una col. tipo 1 o 2 y al menos otra col. tipo 1 o 3.
    636   set tot1 [llength $data(idxColsType1)]
    637   set tot2 [llength $data(idxColsType2)]
    638   set tot3 [llength $data(idxColsType3)]
    639   if { ([expr $tot1 + $tot2] >= 1) && ([expr $tot1 + $tot3] >= 1) } {
    640     return 1
    641   } else  {
    642     return 0
    643   }
     627  # there must be at least Real numbers
     628  return [expr {[llength $data(idxColsType1)] + \
     629                    [llength $data(idxColsType3)] + \
     630                    [llength $data(idxColsType4)]}]
    644631}
    645632
Note: See TracChangeset for help on using the changeset viewer.