[kde-edu]: KPlotWidget ideas

Andreas Nicolai Andreas.Nicolai at gmx.net
Mon Jun 20 14:35:10 CEST 2005


Hello,

> 1) I'd like to rename some functions in KPlotAxis to make it clearer
> what they do.  The functions that deal with tickmark labels are named
> with "label", which is a bit confusing, because label() and setLabel()
> refer to the *axis* label, not the tick labels.  I'd like to change to
> "tick" in the following functions:
>
> labelFieldWidth() --> tickFieldWidth()
> setLabelFormat() --> setTickFormat()
> labelFmt() --> tickFormat()
> labelPrec() --> tickPrecision()
>
> ...or maybe "tickLabel" instead of "tick"?  too wordy?

Agreed, I was thinking about that as well. I'd prefer replacing label with tickLabel and I wouldn't mind the extra typing :-)

> 2) Should we add RightAxis and TopAxis, which can be independent of
> BottomAxis and LeftAxis?  I already use this in my subclass
> (KStarsPlotWidget), but one could argue that we don't need this in the
> base class.

Yes, per default right and top axes labeling should be turned off, tick mark drawing is on by default.

> 3) Control over whether to show axes, tickmarks, and tick labels should
> be moved to KPlotAxis, so that it can be controlled separately for each
> axis.  Maybe still have some convenience functions in KPlotWidget to
> control both axes at once.  Maybe instead of using DataRect in
> KPlotWidget, we should keep the limits in KPlotAxis as well
> (KPlotAxis::min() and max()).

Yes, that's what I had in mind. We can even "outsource" the axis drawing code to each axis object and let the plot widget simply call each axis to draw itself.

Technical Design Question: If we move the drawing and padding rendering functionality to each axis, we could provide the means that a user can subclass an axis and provide his own axis drawing implementation. Do you think this is reasonable? That would mean that axis objects are access rather like:

plotWidget->LeftAxis()->setTickLabelFormat(...)

and we need to provide  extra functions like:

MyOwnAxis * axis = MyOwnAxis();
plotWidget->setLeftAxis(axis); // assigns user define axis
plotWidget->resetLeftAxis();   // assigns default axis

What do you think?

Bye,
Andreas

-- 
Andreas Nicolai                   Andreas.Nicolai at gmx.net
Syracuse University               +01 (315) 443 1099
151 E.A.Link Hall
Syracuse NY 13244-1240


More information about the kde-edu mailing list