Is there a IGGaugeRange equivalent for IGChartView that allows me to place brushed bands across a series?
Something like this...
You would have to use another series as the range. Unfortunately, there isn't a simple way to break apart an axis into colored ranges. It might be a neat feature to have something like an IGRangeOverlay that behaves like an IGOverlay, but instead of a line, shows an area. At the moment, the only way to have such ranges is to use another series as the first series in the chart. You could either try a StackedColumnSeries or a couple of RangeAreaSeries. Ranges can share your existing Y axis, but not the X axis.
IGHighLowSeriesDataSourceHelper *dsh1 = [[IGHighLowSeriesDataSourceHelper alloc]initWithHighValues:@[@10,@10] andLowValues:@[@0,@0]];
IGRangeAreaSeries *fill = (IGRangeAreaSeries*)[_chartView addSeriesForType:[IGRangeAreaSeries class] usingKey:@"fill" withDataSource:dsh1 firstAxisKey:@"fillXAxis" secondAxisKey:@"y"];
IGCategoryXAxis *fillAxis = (IGCategoryXAxis*)[_chartView findAxisByKey:@"fillXAxis"];
fillAxis.labelsVisible = NO;
This idea dovetails nicely into what I need to do. I'll give it a shot and report back.
Is it possible to mix stacked and non-stacked series on the same chart?
Can you help me out and post a sample IGStackedSeriesDataSourceHelper to mimic the image I supplied above? I don't know how to use the Stacked DSH properly... let alone improperly. ;)
I tried setting up something like this...
-(void)updateRanges:(id)sender
{
NSNumber *upper = @(50);
NSNumber *lower = @(-10);
self.stackedAreaDSH = [[IGStackedSeriesDataSourceHelper alloc] initWithData:@[ lower, upper ] fields:@[ @"floatValue" ]];
self.stackedAreaSeries.dataSource = self.stackedAreaDSH;
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[IGCategoryDatePoint floatValue]: unrecognized selector sent to instance 0x16d214d0'
Which comes from this line of code:
[self.chartView insertItemAtIndex:(self.trendData.count-1) withSource:self];
Try this sample. I set up 3 ranges and if you tap any of the series the ranges change values.
I kept most things pertaining to the stacked series separate. Just felt a bit cleaner that way.
Let me know if you run into any issues.
Thank you for the sample. The issues are plenty... ah!
The one issue that stands out is how to handle overlaps. That's a tricky area, and something that needs to be supported. That said, I'm thinking about drawing a custom image. Is there a way to either: 1) set the series background as an image, or 2) get the bounds of the series so that an image context can be created and aligned successfully ?
Thanks!
I'll make a note of this and revisit in a few days. Thank you.
Are you using NucliOS 14.1 by chance? We've added a plotAreaRect property to the chart to get the chart's viewport bounds.
If you have two overlapping ranges that you want to represent on the chart.
60F - 105F = Range that represents habitable temperatures for humans
68F-74F = Range that represents ideal temperature for humans
Since it isn't possible to set the background for the series, but you can for the entire chart... Is it possible to get the coordinates of the series so I draw the image appropriately?
Caylan,
I'm not sure what you mean by the overlaps, can you give an example?
Unfortunately, you can't set a background image to the plot area.