Przeglądaj źródła

Add AACredits for AAOptions

AnAn 4 lat temu
rodzic
commit
ca79d99009

+ 0 - 2
charts/src/main/assets/AAChartView.js

@@ -18,8 +18,6 @@
                 aaOptions.yAxis = aaOptions.yAxisArray
                 }
 
-            aaOptions.credits = {enabled:false};
-
             if (aaOptions.defaultOptions) {
                 Highcharts.setOptions({
                  lang: aaOptions.defaultOptions

+ 70 - 0
charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AACredits.kt

@@ -0,0 +1,70 @@
+/**
+ * Copyright (C), 2015-2021
+ * FileName: AACredits
+ * Author: AnAn
+ * Date: 2021/1/26 10:55 AM
+ * Description:
+ * History:
+ */
+package com.github.aachartmodel.aainfographics.aaoptionsmodel;
+
+
+class AACredits {
+    var enabled: Boolean? = null
+    var href: String? = null
+    var position: AAPosition? = null
+    var style: AAStyle? = null
+    var text: String? = null
+    fun enabled(prop: Boolean): AACredits {
+        enabled = prop
+        return this
+    }
+
+    fun href(prop: String?): AACredits {
+        href = prop
+        return this
+    }
+
+    fun position(prop: AAPosition?): AACredits {
+        position = prop
+        return this
+    }
+
+    fun style(prop: AAStyle?): AACredits {
+        style = prop
+        return this
+    }
+
+    fun text(prop: String?): AACredits {
+        text = prop
+        return this
+    }
+}
+
+
+class AAPosition {
+    var align: String? = null
+    var verticalAlign: String? = null
+    var x: Number? = null
+    var y: Number? = null
+    fun align(prop: String?): AAPosition {
+        align = prop
+        return this
+    }
+
+    fun verticalAlign(prop: String?): AAPosition {
+        verticalAlign = prop
+        return this
+    }
+
+    fun align(prop: Number?): AAPosition {
+        x = prop
+        return this
+    }
+
+    fun y(prop: Number?): AAPosition {
+        y = prop
+        return this
+    }
+}
+

+ 14 - 1
charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AAOptions.kt

@@ -24,6 +24,7 @@ class AAOptions {
     var legend: AALegend? = null
     var pane: AAPane? = null
     var colors: Array<Any>? = null
+    var credits: AACredits? = null
     var defaultOptions: AALang? = null
     var touchEventEnabled: Boolean? = null
 
@@ -92,7 +93,12 @@ class AAOptions {
         return this
     }
 
-    fun defaultOptions(prop: AALang): AAOptions? {
+    fun credits(prop: AACredits): AAOptions {
+        credits = prop
+        return this
+    }
+
+    fun defaultOptions(prop: AALang): AAOptions {
         defaultOptions = prop
         return this
     }
@@ -101,4 +107,11 @@ class AAOptions {
         touchEventEnabled = prop
         return this
     }
+
+
+     init {
+        val aaCredits = AACredits()
+        aaCredits.enabled = false
+        credits = aaCredits
+    }
 }