[Lazarus] TAChart 2nd Y Axis

Alexander Klenin klenin at gmail.com
Fri Jul 29 07:21:05 CEST 2011


Please, do not top-post. It makes it very hard to read and reply to
your messages.

On Fri, Jul 29, 2011 at 15:56, David M. Lawrence <dave at fuzzo.com> wrote:
> No, they happened when I tried to plot the chart.  I couldn't figure out how
> to implement the auto-scaling transformation from the demo.  For example, I
> see catTAuto listed as a transformation in the object inspector and listed
> as a property in the axisdemo main.pas, but cannot find any code to
> implement it there.  I do see it mentioned in main.lfm, but don't understand
> how it works -- it seems to list properties for the transform more than
> anything else.

There is no code -- just setting correct properties is enough.

> In any event, for consistency's sake I need to maintain axes of -90 C to 60
> C for the temperature axis, and 0 cm to 300 cm for the precipitation axis.
>  Since I plot up to three temperature series, it's easier to set that as
> fixed and figure out how to transform the precipitation axis.
>
> You seem to have a lot invested in the idea that flexible transformations
> are best from a coding standpoint, but the hundreds of charts I plot have to
> be plotted consistently -- there can be no individualized scaling.  The bars
> on a graph from a site with a maximum monthly precipitation of 20 cm need to
> be one-tenth as tall as the bars from a site with maximum monthly
> precipitation of 200 cm.  I am not just comparing the bars and lines on an
> individual chart, I am comparing one chart to similar charts from hundreds
> of sites around the world.  That way I and others can tell the chart from a
> desert site, for example, from that of a tropical rainforest site or monsoon
> forest site.  From that standpoint, being able to independently set max and
> min values for each vertical axis would be a lot better.

I see now -- so you actually do NOT want auto-scale, but a fixed scale.
In this case, simply use linear transformation and then Chart.Extent property.

You will have to calculate scale and offset yourself (once, at design-time).
(From my quick calculation, you should use scale=0.5 and offset=-90,
but check yourself)

Note, however, that if by chance your data will be outside of the
designated extent,
it will be cut off.

I can see your point for axis min/max values, so maybe I implement them.
However, how should they behave in the case of out-of-bounds data points
I described above?

-- 
Alexander S. Klenin




More information about the Lazarus mailing list