How to change background and text color of the boxes with the values appearing when presenting tooltip?
Currently the box is green and text color is white as shown in the picture.
- Paweł Gleń asked 1 month ago
- last edited 4 weeks ago
- You must login to post comments
Hello,
To customize the color of the axis tooltip boxes, you need to create a custom SCIDefaultAxisInfoProvider subclass that overrides the tooltip appearance. Assign it to axis.axisInfoProvider.
private class CustomAxisSeriesInfoProvider: SCIDefaultAxisInfoProvider {
// Custom tooltip subclass to override background color
class CustomAxisTooltip: SCIAxisTooltip {
override func updateInternal(with axisInfo: SCIAxisInfo) -> Bool {
super.updateInternal(with: axisInfo)
// Set your desired tooltip background color (ARGB hex format)
setTooltipBackground(0xFFEF67AA)
self.textColor = UIColor.black
return true
}
}
// Return our custom tooltip only when the modifier is SCICursorModifier
override func getAxisTooltipInternal(
_ axisInfo: SCIAxisInfo,
modifierType: AnyClass
) -> ISCIAxisTooltip {
if modifierType == SCICursorModifier.self {
return CustomAxisTooltip(axisInfo: axisInfo)
} else {
return super.getAxisTooltipInternal(axisInfo, modifierType: modifierType)
}
}
}
// Assign the custom info provider to your axes
let xAxis = SCINumericAxis()
xAxis.axisInfoProvider = CustomAxisSeriesInfoProvider()
let yAxis = SCINumericAxis()
yAxis.axisInfoProvider = CustomAxisSeriesInfoProvider()
Please refer similar example here: Customization RolloverModifier
- Sanam Kapadia answered 4 weeks ago
- You must login to post comments
Please login first to submit.

