I use an UIImageView to show certain color levels on charts. The image view's frame is set to the chart's plotAreaRect. This works great for horizontal scrolling, however, my app now requires vertical scrolling. What is the easiest way to zoom on this image? There are a few mockups at this link - http://ko.infragistics.com/community/forums/t/91669.aspx.
Hello,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.
So in this case you will have to listen to chart’s chartViewDidScroll and chartViewDidZoom and look at the chart’s zoomScale and zoomContentOffset. I think this will let you set the correct size for the background image.
Another options would be if you use StackedColumnChart applied to the approach suggested by Max, here is the modification which you will need to do:
/* Set up the background ranges using a stacked series */
_stackedData = [[NSMutableArray alloc]init];
StackedData *obj = [[StackedData alloc]init];
obj.range1 = 20;
obj.range2 = 30;
obj.range3 = 50;
StackedData *objAlternate = [[StackedData alloc]init];
objAlternate.range1 = 30;
objAlternate.range2 = 30;
objAlternate.range3 = 40;
//we need two points to make an area.
for (int i = 0; i < 20; i++) {
[_stackedData addObject:obj];
[_stackedData addObject:objAlternate];
}
_stackedDSH = [[IGStackedSeriesDataSourceHelper alloc]initWithData:_stackedData fields:@[@"range1",@"range2",@"range3"]];
_stackedSeries = (IGStackedAreaSeries*)[_chart addStackedSeriesForType:[IGStackedColumnSeries class] usingKey:@"stackedSeries" withDataSource:_stackedDSH firstAxisKey:@"stackedXAxis" secondAxisKey:@"y"];
_stackedSeries.xAxis.labelsVisible = NO;
_stackedSeries.xAxis.gap = 0;
_stackedSeries.thickness = 0;
_stackedSeries.outline = [[IGBrush alloc] initWithColor:[UIColor clearColor]];
I hope that this will helps you.
The reason to use background image is because of overlapping ranges. In my app, I have devised a way to show overlap using a generated image.
Hello ,
When you use an image as a background, to scale it correctly you will have to listen to chart’s chartViewDidScroll and chartViewDidZoom and look at the chart’s zoomScale and zoomContentOffset. I think this will let you set the correct size for the background image.
However I can’t see obvious reason to use background image to show threshold ranges, this approach involves drawing, calculating and mapping of the ranges with the chart scale, and also clause this issue which you mentioned right now. Instead you could use the approach which Max was suggested into the forum which you pointed and to use StacedAreaSeries which will serves as threshold ranges.
Please let me know if you have any further questions.