scales and axes
scales and axes
The conceptualization of TeeChart might be enhanced if the notions of axis and scale were separated. When a series (say, temperatures on dates) is plotted, there must be vertical & horizontal axes with minima and maxima, to determine what temperatures are too low or too high, and what dates are too early or too late, to plot. After those limits are imposed, however, the user should be able to see multiple scales (say, Fahrenheit & Celsius, or calendar date & day of year) to help interpret the data.
I have implemented a fairly general workaround (see the attachment), but it would be less of a kludge if the axis/scale distinction were directly supported by TeeChart.
I have implemented a fairly general workaround (see the attachment), but it would be less of a kludge if the axis/scale distinction were directly supported by TeeChart.
- Attachments
-
- ScaleTest.zip
- demo
- (509.99 KiB) Downloaded 1870 times
Re: scales and axes
I have simplified the implementation of this workaround.
As TeeChart now works, every tChartAxis seems to need to have at least one associated series, even if that series contains no data. My earlier implementation required that empty series be added to the target tCustomChart at design time. It turns out that the necessary pro-forma series can be created at run time when the new scales are created.
A demo package is on my Web site at https://www.fenichel.net/programs/ScaleTest.zip.
As TeeChart now works, every tChartAxis seems to need to have at least one associated series, even if that series contains no data. My earlier implementation required that empty series be added to the target tCustomChart at design time. It turns out that the necessary pro-forma series can be created at run time when the new scales are created.
A demo package is on my Web site at https://www.fenichel.net/programs/ScaleTest.zip.
Re: scales and axes
Hello,
Thanks for the ideas and the code example.
Your
I've created an issue at bugzilla to discuss about it with the team: #2737
Thanks for the ideas and the code example.
Your
tScale
class looks interesting.I've created an issue at bugzilla to discuss about it with the team: #2737
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: scales and axes
I have further tweaked my implementation. Now it allows the outlying scales to be arbitrarily computed from the parent axes. The updated demo has replaced the older one on my Web site.
Re: scales and axes
Hello,
Thanks. I've updated the ticket also.
Thanks. I've updated the ticket also.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: scales and axes
I've tweaked it yet again. Updated version on my Web site at https://www.fenichel.net/programs/ScaleTest.zip.
Re: scales and axes
Hello,
Thanks. I've updated the ticket.
Thanks. I've updated the ticket.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: scales and axes
An old issue that should be somehow linked to the scales & axes discussion is control of the spacing between an axis (or scale) and its title. The spacing automatically applied seems to take account of the axis's label size, but often that spacing is unnecessarily large. As seen in my scale/axis demo, this is a greater problem when a scale is parallel to an axis, and the (inner) axis label is positioned so far out that it wrongly looks as if it belongs to the (outer) scale.
It might be possible to improve the automatic spacing, but instead (or also) you might add a new, user-controllable Title.Position2 parameter, working at right angles to the axis while the existing Title.Position parameter would continue to work parallel to the axis.
It might be possible to improve the automatic spacing, but instead (or also) you might add a new, user-controllable Title.Position2 parameter, working at right angles to the axis while the existing Title.Position parameter would continue to work parallel to the axis.
Re: scales and axes
How does TChart determine the left-to-right order of a vertical axis and its title? Is there a way to control this?
- The title is always to the left of the left axis. Good.
- The title is always to the right of the right axis. Good again, but
- The title seems to be fixedly to the left of a created axis, even when this axis is created as an auxiliary right scale.
Re: scales and axes
Hello,
Let me simplify it talking about the vertical axis; the according variations would apply to the horizontal axis.
The x position to draw the left axis title is calculated considering the width of the left axis labels. Why we don't provide mechanisms to modify this x position as we consider this is the behaviour the majority of users would expect. Could you please confirm this the you are willing to modify?
If so, for now I'd suggest you to draw your title manually at the
Let me simplify it talking about the vertical axis; the according variations would apply to the horizontal axis.
The x position to draw the left axis title is calculated considering the width of the left axis labels. Why we don't provide mechanisms to modify this x position as we consider this is the behaviour the majority of users would expect. Could you please confirm this the you are willing to modify?
If so, for now I'd suggest you to draw your title manually at the
OnAfterDraw
event.Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: scales and axes
Yes, that's what I want to modify.The x position to draw the left axis title is calculated considering the width of the left axis labels. Why we don't provide mechanisms to modify this x position as we consider this is the behaviour the majority of users would expect. Could you please confirm this the you are willing to modify?
- As seen in my scale demo, the default title position of the left axis is sometimes far to the left of the axis. This position makes it difficult to place a scale slightly further left, without adding a lot of blank space to the margin.
- As I noted in my message, the title position of a created vertical axis seems always to be the left of the axis. This looks silly when the new axis is to be placed as an alternative scale for the right axis.
Well, yes, but OnAfterDraw here is an admission of inadequate parameterization. An alternative might be to create two axes for each scale, one visible with no title, and one invisible with a visible title. It's hard to say which of these solutions is uglier.If so, for now I'd suggest you to draw your title manually at the OnAfterDraw event
Re: scales and axes
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: scales and axes
I've looked into the approach of controlling an axis's title position (normal to the axis) by using a separate title axis for each axis (including each added axis-as-scale). It works well as a means of providing left and bottom scales, but it started becoming a hairball when I tried to extend it to the right side. Because the right axis sits at X=100, I expected its default PositionPercent to be 100, with increases moving it further right, analogous to the axes that sit at X=0 and Y=0 and have default PositionPercents of 0, with increases in PositionPercent resulting in increases in those coordinates.
Coping with the special properties of the right axis (Default PositionPercent of 0, with increases decreasing X) would require looking out for it whenever, for example, one wanted (see my ToggleGrid method) to swap the positions of the right-axis scale and an auxiliary right-sided scale. Feasible, but unattractive.
Do you have any idea where your #2740 stands in your queue?
Coping with the special properties of the right axis (Default PositionPercent of 0, with increases decreasing X) would require looking out for it whenever, for example, one wanted (see my ToggleGrid method) to swap the positions of the right-axis scale and an auxiliary right-sided scale. Feasible, but unattractive.
Do you have any idea where your #2740 stands in your queue?
Re: scales and axes
Hello,
We are working on a new
This is how it looks for now:
Note in that trackbar I'm setting all 4 axes at once, but that's property is per-axis.
I'm afraid that property won't get into the build we are preparing to support the new RAD 12.2.
We are working on a new
Distance
property.This is how it looks for now:
Note in that trackbar I'm setting all 4 axes at once, but that's property is per-axis.
I'm afraid that property won't get into the build we are preparing to support the new RAD 12.2.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: scales and axes
That looks good. I'll look forward to seeing it in your build for Delphi 7. Thanks for the rapid response.