Recent

Author Topic: [solved] Hint needed for transformation setting  (Read 353 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1009
[solved] Hint needed for transformation setting
« on: August 30, 2024, 04:45:30 pm »
I have a chart with 2 series (there are more, but the question shall be easy).
The user may change the series input and the range of the chosen series will be unpredictable. It may be 0,003 or 10.000.

If I draw only one series it looks fine (sreenshot second chart).
If I draw both - not (sreenshot first chart).

This is what I tried.
- I linked both series to the left axis (the right axes is needed for something else).
- I added to each series a transformation
- I added to each transformaton an autoscale (screenshot third element)

What did I miss?
Thankk you.
« Last Edit: August 30, 2024, 08:31:23 pm by Nicole »

wp

  • Hero Member
  • *****
  • Posts: 12354
Re: Hint needed for transformation setting
« Reply #1 on: August 30, 2024, 06:16:22 pm »
If I did not forget something this should work:
  • You need a vertical axis (y) for each series.
  • Each series must have the index of "its" axis in the AxisIndexY property.
  • You need a ChartAxisTransformations component for each vertical axis. Add an Autoscale transform for each case.
  • Assign the first Transformations component to the first y axis (Axis.Transformations), then the second transformations to the second y axis, etc.
  • Try to use the same color for each series-axis-transformations combination. Otherwise the chart will be very difficult to understand.
See attached project. And study tutorial https://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Dual_y_axis,_Legend

BUT: I think overlaying two (or even more) financial series charts in such a way is kind of "cheating". Suppose a very dynamic stock which grew by 100% over this period of interest, and then overlay an almost static stock which grew by only 0.1% over this period. Both overlaid series will show the same dynamic range in the chart!

I would prefer a chart in which all stock prices are normalized to 100% at a given date. And then you plot all series to the SAME axis. Now the dynamic range will be preserved - the first (dynamic) series will show a large increase, the second series will be almost horizontal.

Nicole

  • Hero Member
  • *****
  • Posts: 1009
Re: Hint needed for transformation setting
« Reply #2 on: August 30, 2024, 08:31:06 pm »
Thank you so very much. I worked at sudden.
I did not have a second axes.

And thank you for the demo, it will go into my code-snipet library.

 

TinyPortal © 2005-2018