i'm using shinobichart
draw candlestick stock chart. data discontinuous, there gaps on chart.
anybody knows how can make show continuously? cannot find in documentation...
ok, have found it. reference: instead of adding schartdatetimeaxis
instead should add schartdiscontiniousdatetimeaxis
.
then gap in dataseries have explicitly exclude time period addexcludedtimeperiod:
. (you can checking whether next day same next date in dataseries).
schartdiscontinuousdatetimeaxis *xaxis = [[schartdiscontinuousdatetimeaxis alloc] init]; (nsuinteger iter = 0; iter < self.quotes.count - 1; iter++) { nsdate* thisdate = ((tbhistoricquote*)self.quotes[iter]).date; nsdate* nextdate = [[nscalendar currentcalendar] datebyaddingunit:nscalendarunitday value:1 todate:thisdate options:0]; nsdate* nextserieselementdate = ((tbhistoricquote*)self.quotes[iter+1]).date; nscalendar *calendar = [[nscalendar alloc] initwithcalendaridentifier:nscalendaridentifiergregorian]; if ([nextdate compare:nextserieselementdate] == nsorderedascending ) { nsdatecomponents *components = [calendar components:nscalendarunityear | nscalendarunitmonth | nscalendarunitday fromdate:nextdate todate:nextserieselementdate options:0]; [xaxis addexcludedtimeperiod:[[scharttimeperiod alloc] initwithstart:nextdate andlength:[[schartdatefrequency alloc] initwithday:components.day]]]; } } self.chart.xaxis = xaxis;
Comments
Post a Comment