ios - Core Plot : Grid lines don't appear when labeling policy is not automatic -


am trying plot simple statistics using core plot in iphone app. used labeling policy cptaxislabelingpolicyautomatic both axes, , grid lines appeared fine here :

enter image description here

you can see graph has both vertical , horizontal grid lines. then, changed labeling policy

    axisset.xaxis.labelingpolicy = cptaxislabelingpolicynone;     axisset.yaxis.labelingpolicy = cptaxislabelingpolicyautomatic;  nsuinteger labellocation = 0; nsmutablearray *customlabels = [nsmutablearray arraywithcapacity:xaxislabels.count]; cptmutabletextstyle *textstyle = [[cptmutabletextstyle alloc] init]; textstyle.color = [cptcolor lightgraycolor];  (nsnumber *ticklocation in customticklocations) {     cptaxislabel *newlabel = [[cptaxislabel alloc]                               initwithtext:[nsstring stringwithformat:@"%@",(nsdate *)[xaxislabels objectatindex:labellocation++]] textstyle:textstyle];     newlabel.ticklocation = [ticklocation decimalvalue];     newlabel.rotation = 25.0;     newlabel.offset = 10.0;     [customlabels addobject:newlabel]; } axisset.xaxis.axislabels =  [nsset setwitharray:customlabels]; 

but, since when added custom labeling x-axis, x-axis grid lines (i.e. vertical ones) not appearing. horizontal grid lines seen, can see in below screenshot app :

enter image description here

the cptaxislabelingpolicynone labeling policy not create labels or tick marks. need create sets of locations , set majorticklocations and/or minorticklocations.

here's sample code plot gallery example app:

nsset *majorticklocations = [nsset setwithobjects:[nsdecimalnumber zero],                              [nsdecimalnumber numberwithunsignedinteger:30],                              [nsdecimalnumber numberwithunsignedinteger:50],                              [nsdecimalnumber numberwithunsignedinteger:85],                              [nsdecimalnumber numberwithunsignedinteger:100],                              nil]; xaxis.majorticklocations = majorticklocations; 

the tick locations same label locations, don't have be.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -