Clear Background Color Problem in Charts in Version 2.6.0


#1

After switching to the new version (2.6.0) of charts, I can’t seem to set the background color to be clear no matter what I do. I set the canvasBackgroundColor, backgroundColor, plotAreaBackgroundColor all to clearColor, and stll the background color appears black. I do the above for both the theme and dirrectly on the graph. I have also tried different combinations of the above and still the color will not be clear. If I remove the theme altogether and don’t set the colors dirrectly on the chart, the color I get as the chart background color is light gray. Any idea of what has changed and caused this problem? The same code worked perfectly on the last version of charts. 

EDIT: To be more clear: If I set the color to be clear, I get black as the background. If I do not set any styling, I get light gray as the background. 

Thanks,


#2

Hi mk,

That’s strange - I’ve raised a ticket to look into it. In the meanwhile, try changing the background colour of the actual UIViews after the chart has rendered. The perfect place to do this is sChartRenderFinished: delegate method. I’ll list below the views that correspond to the different parts of the chart:

  • canvasBackgroundColor = chart.canvas.backgroundColor
  • backgroundColor = chart.backgroundColor
  • plotAreaBackgroundColor = chart.canvas.glview

You’ll need to import “SChartCanvas.h” and “SChartGLView.h” too. I know this isn’t ideal and we’ll look into a fix, but I just wanted you to have a suitable workaround until then.

Please let me know if you have any trouble with the above method.  :laughing:

Thanks,

Jan 


#3

This is not working.

Our application is now totally messed up :cry:

EDIT: To be more clear.  There is no clear.  We cannot set the background transparent anymore.


#4

I managed to replicate this black background. We’ll look into getting a fix out as soon as possible. We’ll post back when we have more information.

I tested the above workaround locally and I managed to get my chart completely clear using the plotAreaBackgroundColor and canvasAreaBackgroundColor properties normally, and altering my chart background colour as shown below:

-(void)sChartRenderFinished:(ShinobiChart *)chart {
    _chart.backgroundColor = [UIColor clearColor];
}

When you say this totally messed up your application, can I ask exactly what happened?

Jan


#5

Yes i have the same problem on simulator and devicde (iPhone 5S / iOS7.1) . But Jan´s code snipped work´s well. 

thx.


#6

We got it working now.  We have to be careful in the order of apply the chart to the view and settings the colors.

Since the change of the themes we have problems with fonts and alignment, but mostly we have it solved now.


#7

That’s great news stevenp. We’re going to look into this still but I’m glad you’ve managed to find a workaround for the meanwhile.

Jan


#8

Thanks Jan, this works fine.