• Plotchart - t-axis labels

    From Alan Grunwald@nospam.nurdglaw@gmail.com to comp.lang.tcl on Sun May 4 15:46:06 2025
    From Newsgroup: comp.lang.tcl

    I'm trying to plot a set of timed values using Plotchart::createTXPlot.

    My first vaguely successful attempt leads to unreadable labels on the (horizontal) t-axis because the date/times overlap each other. I'd like
    to specify that the labels be displayed vertically, which seems a fairly
    good and obvious solution but I can't see a way to do this easily using Plotchart commands.

    I have discovered by experiment that the labels are specified by canvas
    items with the tag "taxis", so I can rotate the items with code like this:

    foreach item [$canvas find withtag taxis] {
    if {[$canvas type $item] eq "text"} {
    $canvas itemconfigure $item -angle 270 -anchor e
    }
    }

    but since this isn't documented, I fear it may change in a future
    version of Plotchart.

    I'm also having a bit of trouble getting the canvas to scroll properly
    which I haven't yet worked out properly.

    Is there a better, preferrably a "supported" way to do this?

    Thanks
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Olivier@user1108@newsgrouper.org.invalid to comp.lang.tcl on Thu May 8 18:00:47 2025
    From Newsgroup: comp.lang.tcl


    Alan Grunwald <nospam.nurdglaw@gmail.com> posted:

    I'm trying to plot a set of timed values using Plotchart::createTXPlot.


    Plotchart is full of functionalities, but very static. I mean if you have a change in a plot, you have to delete and plot it again. For a more dynamic
    I suggest to build an envelop just the way xyplot.tcl (in the distribution, where plotchart.tcl is).


    My first vaguely successful attempt leads to unreadable labels on the (horizontal) t-axis because the date/times overlap each other. I'd like
    to specify that the labels be displayed vertically, which seems a fairly good and obvious solution but I can't see a way to do this easily using Plotchart commands.

    In the example given in the distribution "testtxplot.tcl",

    replace the line
    ----------------

    set s [::Plotchart::createTXPlot .c {2006-01-01 2007-01-01 120} {0.0 100.0 20.0}]

    with :
    ------

    set _newscale [::Plotchart::determineTimeScale "2006-01-01" "2007-01-01"]

    lassign [::Plotchart::determineTimeScale "2006-01-01" "2007-01-01"] _date1 _date2 _delta

    set s [::Plotchart::createTXPlot .c [ list [ lindex $_date1 0 ] [ lindex $_date2 0 ] $_delta ] {0.0 100.0 20.0} ]

    If you don't have many labels, it can easier than vertical labels.


    I have discovered by experiment that the labels are specified by canvas items with the tag "taxis", so I can rotate the items with code like this:

    foreach item [$canvas find withtag taxis] {
    if {[$canvas type $item] eq "text"} {
    $canvas itemconfigure $item -angle 270 -anchor e
    }
    }

    but since this isn't documented, I fear it may change in a future
    version of Plotchart.


    In the function ::Plotchart::DrawTimeaxis , an "-angle" option is absent because
    Plotchart was created before vertical text exists. Just doing the change inside
    and proposing it, with a ticket,
    you will have the best probability it will present in the future ;-) !


    I'm also having a bit of trouble getting the canvas to scroll properly
    which I haven't yet worked out properly.

    Is there a better, preferrably a "supported" way to do this?

    Thanks

    xyplot.tcl do that well, but it is certainly much work to transpose it
    in a "tplot.tcl" envelop for TXPlot ?

    Best regards, Olivier.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Arjen@user153@newsgrouper.org.invalid to comp.lang.tcl on Sun May 11 11:53:17 2025
    From Newsgroup: comp.lang.tcl


    Olivier <user1108@newsgrouper.org.invalid> posted:


    Alan Grunwald <nospam.nurdglaw@gmail.com> posted:

    I'm trying to plot a set of timed values using Plotchart::createTXPlot.


    Plotchart is full of functionalities, but very static. I mean if you have a change in a plot, you have to delete and plot it again. For a more dynamic
    I suggest to build an envelop just the way xyplot.tcl (in the distribution, where plotchart.tcl is).




    In the function ::Plotchart::DrawTimeaxis , an "-angle" option is absent because
    Plotchart was created before vertical text exists. Just doing the change inside
    and proposing it, with a ticket,
    you will have the best probability it will present in the future ;-) !



    Actually, the section "NOTES ON TAGS" does document that tag, it is just
    not clear that it could be used for this purpose. But I like the idea and I will
    implement it. (Indeed angled text did not exist when I set up Plotchart, hence the vtext subcommand to draw a vertical title along the vertical axis.)

    If you create a ticket, then it will not easily be forgotten :).

    Regards,

    Arjen
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Alan Grunwald@nospam.nurdglaw@gmail.com to comp.lang.tcl on Thu May 22 15:04:36 2025
    From Newsgroup: comp.lang.tcl

    On 11/05/2025 12:53, Arjen wrote:

    Olivier <user1108@newsgrouper.org.invalid> posted:


    Alan Grunwald <nospam.nurdglaw@gmail.com> posted:

    I'm trying to plot a set of timed values using Plotchart::createTXPlot.


    Plotchart is full of functionalities, but very static. I mean if you have a >> change in a plot, you have to delete and plot it again. For a more dynamic >> I suggest to build an envelop just the way xyplot.tcl (in the distribution, >> where plotchart.tcl is).




    In the function ::Plotchart::DrawTimeaxis , an "-angle" option is absent because
    Plotchart was created before vertical text exists. Just doing the change inside
    and proposing it, with a ticket,
    you will have the best probability it will present in the future ;-) !



    Actually, the section "NOTES ON TAGS" does document that tag, it is just
    not clear that it could be used for this purpose. But I like the idea and I will
    implement it. (Indeed angled text did not exist when I set up Plotchart, hence
    the vtext subcommand to draw a vertical title along the vertical axis.)

    If you create a ticket, then it will not easily be forgotten :).

    Regards,

    Arjen

    I've just raised a ticket, but failed to note its ID and now can't find
    it. If you give me some pointers, I'd be very happy to have a go at
    putting together an implementation - my email address is on the ticket.

    Alan
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Thu May 22 16:45:57 2025
    From Newsgroup: comp.lang.tcl

    Here is the ticket:

    https://core.tcl-lang.org/tklib/info/5c3ef045947ecc6b

    It requires moderator approval (IMHO a missfeature), so I approved it.

    Thanks,
    Harald

    Am 22.05.2025 um 16:04 schrieb Alan Grunwald:
    On 11/05/2025 12:53, Arjen wrote:

    Olivier <user1108@newsgrouper.org.invalid> posted:


    Alan Grunwald <nospam.nurdglaw@gmail.com> posted:

    I'm trying to plot a set of timed values using Plotchart::createTXPlot. >>>>

    Plotchart is full of functionalities, but very static. I mean if you
    have a
    change in a plot, you have to delete and plot it again. For a more
    dynamic
    I suggest to build an envelop just the way xyplot.tcl (in the
    distribution,
    where plotchart.tcl is).




    In the function ::Plotchart::DrawTimeaxis , an "-angle" option is
    absent because
    Plotchart was created before vertical text exists. Just doing the
    change inside
    and proposing it, with a ticket,
    you will have the best probability it will present in the future ;-) !



    Actually, the section "NOTES ON TAGS" does document that tag, it is just
    not clear that it could be used for this purpose. But I like the idea
    and I will
    implement it. (Indeed angled text did not exist when I set up
    Plotchart, hence
    the vtext subcommand to draw a vertical title along the vertical axis.)

    If you create a ticket, then it will not easily be forgotten :).

    Regards,

    Arjen

    I've just raised a ticket, but failed to note its ID and now can't find
    it. If you give me some pointers, I'd be very happy to have a go at
    putting together an implementation - my email address is on the ticket.

    Alan

    --- Synchronet 3.21a-Linux NewsLink 1.2