Pre loader

Change colors of tooltip value drawn of xaxis and yaxis

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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.

Version
4.6.3
Images
  • You must to post comments
0
0

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

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.