Forum > TAChart

Extent ov overlaps labels


I show a full screen of my app.  There are two charts linked with a chartextentlink.   As can be seen the lower chart (chart1) has the grid positioned more to the left than the higher chart (chart2) and overlaps the labels.   This is also the case in form(design) mode.   I have tried to compare all the properties for the 2 charts to maybe get a clue as to why it should be so but without success.   I hope someone can explain this.
PS  Plese use the scroll facility to view the right hand side of the grids

Right, this is a weakness of the way the ChartExtentLink works. I played a lot with it, but can offer you only a workaround: The extent link auto-creates right axes for both charts. By default labels are turned off for these axes - but this blocks the ChartExtentLink to work correctly. Simply turn on the Marks of the right axes (Marks.Visible := true), and the right sides will be aligned, however, the left axes labels will appear also at the right axes.

These are the steps to follow:

* Add the two charts, their series and align them
* Add a TChartExtentLink
* Add the two charts to the LinkedCharts property of the ChartExtentLink
* In order to align the horizontal axis range only, set ChartExtentLink.Mode to elmOnlyX
* Now, in order to align the position of the left and right sides check the options calLeft and calRight of ChartExtentLink.AlignSides.
* Make sure that ChartExtentLink.AlignMissingAxes is checked - this creates auxiliary untitled right axes for both charts. However, there's a bug ATM which does not update the object inspector immediately; you may have to close and reload the form to see them in the object tree of the object inspector.
* Finally, select the right axis of the top chart in the object tree of the object inspector and set its Marks.Visible to true - this repeats the left axis labels on the right axis.
* Repeat with the right axis of the bottom chart.See screenshot and attached project.

Hi WP thank you for your help.  The AlignSides property is not shown on my version of Lazarus (2.0.6 FPC 3.0.4) so I will update so I can follow your intructions.

Yes, I should have mentioned that this feature is in Laz 2.2(RC2) or Laz/main only.

WP my charts work correctly now so many thanks and I have an updated version of Lazarus into the bargain.   Since the update there is a problem changing the main form background colour but I will post this separately so as not to confuse subjects.


[0] Message Index

Go to full version