I intend to ressuscitate another very old project of mine written in Tcl
that I never published. This one performs tests on multiple file systems, measures the performance of each one then prints a bar chart with the comparison of all tests. The core code is all done, has been for over a
decade, and it successfully prints the charts in HTML.
But I want to fancy it up this time. I want to print the charts in Tk canvas widgets. Maybe even add a little interactivity. I will see about that.
I'm not looking at any chart code on the wiki or the Internet. I want to learn about canvas along development of the project. It's supposed to be educational. I sketched something very rough and my big struggle is not with Tcl/Tk, but with the math. I've never been good at math.
For the large view, I have decided on an area of 900 pixels high and at least 1800 pixels wide. I can afford more. Scaling that size for different screen sizes and resolutions will be another problem later. The small view will be an easy fraction of the large view, e.g. 900 -> 90 or 900 -> 180.
Anyway, I am mostly concerned with height right now. I want to have a vertical ruler with marks on the side of the chart. Each chart will have maximum and minimum values. I want those values in the ruler to be reasonably round, for example in increments of 10 or 50 or 100. Something like that. But the chart bar values will rarely be round. Not only that, they will vary a lot in magnitude. One chart will measure minutes and seconds, another chart will measure Megabytes or Gigabytes, another chart will count the number of files
or remaining free space, and so on. With all that in mind, everything in every chart has to look reasonably about the same size.
So my question is, how do I enforce some kind of universal measure that will translate raw values into proportional screen real estate units?
Also, the vertical ruler has labels so its maximum value is actually 20 pixels under the 900-pixel border so there is room for the label to sit on top of it, but that will certainly vary because I always write my applications to allow easy customization of visual elements such as font face and size, colors etc. If the user changes font size, that "attic" size will change too.
It's not really a Tcl question, it's a math question. I hope I'm not asking
too much. Thank you for any help as usual.
I wish you all a happy Sunday and a prosperous week.
--
Luc
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)