ios - How to show label on Bar at bottom - Core Plot? -
how show label on bar @ bottom?, using below method , setting labeloffset, shows label on top (in image label text "test" displaying in middle of bar, need display bottom).
-(cptlayer *)datalabelforplot:(cptplot *)plot recordindex:(nsuinteger)index { static cptmutabletextstyle *labeltext = nil; if ( !labeltext ) { labeltext = [[cptmutabletextstyle alloc] init]; labeltext.color = [cptcolor redcolor]; } nsstring *labelvalue = @"test"; nsdictionary *testsdict = [assmentstestsforgrapharray objectatindex:index]; nsinteger score = [[testsdict valueforkey:@"score"] integervalue]; cpttextlayer *newlayer = [[cpttextlayer alloc] initwithtext:labelvalue style:labeltext]; plot.labeloffset = -score;//0;//-10; return newlayer; }
there @ least 3 different ways this:
create second plot (bar plot or scatter plot; doesn't matter) , give same x-values original plot set of y-values equal vertical position of x-axis. label second plot , not first. set second plot doesn't draw except label, i.e., set line styles , fills
nil
.use custom axis labels on x-axis rather plot data labels.
create plot space annotations each label instead of plot data labels.
Comments
Post a Comment