Closed YuriFuze closed 3 years ago
Hello @YuriFuze, thank you for choosing Highcharts!
Did you enable draggable-points
plugin?
chartView.plugins = ["draggable-points"]
You can find an example demo here: https://github.com/highcharts/highcharts-ios/issues/171#issuecomment-474450622
Hi @ihnatmoisieiev, thank you for your reply.
Do I have to add anything else for it to work? I added the plugin to the code but it still not dragging the points.
here is my setup: `func setupChart() { let fontPath = Bundle.main.path(forResource: "Inter-Regular", ofType: "ttf") HIChartView.addFont(fontPath)
self.chartView.plugins = ["draggable-points"]
let options = HIOptions()
let chart = HIChart()
chart.type = "packedbubble"
chart.height = "100%"
chart.plotBackgroundColor = UIColor.clear.hiColor
chart.backgroundColor = UIColor.clear.hiColor
chart.plotBorderWidth = 1
let minDisplaySize: CGFloat = 375
let bottomSpacingWorkaround = NSNumber(floatLiteral: Double(Display.width - minDisplaySize))
chart.spacing = [-10,-10,bottomSpacingWorkaround,-10]
options.chart = chart
let title = HITitle()
title.text = ""
options.title = title
options.tooltip = HITooltip()
options.tooltip.enabled = false
options.exporting = HIExporting()
options.exporting.enabled = false
let plotOptions = HIPlotOptions()
plotOptions.packedbubble = HIPackedbubble()
plotOptions.packedbubble.useSimulation = true
plotOptions.packedbubble.allowPointSelect = false
plotOptions.packedbubble.displayNegative = false
plotOptions.packedbubble.minSize = "20%"
plotOptions.packedbubble.maxSize = "120%"
plotOptions.packedbubble.draggable = true
plotOptions.series = HISeries()
plotOptions.series.stickyTracking = false
plotOptions.series.dragDrop = HIDragDrop()
plotOptions.series.dragDrop.draggableY = true
plotOptions.series.dragDrop.draggableX = true
let layoutAlgorithm = HILayoutAlgorithm()
layoutAlgorithm.initialPositions = "random"
layoutAlgorithm.gravitationalConstant = 0.005
layoutAlgorithm.bubblePadding = 8
plotOptions.packedbubble.layoutAlgorithm = layoutAlgorithm
let marker = HIMarker()
marker.fillOpacity = 1
marker.lineWidth = 0
plotOptions.packedbubble.marker = marker
let dataLabels = HIDataLabels()
dataLabels.useHTML = true
dataLabels.enabled = true
dataLabels.format = "{point.name}"
dataLabels.align = "center"
dataLabels.verticalAlign = "middle"
dataLabels.shape = ""
let style = HICSSObject()
style.color = "white"
style.fontWeight = "regular"
style.fontFamily = "Inter-Regular"
style.fontSize = "14px"
style.whiteSpace = "normal"
style.width = 60
style.textAlign = "center"
dataLabels.style = style
plotOptions.packedbubble.dataLabels = [dataLabels]
options.plotOptions = plotOptions
let serie = HIPackedbubble()
serie.data = []
serie.data.append(contentsOf: UsageItemModel.mock.map{ $0.bubble })
let guideSerie = HIPackedbubble()
guideSerie.data = [Bubble.guideBubbleWith(value: 10),Bubble.guideBubbleWith(value: 100)]
guideSerie.visible = false
options.series = [serie, guideSerie]
self.chartView.options = options
}`
@YuriFuze you don't have to add anything else except to enable the plugin. Did you check the demo from my last comment?
@ihnatmoisieiev I did. I'll keep trying and as soon as I find the problem I'll update here.
Closing due to inactivity.
I have a packed bubble chart with 1 serie of data and couldn't make the bubbles draggable I am using
enableSimulation
true inside thelayoutAlgorithm
I've tried a lot of configurations like settingplotOptions.packedbubble.draggable
to true, tried setting thelayoutAlgorithm.dragBetweenSeries
withlayoutAlgorithm.splitSeries
and tried setting the HIDragDrop object on everyHIData
andHIPackedBubble
.I couldn't drag any bubble. When I see the examples made in JS they don't even have to set anything, the default value is to drag the bubbles. What am I doing wrong? Is there any other config that I have to set to enable dragging?