Clear background on chart?


#1

I’m evaluating shinobi charts and seem to have run into an issue: the chart won’t clear the background color from black.

I have a gradient being drawn like this:

    CGGradientRef background = [UIColorFromRGB(self.theme.backgroundFrom) newGradientToColor:UIColorFromRGB(self.theme.backgroundTo)];

    CGContextDrawLinearGradient(context, background, startPoint, endPoint, 0);

    and the chart has been added as a subview of the view. I initialise the chart as follows:

[self.chartapplyTheme:[SChartDarkThemenew]];

    // apply customisations

        self.chart.backgroundColor = [UIColorclearColor];

        self.chart.plotAreaBackgroundColor = [UIColorclearColor];

        self.chart.canvasAreaBackgroundColor = [UIColorclearColor];

The last three lines seem to change the chart, but I still see a black background. Is there a problem here or is it simply that the shinobi controls watermark is drawn using this black background?


#2

Hey Ergodic1,

This sounds like a similar issue to the one raised by mk, here. Are you using version 2.6.0? You can find this out by logging out the result from [_chart getInfo].

Jan


#3

Yes, I just downloaded the trial yesterday and it’s 2.6 from getInfo. The solution you presented in the thread worked, thanks for that.

One last question before I confirm the library will do what we want:

Is it possible to have vertical bar and text overlays? We want to mark out different segments of a dynamically updated chart with up to ~10k data points. There may be 20-60 segments marked out. If you have any examples which draw something like this that would be really useful. I also didn’t know which edition we need to buy to get the overlay/annotation features, can you confirm?


#4

I’m not sure I follow. We have SChartColumn series with should allow you to create vertical bars, and we have SChartAnnotations which should allow you to add text overlays to your chart. Do you think you could provide a sketch or something to demonstrate what you are trying to acheive?

(You’ll need the Premium version of ShinobiCharts for annotations :laughing:.)

Jan


#5

I figured out how to do what I wanted using the [SChartAnnotation verticalLineAtPosition …] function. It works really well.

I was wondering where the source code for the tour de france example in the sample app is. I am wanting to make the annotations work in the same way as in the example (i.e. to only show when they can fit on the screen).