highcharts / highcharts-ios

iOS wrapper for Highcharts.
Other
127 stars 39 forks source link

Not able to drill down in Sunburst Chart #425

Closed jobinsjohn closed 1 year ago

jobinsjohn commented 1 year ago

I am trying to implement a sunburst chart and it has 3 levels. When i try to tap on the middle level, a drill down should happen and that is the usual behavior. But that is not happening. The code that I am using is as follows.

    ```
       let chartView = HIChartView()
    let options = HIOptions()
    options.chart = HIChart()
    options.credits.enabled = false
    let exporting = HIExporting()
    exporting.enabled = false
    options.exporting = exporting
    chartView.plugins = ["sunburst"]
        let chart = HIChart()
        chart.height = "96%"
        options.chart = chart
        let title = HITitle()
        title.text = "Defect Plot"
        options.title = title

        let dataLabels = HIDataLabels()
        dataLabels.format = "{point.name}"
        dataLabels.rotationMode = "circular"

        let sunburst = HISunburst()
        sunburst.dataLabels = [dataLabels]

        sunburst.data = Data from Api

        options.series = [sunburst]
        chartView.options = options
        return chartView


Is this an issue with the latest release?. I am using SPM to add the framework.
ihnatmoisieiev commented 1 year ago

Hello @jobinsjohn, please try the following demo:

chartView.plugins = ["sunburst"]

let options = HIOptions()

let sunburst = HISunburst()
sunburst.allowTraversingTree = true

let dataA = HIData()
dataA.name = "A"
dataA.id = "a"
let dataB = HIData()
dataB.name = "B"
dataB.id = "b"
let dataA1 = HIData()
dataA1.name = "A1"
dataA1.parent = "a"
dataA1.value = 1
let dataA2 = HIData()
dataA2.name = "A2"
dataA2.parent = "a"
dataA2.value = 2
let dataA3 = HIData()
dataA3.name = "A3"
dataA3.parent = "a"
dataA3.value = 3
let dataB1 = HIData()
dataB1.name = "B1"
dataB1.parent = "b"
dataB1.value = 1
let dataB2 = HIData()
dataB2.name = "B2"
dataB2.parent = "b"
dataB2.value = 2

sunburst.data = [
  dataA, dataB, dataA1, dataA2, dataA3, dataB1, dataB2
]

options.series = [sunburst]