Closed skuske closed 4 years ago
Hello @skuske,
thank you for the reporting. It looks like this demo doesn't up to date and there is no way to set a pattern
object from API.
I'll report it and let you know.
@skuske in the next releases will be added new initializer with pattern
properties to HIColor
object.
@ihnatmoisieiev Many thanks! :o)
@skuske pattern fills support has been added to the latest release. Can I close the issue?
@ihnatmoisieiev
Well, I haven't been able to test this due to https://github.com/highcharts/highcharts-ios/issues/337
@ihnatmoisieiev
Seems to be working, but the Highcharts default patterns don't seem to work, or how exactly do you initialize them?
#highcharts-default-pattern-1
etc.
See demo project: https://www.highcharts.com/ios/demo/accessible-pie
@skuske
Please check the demo below:
chartView.plugins = ["pattern-fill"]
let options = HIOptions()
let chart = HIChart()
chart.type = "area"
options.chart = chart
let title = HITitle()
title.text = "Pattern fill plugin demo"
options.title = title
let xAxis = HIXAxis()
xAxis.categories = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
options.xAxis = [xAxis]
let plotOptions = HIPlotOptions()
plotOptions.area = HIArea()
let patternObject = HIPatternObject()
patternObject.pattern = HIPatternOptionsObject()
patternObject.pattern.path = "M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11"
patternObject.pattern.width = 10
patternObject.pattern.height = 10
patternObject.pattern.opacity = 0.4
plotOptions.area.fillColor = HIColor(pattern: patternObject)
options.plotOptions = plotOptions
let area1 = HIArea()
area1.data = [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6]
area1.color = HIColor(hexValue: "88e")
let area1PatternObject = HIPatternObject()
area1PatternObject.pattern = HIPatternOptionsObject()
area1PatternObject.pattern.color = "#11d"
area1.fillColor = HIColor(pattern: area1PatternObject)
let area2 = HIArea()
area2.data = [NSNull(), NSNull(), NSNull(), NSNull(), NSNull(), 43.1, 95.6, 148.5, 216.4, 194.1, 95.6, 54.4]
area2.color = HIColor(hexValue: "e88")
let area2PatternObject = HIPatternObject()
area2PatternObject.pattern = HIPatternOptionsObject()
area2PatternObject.pattern.color = "#d11"
area2.fillColor = HIColor(pattern: area2PatternObject)
options.series = [area1, area2]
I just found that 'pattern fills' do not seem to work (sample was https://www.highcharts.com/ios/demo/accessible-pie).
The patterns do not appear - instead the areas are filled black:
Code: