Hello,
I looked for the upper shadow and lower shadow properties at the financial price series. What i want to do is to display the upper shadow and lower shadow just like the sample you can find at this image: http://www.onlinetradingconcepts.com/images/candlesticks/CandlestickBasicsChart.gif
I would like to learn if the component supports this or not.
Thanks in advance.
Kadir Sumerkent
Hi Kadir,
Yes, the financial price series does support upper and lower candlestick shadows. Here's a screenshot of what a typical financial price series chart looks like. Also, you can download our samples browser, which has samples and code examples of various charts, including charts and indicators.
http://es.infragistics.com/products/ios/charts/chart - product page with a link to the samples browser
Hi Max,
Thank you for your answer.
I already have the samples browser but i cannot see the sample. Can you write which properties i should use or do you have a sample code.
I'm attaching the sample I used to generate the image in the previous post. Displaying the shadows is the default behavior, so no need to set any properties for that. There was an issue in the past that prevented most of the wicks from showing up. You might want to make sure you have the latest version of NucliOS.
Let me know if you're having any issues with the sample.
Thank you for your reply.
When i run your sample code, i only see the upper shadow in 1 candlestick item and no lower shadows. So i am wondering what is the rule here to display the upper / lower shadows. Or what data does the component needs to display them?
Looks like you're using the version with the bug that I mentioned earlier. You should get the latest service release for NucliOS from our website. If you go to your keys and downloads page (https://es.infragistics.com/my-account/keys-and-downloads) and select NucliOS, towards the bottom of the page you should see a tab with "Service Releases". You should see a service release form last month, which fixes that bug.
I updated the framework and your sample is working as expected. But my source still does not display the shadows. I am using real-time stock price info so i am pretty sure about the issue is not related with data. I am also using the Android version of the component and it works without any problem. So, i am sharing the sources i use to display the chart. Could you please help me to figure our the problem. I suspect the issue might be related with the data source paths?
-(void)formatChartValues:(NSArray*)chartData ix:(int)ix
{
dateArr = [[NSMutableArray alloc] init];
openArr = [[NSMutableArray alloc] init];
highArr = [[NSMutableArray alloc] init];
lowArr = [[NSMutableArray alloc] init];
closeArr = [[NSMutableArray alloc] init];
volumeArr = [[NSMutableArray alloc] init];
labelsArr = [[NSMutableArray alloc] init];
for (NSDictionary* dict in chartData)
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
NSDateFormatter *formatter2 = [[NSDateFormatter alloc]init];
NSString *dateTime = @"";
NSString* shortDate;
BOOL timeAvailable = NO;
if ([[dict valueForKey:@"$"] valueForKey:@"time"])
[formatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"];
dateTime = [NSString stringWithFormat:@"%@ %@", [[dict valueForKey:@"$"] valueForKey:@"date"], [[dict valueForKey:@"$"] valueForKey:@"time"], nil];
timeAvailable = YES;
}
else
[formatter setDateFormat:@"yyyy/MM/dd"];
dateTime = [NSString stringWithFormat:@"%@", [[dict valueForKey:@"$"] valueForKey:@"date"], nil];
NSDate* date = [formatter dateFromString:dateTime];
if (labelsArr.count == 0 || (labelsArr.count == (chartData.count - 1)))
if (ix == 0 && timeAvailable)
[formatter2 setDateFormat:@"dd/MM HH:mm"];
[formatter2 setDateFormat:@"dd/MM/yy"];
switch (ix)
case 0:
if (timeAvailable)
break;
/*
case 3:
[formatter2 setDateFormat:@"MM/yyyy"];
*/
default:
shortDate = [formatter2 stringFromDate:date];
double open = [[[dict valueForKey:@"open"] objectAtIndex:0] doubleValue];
double high = [[[dict valueForKey:@"high"] objectAtIndex:0] doubleValue];
double low = [[[dict valueForKey:@"low"] objectAtIndex:0] doubleValue];
double close = [[[dict valueForKey:@"close"] objectAtIndex:0] doubleValue];
int64_t volume = [[[dict valueForKey:@"volume"] objectAtIndex:0] doubleValue];
[dateArr addObject:date];
[openArr addObject:[[NSNumber alloc] initWithDouble:open]];
[highArr addObject:[[NSNumber alloc] initWithDouble:high]];
[lowArr addObject:[[NSNumber alloc] initWithDouble:low]];
[closeArr addObject:[[NSNumber alloc] initWithDouble:close]];
[volumeArr addObject:[[NSNumber alloc] initWithDouble:volume]];
[labelsArr addObject:shortDate];
if (self.chartView.axes.count > 0)
if ([self.chartView.axes count] > 2) // remove the trendline's xAxis?
[self.chartView removeAxis:[self.chartView.axes objectAtIndex:2]];
[self.chartView removeAxis:[self.chartView.axes objectAtIndex:1]];
[self.chartView removeAxis:[self.chartView.axes objectAtIndex:0]];
source = [[IGOHLCSeriesDataSourceHelper alloc] init];
source.openValues = openArr;
source.highValues = highArr;
source.lowValues = lowArr;
source.closeValues = closeArr;
source.volumeValues = volumeArr;
source.labels = labelsArr;
xAxis = [[IGCategoryXAxis alloc] initWithKey:@"xAxis"];
yAxis = [[IGNumericYAxis alloc] initWithKey:@"yAxis"];
xAxis.labelOrientationAngle = 45;
if (ix == 0)
xAxis.interval = openArr.count / 6;
[self.chartView addAxis:xAxis];
[self.chartView addAxis:yAxis];
if (financialPriceSeries)
[self.chartView removeSeries:financialPriceSeries];
financialPriceSeries = [[IGFinancialPriceSeries alloc] initWithKey:@"financialPriceSeries"];
financialPriceSeries.xAxis = xAxis;
financialPriceSeries.yAxis = yAxis;
financialPriceSeries.dataSource = source;
financialPriceSeries.displayType = IGPriceDisplayTypeCandlestick;
financialPriceSeries.brush = [[IGBrush alloc]initWithColor:[UIColor greenColor]];
financialPriceSeries.negativeBrush = [[IGBrush alloc]initWithColor:[UIColor redColor]];
financialPriceSeries.xAxis.majorStrokeThickness = 0.6f;
financialPriceSeries.yAxis.majorStrokeThickness = 0.6f;
financialPriceSeries.xAxis.majorStroke = [[IGBrush alloc]initWithColor:[INVColor gray25]];
financialPriceSeries.yAxis.majorStroke = [[IGBrush alloc]initWithColor:[INVColor gray25]];
IGChartThemeDefinition* theme = [[IGChartThemeDefinition alloc]init];
theme.font = [UIFont fontWithName:@"Helvetica" size:14];
theme.fontColor = [[IGBrush alloc] initWithR:106.0/255.0 andG:113.0/255.0 andB:120.0/255.0 andA:1];
IGChartPaletteItem* item1 = [[IGChartPaletteItem alloc] init];
item1.color = [[IGBrush alloc] initWithR:8.0/255.0 andG:204.0/255.0 andB:224.0/255.0 andA:1];
item1.outlineColor = [[IGBrush alloc] initWithR:8.0/255.0 andG:204.0/255.0 andB:224.0/255.0 andA:1];
//[theme.seriesPalettes addObject:item1];
self.chartView.theme = theme;
self.chartView.animateSeriesWhenAxisRangeChanges = TRUE;
[self.chartView addSeries:financialPriceSeries];
Hello Kadir,
I wanted to see if you had any more questions on this issue or if the solution Max provided was sufficient.
Thank you,
Darrell
Your code looks right. It worked for me when I tried it in a sample. Your app is probably holding on to the old chart framework. Try clearing framework search path from the project's settings, remove the framework reference from the app, re-add the framework and then clean and rebuild the app.
I'm including your code sample in a project for your reference.