Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
Plot area background.
posted

I want to use a custom view as the chart's plot area. I can't use the chart's plotAreaRect property because I'm using Auto Layout (updating the custom view's size based on it in the VC's viewDidLayoutSubviews didn't work either). The only two options left seem to be:

1. Not to use Auto Layout for the custom view and manually set frames. This could also not work because the rest of the system is still using Auto Layout and I can't find the exact correct time to query the plotAreaRect. And I'm already heavily invested in Auto Layout. So I really don't want to go down this path.

2. Constrain the custom view's size to be the chart's size. Make the chart's plot area transparent and the chart's chrome to the color I want. That way the custom view will be underneath the chart and because the plot area is transparent the custom view will only cover the plot area. The only problem is that this seems impossible to do with the library. I'm using a IGChartThemeDefinition and you can only change the whole chart's color, you can't exclusively color the chrome so that the plot area stays transparent.

It seems that I have no way to achieve what I want. The easiest way to solve my problem would be to add a plotAreaBackgroundView property on the chart (which would be placed underneath the chart's scrollview).

Parents
No Data
Reply
  • 275
    Verified Answer
    posted

    I decided to get around this by:

    - Setting the chart and the plot area to transparent.
    - Add a custom background view behind it.
    - Make the custom background view the same size of the chart.
    - Add a custom view with a hardcoded height (size of the chrome of the chart) on top of the custom background view but underneath the chart).

Children