WAxis is highly specialized
Added by Thomas Suckow over 14 years ago
WAxis is completely dependent on WCartesianPlot. It would be nice to have something a bit more generic, ala QwtAbstractScale. This would make other plot types (Spectrogram, Contour) much easier to implement.
Replies (5)
RE: WAxis is highly specialized - Added by Koen Deforche over 14 years ago
Hey Thomas,
You are certainly right: WAxis was implemented with only WCartesianChart in mind, and there is some suspicious mixing of concerns, e.g. the axis is determining the extreme values of the chart, rather than simply asking them (and let the chart provide the extremes).
If I understand correctly: WAxis should be split in a WAbstractScale and WCartesianAxis (aka current WAxis) which still has about the same API, but which would allow other axis implementations that tie with other chart implementations ?
What other implementation do you have in mind, btw, and what algorithmic aspects (such as determining ticks & labels) of WAxis would you like to reuse, if any ?
Regards,
koen
RE: WAxis is highly specialized - Added by Thomas Suckow over 14 years ago
I am playing with the idea of:
WAbstractScale <- WNumericScale
WAbstractScale <- WDateTimeScale
WAbstractScaleEngine <- WLinearScaleEngine
WAbstractScaleEngine <- WLog10ScaleEngine
The WAbstractScale would handle drawing of the scale.
The WAbstractScaleEngine would handle transformations for the axis & determine ticks.
The AbstractScale would expose how much space a label takes up and allow determining the maximum number of major ticks.
I'm sifting through WAxis trying to understand exactly how it decides ticks.
Mostly the idea with this is separate the drawing from the scaling. I in no way believe this is the best way, any input is encouraged.
RE: WAxis is highly specialized - Added by Thomas Suckow over 14 years ago
The other concept is that there should be no need to have the switch statements for the types.
RE: WAxis is highly specialized - Added by Thomas Suckow over 14 years ago
Also the ScalingEngine (or whatever provides the transformation) needs to have an inverse transformation because in the case of the spectrogram plot you iterate over pixels instead of points.
RE: WAxis is highly specialized - Added by Thomas Suckow over 14 years ago
Code showing what I was thinking is in #511