Re: Plotchart - t-axis labels

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Plotchart - t-axis labels
De : user1108 (at) *nospam* newsgrouper.org.invalid (Olivier)
Groupes : comp.lang.tcl
Date : 08. May 2025, 19:00:47
Autres entêtes
Message-ID : <1746727247-1108@newsgrouper.org>
References : 1
User-Agent : Newsgrouper/0.7.2

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.

Date Sujet#  Auteur
4 May 25 * Plotchart - t-axis labels5Alan Grunwald
8 May 25 `* Re: Plotchart - t-axis labels4Olivier
11 May 25  `* Re: Plotchart - t-axis labels3Arjen
22 May 25   `* Re: Plotchart - t-axis labels2Alan Grunwald
22 May 25    `- Re: Plotchart - t-axis labels1Harald Oehlmann

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal