Search code examples
iosobjective-cbar-chartcore-plotaxis-labels

CorePlot - Change x-axis Label after calling barTouchUpAtRecordIndex:


I have an iOS app that displays a CPTBarPlot. My plot bar responds to barTouchUpAtRecordIndex: by changing the background bar color but I also want to change the text label background and font color for that index. How can I change it?

enter image description here


Solution

  • The font color is part of the text style for the label. CPTTextLayer (the layer class used to display text in Core Plot) is a subclass of CPTBorderedLayer so it can have a border line and a fill behind the text. Set the padding to control how much of the fill is visible around the text.