[kde-edu]: [Plotting] Offset/margin for data

Jason Harris kstars at 30doradus.org
Mon Oct 30 18:10:45 CET 2006


Hi Carsten,

I was thnking about this too when I did the fix in kalzium, so I'm
glad you've brought it up here.

I'd prefer to keep it simple, just have a function
KPlotWidget::setAutoLimits() which will set the limits appropriately
to show all of the plot's KPlotObjects, plus a 5% buffer along each
margin.  I don't think we need setAllowNegativeOffset(); if the data
points are all non-negative, then the 5% buffer should never be enough
to cause a labeled tickmark with a negative value.

One question:  Should setAutoLimits() trigger automatic updates to the
limits when KPlotObjects are added/removed/modified?  Or should the
pattern be that people set up the KPlotObjects, and then call
setAutoLimits() when they want to set the limits?

We could also provide variants setAutoXLimits() and setAutoYLimits(),
in case the user wanted to set the limits on one axis manually, and
let the code pick the optimal limits for the other axis.

Jason

On 10/30/06, Carsten Niehaus <cniehaus at gmx.de> wrote:
> Moin
>
> Imagine a dataset from 5 to 120 (x) and 1 to 200 (y).
>
> I think there should be a way to plot that data like this:
>
> 1.) Creating the KPlotObject and adding all QPointF's to it
> 2.) Tell the KPlotWidget: Plot this object
> 3.) Tell the KPlotWidget to plot so that the data fits perfectly with an n%
> offset (margin). In this case the widget would plot from lets say 0 to 125
> and -3 to 204 or something.
>
> Advantage: The app-devels wouldn't need to care about this (like Jasons fixed
> Kalzium some hours ago), they would just tell the KPlotWidget to take care of
> an offset.
> Of course we'd need to agree on the value of n for the default-percentage and
> we'd need a setOffsetPercentage( double value ). I vote for 5% default.
> Perhaps we'd also need an setAllowNegativeValueOffset( bool b ) because often
> negative value don't make any sense (size of persons against their weight).
> Perhaps we'd need those setting per axis...
>
> Comments?
>
> --
> Gruß,
>   Carsten Niehaus
>
>
> _______________________________________________
> kde-edu mailing list
> kde-edu at mail.kde.org
> https://mail.kde.org/mailman/listinfo/kde-edu
>
>
>
>


More information about the kde-edu mailing list