Boris-Em / BEMSimpleLineGraph

Elegant Line Graphs for iOS. (Charting library)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I make The Pop Up Label More Dynamic?

cnowak7 opened this issue · comments

I'm having trouble wrapping my head around customizing my line graph in terms of the pop up labels. I'm trying to model my line graph after the one that Google Analytics provides:

screen shot 2016-06-30 at 11 53 02 am

The problem is that the pop up labels can only fit 1 line of text on them, whereas I need them to fit 2 lines. Also, the -(NSString *)popUpPrefixForlineGraph:(BEMSimpleLineGraphView *)graph method applies to all popUpLabels, where I want there to be a different prefix for each one (so I can give the specific date for each day just like Google Analytics is doing).

Is there any way to get this done without breaking anything?

Yes, there absolutely is a way to do this! Implement the popUpViewForLineGraph: and lineGraph:modifyPopupView:forIndex: on your delegate (BEMSimpleLineGraphDelegate). The first method, popUpViewForLineGraph:, allows you to return a custom UIView (or subclass) to display as a popup. The second method, lineGraph:modifyPopupView:forIndex:, gives the supplied popup object back to your delegate as needed and allows you to modify the object based on the given index.

Improvements to popup views are being considered for future implementation.