Recent

Author Topic: Extent ov overlaps labels  (Read 6004 times)

ronhud

  • Jr. Member
  • **
  • Posts: 84
Extent ov overlaps labels
« on: December 03, 2021, 01:12:23 pm »
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
« Last Edit: December 07, 2021, 03:11:19 pm by ronhud »

wp

  • Hero Member
  • *****
  • Posts: 11856
Re: Extent ov overlaps labels
« Reply #1 on: December 07, 2021, 10:58:02 pm »
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.

ronhud

  • Jr. Member
  • **
  • Posts: 84
Re: Extent ov overlaps labels
« Reply #2 on: December 08, 2021, 12:04:35 pm »
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.

wp

  • Hero Member
  • *****
  • Posts: 11856
Re: Extent ov overlaps labels
« Reply #3 on: December 08, 2021, 12:11:42 pm »
Yes, I should have mentioned that this feature is in Laz 2.2(RC2) or Laz/main only.

ronhud

  • Jr. Member
  • **
  • Posts: 84
Re: Extent ov overlaps labels
« Reply #4 on: December 09, 2021, 11:49:09 am »
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.

 

TinyPortal © 2005-2018