How to put y axis number in Core Plot?

I would like my Scatter graph I am making with Core Plot library to show Y value near every point relative to X data.

I looked at CPTTestApp project from Core Plot examples, but I simply don't get it. First I thought the secret lies in

-(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)index

method and I have implemented it in my project. Yes, I got points drawn, which is nice, but I found out this probably has nothing to do with values being shown near points....

This suspicion was confirmed when I opened Candlestick demo from Plot_Galley_Mac demo. There is no method from above and it shows numbers nicely!

If anyone can, please, help me. Otherwise, I would like to thank developers for sharing this library with us. Beside over usage of NSDecimal structure and a bit thin manual and reference data, this is fabulous project.

Answers


You're looking for "data labels". CPTPlot has a number of properties that control the built-in labeling functions:

  • labelOffset: distance between the point and the label
  • labelRotation: rotation angle
  • labelTextStyle: text style used to draw the labels
  • labelFormatter: number (or date) formatter used to format the labels
  • labelShadow: shadow properties applied to the labels

If the built-in labels don't meet your needs, you can create your own. Implement the -dataLabelForPlot:recordIndex: datasource method and return the desired label for each point. Custom labels can be any CPTLayer so you can make anything you want—text, images, or any custom layer that you create.


Need Your Help

Directories in HTML

javascript jquery html css image

I've been designing the web pages and I use to save all the contents in same folder... like index.html and css file in same directory for easy accessing... so if there are images in "img" folder then

Enabling Single Sign On for WebSphere Portal and IBM Connections

websphere-portal ibm-connections

I'm trying to integrate IBM Connections and IBM Websphere Portal(WP) following this documentation . Can't get the SSO working between them.