Tk Library Source Code

View Ticket
Login
Ticket UUID: 55f89cf0be4fcdb002d3f96fc1ca8b351ccd1878
Title: plotchart and locale
Type: RFE Version:
Submitter: anonymous Created on: 2023-08-03 19:59:53
Subsystem: tklib :: plotchart Assigned To: arjenmarkus
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2024-06-04 19:05:24
Resolution: Fixed Closed By: arjenmarkus
    Closed on: 2024-06-04 19:05:24
Description:
local designation of the time in the axes



Changes:
in all FILES (2 files, 4 places)  where gmt is also used add locale, i.e. in


plotaxis.tcl
proc ::Plotchart::DrawXaxis
    set gmt     0
    set locale {}

proc ::Plotchart::DrawXaxis
-gmt {
                    set gmt $val
 }
-locale {
                    set locale $val
}


set xlabel [clock format [expr {int($xt)}] -format $timeformat -gmt $gmt -locale $locale]

plotchart.tcl 
proc ::Plotchart::CreateXYPlotImpl

-gmt        {
                   lappend known_args $arg $val
               }
-locale    {
                   lappend known_args $arg $val
              }



#Example
package require Plotchart

pack [canvas .c -width 500 -bg white]

set start [clock scan  "0:00"]
set stop  [clock scan "10:00"]
set s [Plotchart::createStripchart .c [list $start $stop 7200] {0 10 1} -timeformat "%a %H:%M" -locale de]

foreach {x y} {0 0 2 5 5 2 9 9 12 10} {
    set x [expr {$start + 3600 * $x}] ;# Convert hour to clock seconds
    $s plot a $x $y
}
User Comments: arjenmarkus added on 2024-06-04 19:05:24:
With the use of the example code I have implemented the -locale option. Version 2.6.2