0

I've been trying to customize the tooltip in Shinobicharts but it won't work properly. I'm guessing it's the way I'm adding the crosshair-style that creates the problem. I'm ultimately just trying to customize the label of the tooltip, because once I added a custom crosshair-style, it became all black.

Anyways, my code looks like this:

    let crossHairStyle = SChartCrosshairStyle()
    crossHairStyle.lineColor = UIColor.whiteColor()

    let chart = ShinobiChart(frame: view.bounds)
    chart.licenseKey = ""
    chart.datasource = self
    chart.delegate = self
    chart.gestureDoubleTapResetsZoom = true
    chart.frame = CGRectMake(0, 0,width,0.9 * height)
    chart.crosshair.style = crossHairStyle
    chart.crosshair.tooltip.backgroundColor = UIColor.whiteColor()
    chart.crosshair.tooltip.label.backgroundColor = UIColor.whiteColor()
    chart.applyTheme(customTheme)

As I said, I am not able to set the backgroundcolor of the label, and I'm not sure how to proceed.

Any suggestions would be appreciated.

joseph
  • 897
  • 2
  • 10
  • 20

1 Answers1

0

I work for ShinobiControls (just as a disclaimer).

The reason you see a black box is due to the crosshair tooltip using your style object. SChartCrosshairStyle's properties are initialised to nil on creation, so any UIColor's in the style when applied to the crosshair and tooltip will be black as that's what happens when you apply a nil UIColor object to a UI element.

There is a bug currently where you can't set the color directly on the tooltip (this has been fixed locally, so it should make it in to a release soon). However you can set the tooltip's color using the crosshair's style object. For example:

let chart = ShinobiChart(frame: view.bounds)
chart.licenseKey = ""
chart.datasource = self
chart.delegate = self
chart.gestureDoubleTapResetsZoom = true
chart.frame = CGRectMake(0, 0,width,0.9 * height)

// Style crosshair (a style already exists on the crosshair that is pulled from the current theme being used by the chart)
chart.crosshair.style.lineColor = UIColor.whiteColor()
chart.crosshair.style.defaultBackgroundColor = UIColor.whiteColor()
chart.crosshair.style.defaultLabelBackgroundColor = UIColor.whiteColor()
sburnstone
  • 586
  • 3
  • 8