0

So I'm plotting on an XY graph time along the x-axis and what I'd really like is for the axis labels to format themselves based on the range. (EG a small range would give hours, larger range could be days, years etc)

So something like 8 AM | 9 AM | .... | 11 PM then NOV | 2 NOV | 3 NOV | ... | 30 NOV | then 2001 | 2002 | 2003 | ..... | 2020|

etc. Can CorePlot do this for me? I know http://d3js.org/ can do it for my web friends.

Sam Jarman
  • 7,277
  • 15
  • 55
  • 100

1 Answers1

1

Use a plot space delegate to monitor changes to the plot space. -plotSpace:didChangePlotRangeForCoordinate: is a good method for this purpose. After each change, check the current value of the plot range for the changed coordinate (x or y) and update the axis labels appropriately. When the plot range crosses a transition threshold, update the labelFormatter and other axis properties. Which ones need updates will depend on the labeling policy in use and the desired appearance.

Eric Skroch
  • 27,381
  • 3
  • 29
  • 36