SChartDiscontinuousDateTimeAxis delete all candles from the chart


#1

Hi!

When i use:

SChartDateTimeAxis *xAxis = [[SChartDateTimeAxisalloc] init];
 _chart.xAxis = xAxis;
 i have the next result: https://www.dropbox.com/s/vggjhcgevi5uuri/SChartDateTimeAxis_1.png?dl=0  
But when i want to delete weekends and use:  
NSDateFormatter *cutDateFormatter = [[NSDateFormatteralloc] init];
[cutDateFormatter setDateFormat:@"dd-MM-yyyy"];
 NSDate *cutDate = [cutDateFormatter dateFromString:@"04-01-2014"];
 
SChartDiscontinuousDateTimeAxis *xAxis = [[SChartDiscontinuousDateTimeAxisalloc] init];
SChartRepeatedTimePeriod *weekends = [[SChartRepeatedTimePeriodalloc] initWithStart:cutDate
                                                                               andLength:[SChartDateFrequency dateFrequencyWithDay:2]
                                                                            andFrequency:[SChartDateFrequency dateFrequencyWithWeek:1]];
 [xAxis addExcludedRepeatedTimePeriod:weekends];
 _chart.xAxis = xAxis;
 i have: https://www.dropbox.com/s/73bfr5kiayk6a34/SChartDateTimeAxis_2.png?dl=0 (just black window without candles) Please help? What is wrong? Where is a problem?

#2

Hi Artsiom,

Sorry it’s taken us a while to get back to you.

Would you mind letting me know which version of ShinobiCharts you are using? NSLogging [ShinobiCharts getInfo] should give you it.

From what you’ve given above, I can’t see why you should be getting a black screen. Is there any chance you could manipulate our CandlestickChart sample project to replicate your issue to info@shinobicontrols.com quoting this forum post?

Doing a similar thing in the sample seems to produce what you’d expect and doesn’t result in a black screen (using v 2.7.3.hotfix2-3 )

// Replace Candlestick Sample xAxis creation code with the following
NSDateFormatter *cutDateFormatter = [[NSDateFormatter alloc] init];
    [cutDateFormatter setDateFormat:@"dd-MM-yyyy"];
    NSDate *cutDate = [cutDateFormatter dateFromString:@"20-01-07"];
    
    SChartDiscontinuousDateTimeAxis *xAxis = [[SChartDiscontinuousDateTimeAxis alloc] init];

xAxis.title = @"Date";
    
SChartRepeatedTimePeriod *weekends = [[SChartRepeatedTimePeriod alloc] 
   initWithStart:cutDate andLength:[SChartDateFrequency dateFrequencyWithDay:2]
   andFrequency:[SChartDateFrequency dateFrequencyWithWeek:1]];

[xAxis addExcludedRepeatedTimePeriod:weekends];
_chart.xAxis = xAxis;

Many thanks,

Sam