Skip to content

Commit 35eded9

Browse files
committed
Add AAZooming for AAChart
1 parent cfa8348 commit 35eded9

File tree

1 file changed

+139
-1
lines changed

1 file changed

+139
-1
lines changed

AAInfographics/AAOptionsModel/AAChart.swift

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class AAChart: AAObject {
5656
public var scrollablePlotArea: AAScrollablePlotArea?
5757
public var resetZoomButton: AAResetZoomButton?
5858
public var zoomType: String?
59+
public var zooming: AAZooming?
5960
public var events: AAChartEvents?
6061
public var height: Any?
6162

@@ -229,6 +230,12 @@ public class AAChart: AAObject {
229230
return self
230231
}
231232

233+
@discardableResult
234+
public func zooming(_ prop: AAZooming?) -> AAChart {
235+
zooming = prop
236+
return self
237+
}
238+
232239
@discardableResult
233240
public func events(_ prop: AAChartEvents?) -> AAChart {
234241
events = prop
@@ -299,7 +306,6 @@ public class AAChartEvents: AAObject {
299306
public var render: String?
300307
public var selection: String?
301308

302-
303309
@discardableResult
304310
public func click(_ prop: String?) -> AAChartEvents {
305311
click = prop?.aa_toPureJSString()
@@ -335,3 +341,135 @@ public class AAChartEvents: AAObject {
335341
}
336342
}
337343

344+
345+
/**
346+
zooming:{
347+
key:undefined
348+
mouseWheel:{
349+
enabled:true
350+
sensitivity:1.1
351+
type:undefined
352+
}
353+
pinchType:undefined
354+
resetButton:{
355+
position:{
356+
align:right
357+
verticalAlign:top
358+
x:-10
359+
y:10
360+
}
361+
relativeTo:plot
362+
theme:{
363+
zIndex:6
364+
}
365+
}
366+
singleTouch:false
367+
type:undefined
368+
}
369+
*/
370+
371+
372+
public class AAZooming: AAObject {
373+
public var key: String?
374+
public var mouseWheel: AAMouseWheel?
375+
public var pinchType: String?
376+
public var resetButton: AAResetButton?
377+
public var singleTouch: Bool?
378+
public var type: String?
379+
380+
@discardableResult
381+
public func key(_ prop: String?) -> AAZooming {
382+
key = prop
383+
return self
384+
}
385+
386+
@discardableResult
387+
public func mouseWheel(_ prop: AAMouseWheel?) -> AAZooming {
388+
mouseWheel = prop
389+
return self
390+
}
391+
392+
@discardableResult
393+
public func pinchType(_ prop: AAChartZoomType?) -> AAZooming {
394+
pinchType = prop?.rawValue
395+
return self
396+
}
397+
398+
@discardableResult
399+
public func resetButton(_ prop: AAResetButton?) -> AAZooming {
400+
resetButton = prop
401+
return self
402+
}
403+
404+
@discardableResult
405+
public func singleTouch(_ prop: Bool?) -> AAZooming {
406+
singleTouch = prop
407+
return self
408+
}
409+
410+
@discardableResult
411+
public func type(_ prop: AAChartZoomType?) -> AAZooming {
412+
type = prop?.rawValue
413+
return self
414+
}
415+
416+
public override init() {
417+
418+
}
419+
}
420+
421+
public class AAMouseWheel: AAObject {
422+
public var enabled: Bool?
423+
public var sensitivity: Float?
424+
public var type: String?
425+
426+
@discardableResult
427+
public func enabled(_ prop: Bool?) -> AAMouseWheel {
428+
enabled = prop
429+
return self
430+
}
431+
432+
@discardableResult
433+
public func sensitivity(_ prop: Float?) -> AAMouseWheel {
434+
sensitivity = prop
435+
return self
436+
}
437+
438+
@discardableResult
439+
public func type(_ prop: String?) -> AAMouseWheel {
440+
type = prop
441+
return self
442+
}
443+
444+
public override init() {
445+
446+
}
447+
}
448+
449+
public class AAResetButton: AAObject {
450+
public var position: AAPosition?
451+
public var relativeTo: String?
452+
public var theme: [String: Any]?
453+
454+
@discardableResult
455+
public func position(_ prop: AAPosition?) -> AAResetButton {
456+
position = prop
457+
return self
458+
}
459+
460+
@discardableResult
461+
public func relativeTo(_ prop: String?) -> AAResetButton {
462+
relativeTo = prop
463+
return self
464+
}
465+
466+
@discardableResult
467+
public func theme(_ prop: [String: Any]?) -> AAResetButton {
468+
theme = prop
469+
return self
470+
}
471+
472+
public override init() {
473+
474+
}
475+
}

0 commit comments

Comments
 (0)