TaoLib

Check-in [92aad475d7]
Login

Check-in [92aad475d7]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Yet another fix for graphs
Timelines: family | ancestors | descendants | both | fsar
Files: files | file ages | folders
SHA1: 92aad475d7de17521b2735c0f9c2e4ce6352f798
User & Date: hypnotoad 2018-11-01 21:55:05.717
Context
2018-11-01
22:09
Typo fix check-in: 2b6b0200fe user: hypnotoad tags: fsar
21:55
Yet another fix for graphs check-in: 92aad475d7 user: hypnotoad tags: fsar
19:33
Performing another attempt to fix graphs check-in: 8fdcc22a9d user: hypnotoad tags: fsar
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/taotk/meta/graph.tcl.
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173


174
175
176
177
178
179
180
181
182
183
184
  #}

  ###
  # topic: 1173906ef32db527172dced7cecac421a90fbc05
  ###
  method initialize {} {
    next
    my variable config lastview
    dict set config nowonly 0
    dict set config data_min_x 0
    dict set config data_max_x 530
    dict set config data_min_y 0
    dict set config data_max_y 330

    dict set config window_min_x 0
    dict set config window_min_y 530
    dict set config window_max_x 0
    dict set config window_max_y 330
    dict with config {}
    dict set config graph_height     [expr {$height-($margin_top+$margin_bottom)}]  ;# Graph height
    dict set config yrange           [expr {$window_max_y-$window_min_y}]  ;# Range of Y values to display
    dict set config graph_width      [expr {$width-($margin_left+$margin_right)}]   ;# Graph width
    dict with config {}
    dict set config mhline           [expr {$margin_top+$graph_height}]          ;# Y-coord of horizontal axis
    dict set config xrange           [expr {$window_max_x-$window_min_x}]  ;# Range of X values to display
    set lastview $config
  }

  ###
  # topic: 1becbf9efe9d4f15d6621fdaa2f6add1958abebd
  ###
  method margins {{data {}}} {
    my variable config lastview
    if {$data eq {}} {
      return $config
    }
    dict set config canvas [my organ hull].c
    if { $data ne {} } {
      dict with config {
        set data_max_x [lindex $data 0]
        set data_max_y [lindex $data 1]
        set data_min_x $data_max_x
        set data_min_y $data_max_y
        foreach {x y} $data {
          if {$x<$data_min_x} {set data_min_x $x}
          if {$x>$data_max_x} {set data_max_x $x}
          if {$y<$data_min_y} {set data_min_y $y}
          if {$y>$data_max_y} {set data_max_y $y}
        }
        foreach item {min_x max_x min_y max_y} {
          set value [my cget user_${item}]


          if {$value eq {}} {
            set value [set data_${item}]
          }
          set window_${item} $value
        }
      }
    }
    dict with config {
      set canvas [my organ canvas]
      set yrange [expr {$window_max_y-$window_min_y}]  ;# Range of Y values to display
      set xrange [expr {$window_max_x-$window_min_x}]  ;# Range of X values to display







|

















<






|

















|
>
>
|
|

<







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
  #}

  ###
  # topic: 1173906ef32db527172dced7cecac421a90fbc05
  ###
  method initialize {} {
    next
    my variable config
    dict set config nowonly 0
    dict set config data_min_x 0
    dict set config data_max_x 530
    dict set config data_min_y 0
    dict set config data_max_y 330

    dict set config window_min_x 0
    dict set config window_min_y 530
    dict set config window_max_x 0
    dict set config window_max_y 330
    dict with config {}
    dict set config graph_height     [expr {$height-($margin_top+$margin_bottom)}]  ;# Graph height
    dict set config yrange           [expr {$window_max_y-$window_min_y}]  ;# Range of Y values to display
    dict set config graph_width      [expr {$width-($margin_left+$margin_right)}]   ;# Graph width
    dict with config {}
    dict set config mhline           [expr {$margin_top+$graph_height}]          ;# Y-coord of horizontal axis
    dict set config xrange           [expr {$window_max_x-$window_min_x}]  ;# Range of X values to display

  }

  ###
  # topic: 1becbf9efe9d4f15d6621fdaa2f6add1958abebd
  ###
  method margins {{data {}}} {
    my variable config user_bound
    if {$data eq {}} {
      return $config
    }
    dict set config canvas [my organ hull].c
    if { $data ne {} } {
      dict with config {
        set data_max_x [lindex $data 0]
        set data_max_y [lindex $data 1]
        set data_min_x $data_max_x
        set data_min_y $data_max_y
        foreach {x y} $data {
          if {$x<$data_min_x} {set data_min_x $x}
          if {$x>$data_max_x} {set data_max_x $x}
          if {$y<$data_min_y} {set data_min_y $y}
          if {$y>$data_max_y} {set data_max_y $y}
        }
        foreach item {min_x max_x min_y max_y} {
          set value
          if {[info exists user_bound(user_${item})] && $user_bound(user_$item) ne {}} {
            set window_${item} $user_bound(user_$item)
          } else {
            set window_${item} [set data_${item}]
          }

        }
      }
    }
    dict with config {
      set canvas [my organ canvas]
      set yrange [expr {$window_max_y-$window_min_y}]  ;# Range of Y values to display
      set xrange [expr {$window_max_x-$window_min_x}]  ;# Range of X values to display
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
      if { $height < 400 } {
        set height 400
      }
      set graph_height  [expr {$height-($margin_top+$margin_bottom)}]  ;# Graph height
      set mhline        [expr {$margin_top+$graph_height}]          ;# Y-coord of horizontal axis
      set graph_width   [expr {$width-($margin_left+$margin_right)}]   ;# Graph width
    }
    set lastview $config
    return $config
  }

  ###
  # topic: 2aea09d279cefafececbf3e33552d7e41f736e90
  ###
  method Rounder {sx lx} {







<







193
194
195
196
197
198
199

200
201
202
203
204
205
206
      if { $height < 400 } {
        set height 400
      }
      set graph_height  [expr {$height-($margin_top+$margin_bottom)}]  ;# Graph height
      set mhline        [expr {$margin_top+$graph_height}]          ;# Y-coord of horizontal axis
      set graph_width   [expr {$width-($margin_left+$margin_right)}]   ;# Graph width
    }

    return $config
  }

  ###
  # topic: 2aea09d279cefafececbf3e33552d7e41f736e90
  ###
  method Rounder {sx lx} {