Răsfoiți Sursa

Add more chart samples for AAInfographics demo

An An 5 ani în urmă
părinte
comite
a49023928b
15 a modificat fișierele cu 1053 adăugiri și 324 ștergeri
  1. 12 0
      app/src/main/assets/AAChartView.js
  2. 9 9
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AAChartModel.kt
  3. 2 6
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AAChartView.kt
  4. 2 4
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AAOptionsConstructor.kt
  5. 27 5
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AASeriesElement.kt
  6. 6 2
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAOptionsModel/AALabels.kt
  7. 8 0
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAOptionsModel/AALegend.kt
  8. 7 5
      app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAOptionsModel/AAStyle.kt
  9. 8 2
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/AdditionalContent/CustomTooltipWithJSFunctionActivity.kt
  10. 20 5
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/AdditionalContent/DrawChartWithAAOptionsActivity.kt
  11. 1 1
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/BasicContent/CommonChartActivity.kt
  12. 54 15
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/BasicContent/MainActivity.kt
  13. 459 67
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/ChartComposer/ChartOptionsComposer.kt
  14. 436 200
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/ChartComposer/CustomTooltipComposer.kt
  15. 2 3
      app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/ChartComposer/MixedChartComposer.kt

+ 12 - 0
app/src/main/assets/AAChartView.js

@@ -20,6 +20,18 @@
                         aaOptions.tooltip.formatter = eval(aaOptions.tooltip.formatter);
                     }
                 }
+
+                    if (aaOptions.xAxis
+                                && aaOptions.xAxis.labels
+                                && aaOptions.xAxis.labels.formatter) {
+                                aaOptions.xAxis.labels.formatter = eval(aaOptions.xAxis.labels.formatter);
+                            }
+
+                            if (aaOptions.yAxis
+                                && aaOptions.yAxis.labels
+                                && aaOptions.yAxis.labels.formatter) {
+                                aaOptions.yAxis.labels.formatter = eval(aaOptions.yAxis.labels.formatter);
+                            }
             aaGlobalChart = Highcharts.chart('container', aaOptions);
            //全局配置(可通过全局配置设置主题)https://api.hcharts.cn/highcharts#Highcharts.setOptions
         };

+ 9 - 9
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AAChartModel.kt

@@ -157,12 +157,12 @@ class AAChartModel {
     var title: String? = null                  //标题内容
     var titleFontColor: String? = null         //标题字体颜色
     var titleFontSize: Float? = null           //标题字体大小
-    var titleFontWeight: String? = null        //标题字体粗细
+    var titleFontWeight: AAChartFontWeightType? = null        //标题字体粗细
     var subtitle: String? = null               //副标题内容
     var subtitleAlign: AAChartAlignType? = null
     var subtitleFontColor: String? = null      //副标题字体颜色
     var subtitleFontSize: Float? = null        //副标题字体大小
-    var subtitleFontWeight: String? = null     //副标题字体粗细
+    var subtitleFontWeight: AAChartFontWeightType? = null     //副标题字体粗细
     var axesTextColor: String? = null          //x 轴和 y 轴文字颜色
     var chartType: AAChartType? = null              //图表类型
     var stacking: AAChartStackingType? = null               //堆积样式
@@ -184,7 +184,7 @@ class AAChartModel {
     var dataLabelsEnabled: Boolean? = null     //是否显示数据
     var dataLabelsFontColor: String? = null
     var dataLabelsFontSize: Float? = null
-    var dataLabelsFontWeight: String? = null
+    var dataLabelsFontWeight: AAChartFontWeightType? = null
     var xAxisLabelsEnabled: Boolean? = null    //x轴是否显示数据
     var xAxisTickInterval: Int? = null
     var categories: Array<String>? = null      //x轴是否显示数据
@@ -231,7 +231,7 @@ class AAChartModel {
         return this
     }
 
-    fun titleFontWeight(prop: String): AAChartModel {
+    fun titleFontWeight(prop: AAChartFontWeightType): AAChartModel {
         titleFontWeight = prop
         return this
     }
@@ -256,7 +256,7 @@ class AAChartModel {
         return this
     }
 
-    fun subtitleFontWeight(prop: String): AAChartModel {
+    fun subtitleFontWeight(prop: AAChartFontWeightType): AAChartModel {
         subtitleFontWeight = prop
         return this
     }
@@ -361,7 +361,7 @@ class AAChartModel {
         return this
     }
 
-    fun dataLabelsFontWeight(prop: String): AAChartModel {
+    fun dataLabelsFontWeight(prop: AAChartFontWeightType): AAChartModel {
         dataLabelsFontWeight = prop
         return this
     }
@@ -488,13 +488,13 @@ class AAChartModel {
          markerRadius         = 6f//折线连接点的半径长度,如果值设置为0,这样就相当于不显示了
          touchEventEnabled    = true
          titleFontColor       = "#000000" //标题字体颜色为黑色
-         titleFontWeight      = "regular" //常规字体
+         titleFontWeight      = AAChartFontWeightType.Regular //常规字体
          titleFontSize        = 11f
          subtitleFontColor    = "#000000" //副标题字体颜色为黑色
-         subtitleFontWeight   = "regular" //常规字体
+         subtitleFontWeight   = AAChartFontWeightType.Regular //常规字体
          subtitleFontSize     = 9f
          dataLabelsFontColor  = "#000000" //数据标签默认颜色为黑色
-         dataLabelsFontWeight = "bold" //图表的数据字体为粗体
+         dataLabelsFontWeight = AAChartFontWeightType.Bold //图表的数据字体为粗体
          dataLabelsFontSize   = 10f
 
      }

+ 2 - 6
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AAChartView.kt

@@ -36,20 +36,16 @@
 package com.aachartmodel.aainfographics.aainfographicsLib.aachartConfiger
 
 import android.content.Context
-import android.content.DialogInterface
 import android.os.Build
 import android.support.annotation.RequiresApi
-import android.support.v7.app.AlertDialog
 import android.util.AttributeSet
 import android.util.Log
 import android.webkit.JavascriptInterface
 import android.webkit.JsResult
-import android.webkit.ValueCallback
 import android.webkit.WebChromeClient
 import android.webkit.WebResourceRequest
 import android.webkit.WebView
 import android.webkit.WebViewClient
-import android.widget.Toast
 import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AAOptions
 import com.example.chartcorekotlin.AAChartConfiger.AAChartModel
 import com.example.chartcorekotlin.AAChartConfiger.AAOptionsConstructor
@@ -81,7 +77,7 @@ class AAChartView : WebView {
     private val optionsJson: String? = null
 
     interface AAChartViewCallBack {
-        fun chartViewDidFinishedLoad(aaChartView: AAChartView)
+        fun chartViewDidFinishLoad(aaChartView: AAChartView)
         fun chartViewMoveOverEventMessage(
             aaChartView: AAChartView,
             messageModel: AAMoveOverEventMessageModel
@@ -165,7 +161,7 @@ class AAChartView : WebView {
             override fun onPageFinished(view: WebView, url: String) {
                 println("图表加载完成!!!!!!!! ")
                 if (callBack != null) {
-                    callBack!!.chartViewDidFinishedLoad(this@AAChartView)
+                    callBack!!.chartViewDidFinishLoad(this@AAChartView)
                 }
                 configureChartOptionsAndDrawChart(chartOptions)
             }

+ 2 - 4
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AAOptionsConstructor.kt

@@ -258,11 +258,9 @@ object AAOptionsConstructor {
                 .allowDecimals(aaChartModel.yAxisAllowDecimals) //是否允许显示小数
                 .reversed(aaChartModel.yAxisReversed)
                 .gridLineWidth(aaChartModel.yAxisGridLineWidth) //y轴网格线宽度
-                .title(
-                    AATitle()
+                .title(AATitle()
                         .text(aaChartModel.yAxisTitle)
-                        .style(
-                            AAStyle()
+                        .style(AAStyle()
                                 .color(aaChartModel.axesTextColor)
                         )
                 ) //y 轴标题

+ 27 - 5
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAChartConfiger/AASeriesElement.kt

@@ -30,12 +30,14 @@ package com.example.chartcorekotlin.AAChartConfiger
 
 import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AADataLabels
 import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AAMarker
+import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AATooltip
 import java.util.Dictionary
 
 /**
  * Created by anan on 2018/4/16.
  */
 
+
 class AASeriesElement {
 
     private var type: String? = null
@@ -45,9 +47,12 @@ class AASeriesElement {
     private var color: Any? = null
     private var fillColor: Any? = null
     private var fillOpacity: Float? = null//折线填充图、曲线填充图、直方折线填充图等填充图类型的填充颜色透明度
-    private var threshold: Float? = null//The threshold, also called zero level or base level. For line type series this is only used in conjunction with negativeColor. default:0.
-    private var negativeColor: String? = null// The color for the parts of the graph or points that are below the threshold
+    private var threshold: Float? =
+        null//The threshold, also called zero level or base level. For line type series this is only used in conjunction with negativeColor. default:0.
+    private var negativeColor: String? =
+        null// The color for the parts of the graph or points that are below the threshold
     private var dashStyle: String? = null
+    private var yAxis: Int? = null
     private var dataLabels: AADataLabels? = null
     private var marker: AAMarker? = null
     private var step: Any? = null
@@ -55,6 +60,8 @@ class AASeriesElement {
     private var zIndex: Int? = null
     private var zones: Array<Any>? = null
     private var shadow: AAShadow? = null
+    private var stack: String? = null
+    private var tooltip: AATooltip? = null
 
 
     fun type(prop: AAChartType): AASeriesElement {
@@ -103,7 +110,12 @@ class AASeriesElement {
     }
 
     fun dashStyle(prop: AAChartLineDashStyleType): AASeriesElement {
-        dashStyle = prop.toString()
+        dashStyle = prop.value
+        return this
+    }
+
+    fun yAxis(prop: Int?): AASeriesElement {
+        yAxis = prop
         return this
     }
 
@@ -132,8 +144,8 @@ class AASeriesElement {
         return this
     }
 
-    fun zones(prop: Array<Map<String, Any>>): AASeriesElement {
-        zones = arrayOf(prop)
+    fun zones(prop: Array<Any>): AASeriesElement {
+        zones = prop
         return this
     }
 
@@ -142,9 +154,19 @@ class AASeriesElement {
         return this
     }
 
+    fun stack(prop: String): AASeriesElement {
+        stack = prop
+        return this
+    }
+
+    fun tooltip(prop: AATooltip): AASeriesElement {
+        tooltip = prop
+        return this
+    }
 
 }
 
+
 class AADataElement {
     private var name: String? = null
     private var y: Float? = null

+ 6 - 2
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAOptionsModel/AALabels.kt

@@ -8,6 +8,8 @@
  */
 package com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel
 
+import com.aachartmodel.aainfographics.AAInfographicsLib.AAChartConfiger.AAJSStringPurer
+
 
 class AALabels {
      var align: String? =
@@ -55,13 +57,15 @@ class AALabels {
         return this
     }
 
-    fun Format(prop: String): AALabels {
+    fun format(prop: String): AALabels {
         format = prop
         return this
     }
 
     fun formatter(prop: String): AALabels {
-        formatter = prop
+        var pureJSFunctionStr = "($prop)"
+        pureJSFunctionStr = AAJSStringPurer.pureJavaScriptFunctionString(pureJSFunctionStr)
+        formatter = pureJSFunctionStr
         return this
     }
 

+ 8 - 0
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAOptionsModel/AALegend.kt

@@ -25,6 +25,7 @@ class AALegend {
     private var itemStyle: AAItemStyle? = null
     private var x: Float? = null
     private var y: Float? = null
+    private var floating:Boolean? = null
 
     fun layout(prop: AAChartLayoutType): AALegend {
         layout = prop
@@ -76,6 +77,12 @@ class AALegend {
         return this
     }
 
+    fun floating(prop: Boolean): AALegend {
+        floating = prop
+        return this
+    }
+
+
 }
 
 class AAItemStyle {
@@ -110,5 +117,6 @@ class AAItemStyle {
         fontWeight = prop
         return this
     }
+
 }
 

+ 7 - 5
app/src/main/java/com/aachartmodel/aainfographics/AAInfographicsLib/AAOptionsModel/AAStyle.kt

@@ -8,12 +8,14 @@
  */
 package com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel
 
+import com.example.chartcorekotlin.AAChartConfiger.AAChartFontWeightType
+
 class AAStyle {
 
     private var color: String? = null
     private var fontSize: String? = null
     private var fontWeight: String? = null
-    private var textOutLine: String? = null
+    private var textOutline: String? = null
 
     fun color(prop: String?): AAStyle {
         color = prop
@@ -25,13 +27,13 @@ class AAStyle {
         return this
     }
 
-    fun fontWeight(prop: String?): AAStyle {
-        fontWeight = prop
+    fun fontWeight(prop: AAChartFontWeightType?): AAStyle {
+        fontWeight = prop?.value
         return this
     }
 
-    fun textOutLine(prop: String): AAStyle {
-        textOutLine = prop
+    fun textOutline(prop: String): AAStyle {
+        textOutline = prop
         return this
     }
 

+ 8 - 2
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/AdditionalContent/CustomTooltipWithJSFunctionActivity.kt

@@ -30,15 +30,17 @@ package com.aachartmodel.aainfographics.ChartsDemo.AdditionalContent
 import android.support.v7.app.AppCompatActivity
 import android.os.Bundle
 import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AAOptions
-import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customAreaChartTooltipStyleWithFormatterFunction1
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customAreaChartTooltipStyleWithFormatterFunction2
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customAreaChartTooltipStyleWithFormatterFunction3
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customAreaChartTooltipStyleWithFormatterFunction4
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customBoxplotTooltipContent
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customDoubleXAxesChart
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customStackedAndGroupedColumnChartTooltip
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customYAxisLabels
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.CustomTooltipComposer.Companion.customYAxisLabels2
 import com.aachartmodel.aainfographics.R
 import com.aachartmodel.aainfographics.aainfographicsLib.aachartConfiger.AAChartView
-import java.util.HashMap
 
 class CustomTooltipWithJSFunctionActivity : AppCompatActivity() {
 
@@ -62,6 +64,10 @@ class CustomTooltipWithJSFunctionActivity : AppCompatActivity() {
             "formatterFunction3" -> return customAreaChartTooltipStyleWithFormatterFunction3()
             "formatterFunction4" -> return customAreaChartTooltipStyleWithFormatterFunction4()
             "formatterFunction5" -> return customBoxplotTooltipContent()
+            "customYAxisLabels" -> return customYAxisLabels()
+            "customYAxisLabels2" -> return customYAxisLabels2()
+            "customStackedAndGroupedColumnChartTooltip" -> return customStackedAndGroupedColumnChartTooltip()
+            "customDoubleXAxesChart" -> return customDoubleXAxesChart()
         }
         return customAreaChartTooltipStyleWithFormatterFunction1()
     }

+ 20 - 5
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/AdditionalContent/DrawChartWithAAOptionsActivity.kt

@@ -30,13 +30,20 @@ package com.aachartmodel.aainfographics.ChartsDemo.AdditionalContent
 import android.support.v7.app.AppCompatActivity
 import android.os.Bundle
 import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AAOptions
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.customChartLegendStyle
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureAAPlotBandsForChart
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureAAPlotLinesForChart
-import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.customAATooltipWithJSFuntion
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureDoubleYAxisChartOptions
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureTheMirrorColumnChart
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureTripleYAxesMixedChart
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureXAxisLabelsFontColorAndFontSizeWithHTMLString
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureXAxisLabelsFontColorWithHTMLString
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configureXAxisPlotBand
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.configure_DataLabels_XAXis_YAxis_Legend_Style
+import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.customAATooltipWithJSFunction
 import com.aachartmodel.aainfographics.ChartsDemo.ChartComposer.ChartOptionsComposer.Companion.customXAxisCrosshairStyle
 import com.aachartmodel.aainfographics.R
 import com.aachartmodel.aainfographics.aainfographicsLib.aachartConfiger.AAChartView
-import java.util.HashMap
 
 class DrawChartWithAAOptionsActivity : AppCompatActivity() {
 
@@ -56,10 +63,18 @@ class DrawChartWithAAOptionsActivity : AppCompatActivity() {
 
     private fun configureTheChartOptions(chartType: String): AAOptions {
         when (chartType) {
-            "configureAAPlotBandsForChart" -> return configureAAPlotBandsForChart()
-            "configureAAPlotLinesForChart" -> return configureAAPlotLinesForChart()
-            "customAATooltipWithJSFuntion" -> return customAATooltipWithJSFuntion()
+            "customLegendStyle" -> return customChartLegendStyle()
+            "AAPlotBandsForChart" -> return configureAAPlotBandsForChart()
+            "AAPlotLinesForChart" -> return configureAAPlotLinesForChart()
+            "customAATooltipWithJSFuntion" -> return customAATooltipWithJSFunction()
             "customXAxisCrosshairStyle" -> return customXAxisCrosshairStyle()
+            "XAxisLabelsFontColorWithHTMLString" -> return configureXAxisLabelsFontColorWithHTMLString()
+            "XAxisLabelsFontColorAndFontSizeWithHTMLString" -> return configureXAxisLabelsFontColorAndFontSizeWithHTMLString()
+            "_DataLabels_XAXis_YAxis_Legend_Style" -> return configure_DataLabels_XAXis_YAxis_Legend_Style()
+            "XAxisPlotBand" -> return configureXAxisPlotBand()
+            "configureTheMirrorColumnChart" -> return configureTheMirrorColumnChart()
+            "configureDoubleYAxisChartOptions" -> return configureDoubleYAxisChartOptions()
+            "configureTripleYAxesMixedChart" -> return configureTripleYAxesMixedChart()
         }
         return configureAAPlotBandsForChart()
     }

+ 1 - 1
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/BasicContent/CommonChartActivity.kt

@@ -287,7 +287,7 @@ class CommonChartActivity : AppCompatActivity(), RadioGroup.OnCheckedChangeListe
 
     }
 
-    override fun chartViewDidFinishedLoad(aaChartView: AAChartView) {
+    override fun chartViewDidFinishLoad(aaChartView: AAChartView) {
         println("🔥图表加载完成回调方法 ")
     }
 

+ 54 - 15
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/BasicContent/MainActivity.kt

@@ -36,6 +36,7 @@ import android.widget.ArrayAdapter
 import android.widget.ListView
 import com.aachartmodel.aainfographics.ChartsDemo.AdditionalContent.CustomTooltipWithJSFunctionActivity
 import com.aachartmodel.aainfographics.ChartsDemo.AdditionalContent.DrawChartWithAAOptionsActivity
+import com.aachartmodel.aainfographics.ChartsDemo.AdditionalContent.EvaluateJSStringFunctionActivity
 import com.aachartmodel.aainfographics.ChartsDemo.AdditionalContent.HideOrShowChartSeriesActivity
 import com.aachartmodel.aainfographics.ChartsDemo.BasicContent.CommonChartActivity
 import com.aachartmodel.aainfographics.ChartsDemo.BasicContent.CustomStyleChartActivity
@@ -98,14 +99,18 @@ class MainActivity : AppCompatActivity() {
         "PentagonRadarChart",
         "HexagonRadarChart",
         /*使用AAOptions绘制图表*/
-        "/*使用AAOptions绘制图表*/drawChartWithOptionsOne-----------------",
+        "/*使用AAOptions绘制图表*/customLegendStyle-----------------",
+        "drawChartWithOptionsOne",
         "AAPlotLinesForChart",
-        "customAATooltipWithJSFuntion",
+        "customAATooltipWithJSFunction",
         "customXAxisCrosshairStyle",
         "XAxisLabelsFontColorWithHTMLString",
         "XAxisLabelsFontColorAndFontSizeWithHTMLString",
         "_DataLabels_XAXis_YAxis_Legend_Style",
         "XAxisPlotBand",
+        "configureTheMirrorColumnChart",
+        "configureDoubleYAxisChartOptions",
+        "configureTripleYAxesMixedChart",
         /*隐藏或显示内容*/
         "/*隐藏或显示内容*/Column Chart---柱形图--------------",
         "Bar Chart---条形图",
@@ -115,14 +120,19 @@ class MainActivity : AppCompatActivity() {
         "Step Line Chart--- 直方折线图",
         "Line Chart---折线图",
         "Spline Chart---曲线图",
-        "简单字符串拼接",
+        /*自定义 formatter 函数*/
+        "/*自定义 formatter 函数*/简单字符串拼接-----------------",
         "自定义不同单位后缀",
         "值为0时,在tooltip中不显示",
         "自定义多彩颜色文字",
-        "自定义箱线图的浮动提示框头部内容"
+        "自定义箱线图的浮动提示框头部内容",
+        "自定义Y轴文字",
+        "自定义Y轴文字2",
+        "自定义分组堆积柱状图tooltip内容",
+        "双 X 轴镜像图表"
     )
 
-    internal var chartTypeArr = arrayOf<String>(
+    private var chartTypeArr = arrayOf(
         /*基础类型图表*/
         AAChartType.Column.value,
         AAChartType.Bar.value,
@@ -176,14 +186,18 @@ class MainActivity : AppCompatActivity() {
         "PentagonRadarChart",
         "HexagonRadarChart",
         /*使用AAOptions绘制图表*/
+        "customLegendStyle",
         "AAPlotBandsForChart",
         "AAPlotLinesForChart",
-        "customAATooltipWithJSFuntion",
+        "customAATooltipWithJSFunction",
         "customXAxisCrosshairStyle",
         "XAxisLabelsFontColorWithHTMLString",
         "XAxisLabelsFontColorAndFontSizeWithHTMLString",
         "_DataLabels_XAXis_YAxis_Legend_Style",
         "XAxisPlotBand",
+        "configureTheMirrorColumnChart",
+        "configureDoubleYAxisChartOptions",
+        "configureTripleYAxesMixedChart",
         /*隐藏或显示内容*/
         AAChartType.Column.value,
         AAChartType.Bar.value,
@@ -193,11 +207,20 @@ class MainActivity : AppCompatActivity() {
         AAChartType.Line.value,
         AAChartType.Line.value,
         AAChartType.Spline.value,
+        /*自定义 formatter 函数*/
         "formatterFunction1",
         "formatterFunction2",
         "formatterFunction3",
         "formatterFunction4",
-        "formatterFunction5"
+        "formatterFunction5",
+        "customYAxisLabels",
+        "customYAxisLabels2",
+        "customStackedAndGroupedColumnChartTooltip",
+        "customDoubleXAxesChart",
+        /*执行由 JavaScript 字符串映射转换成的 js function 函数*/
+        "evalJSFunction1",
+        "evalJSFunction2",
+        "evalJSFunction3"
     )
 
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -213,14 +236,22 @@ class MainActivity : AppCompatActivity() {
 
         listView.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
             println(position)
-            when {
-                position <= 7 -> goToCommonChartActivity(position)
-                position in 8..19 -> goToSpecialChartActivity(position)
-                position in 20..28 -> goToMixedChartActivity(position)
-                position in 28..46 -> goToCustomStyleChartActivity(position)
-                position in 47..54 -> goToDrawChartWithAAOptionsActivity(position)
-                position in 55..62 -> goToHideOrShowChartSeriesActivity(position)
-                position > 62 -> goToCustomTooltipWithJSFunctionActivity(position)
+            if (position <= 7) {/*基础类型图表*/
+                goToCommonChartActivity(position)
+            } else if (position <= 19) {/*特殊类型图表*/
+                goToSpecialChartActivity(position)
+            } else if (position <= 28) { /*Mixed Chart---混合图*/
+                goToMixedChartActivity(position)
+            } else if (position <= 46) {/*自定义样式图表*/
+                goToCustomStyleChartActivity(position)
+            } else if (position <= 58) {/*使用AAOptions绘制图表*/
+                goToDrawChartWithAAOptionsActivity(position)
+            } else if (position <= 65) { /*隐藏或显示内容*/
+                goToHideOrShowChartSeriesActivity(position)
+            } else if (position <= 75) {/*formatter js function*/
+                goToCustomTooltipWithJSFunctionActivity(position)
+            } else if (position > 75) { /*eval JS Function*/
+                goToEvaluateJSStringFunctionActivity(position)
             }
         }
     }
@@ -276,6 +307,14 @@ class MainActivity : AppCompatActivity() {
     }
 
 
+    private fun goToEvaluateJSStringFunctionActivity(position: Int) {
+        val intent = Intent(this, EvaluateJSStringFunctionActivity::class.java)
+        intent.putExtra("chartType", chartTypeArr[position])
+
+        startActivity(intent)
+    }
+
+
 }
 
 

+ 459 - 67
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/ChartComposer/ChartOptionsComposer.kt

@@ -41,16 +41,19 @@ import com.example.chartcorekotlin.AAChartConfiger.*
 class ChartOptionsComposer {
     companion object {
 
-        private fun customChartLegendStyle(): AAOptions {
+        fun customChartLegendStyle(): AAOptions {
             val element1 = AASeriesElement()
                 .name("Predefined symbol")
                 .data(arrayOf(0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36))
+
             val element2 = AASeriesElement()
                 .name("Image symbol")
                 .data(arrayOf(0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67))
+
             val element3 = AASeriesElement()
                 .name("Base64 symbol (*)")
                 .data(arrayOf(0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60, 0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64))
+
             val element4 = AASeriesElement()
                 .name("Custom symbol")
                 .data(arrayOf(0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65, 0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53))
@@ -73,9 +76,9 @@ class ChartOptionsComposer {
 
             aaOptions.legend!!
                 .enabled(true)
-                .align(AAChartAlignType.Right)
-                .layout(AAChartLayoutType.Vertical)
                 .verticalAlign(AAChartVerticalAlignType.Top)
+                .layout(AAChartLayoutType.Vertical)
+                .align(AAChartAlignType.Right)
 
             aaOptions.yAxis?.labels?.format = "{value} %"//给y轴添加单位
             return aaOptions
@@ -129,7 +132,7 @@ class ChartOptionsComposer {
     }
 
      fun configureAAPlotLinesForChart(): AAOptions {
-        val zonesArr = arrayOf(
+        val zonesArr:Array<Any> = arrayOf(
             mapOf(
                 "value" to 12,
                 "color" to "#1e90ff"
@@ -172,7 +175,7 @@ class ChartOptionsComposer {
                         .text("PLOT LINES ONE")
                         .style(AAStyle()
                                 .color("#1e90ff")
-                                .fontWeight("bold")
+                                .fontWeight(AAChartFontWeightType.Bold)
                         )
                 ),
             AAPlotLinesElement()
@@ -185,7 +188,7 @@ class ChartOptionsComposer {
                         .text("PLOT LINES TWO")
                         .style(AAStyle()
                                 .color("#ef476f")
-                                .fontWeight("bold")
+                                .fontWeight(AAChartFontWeightType.Bold)
                         )
                 ),
             AAPlotLinesElement()
@@ -198,7 +201,7 @@ class ChartOptionsComposer {
                         .text("PLOT LINES THREE")
                         .style(AAStyle()
                                 .color("#04d69f")
-                                .fontWeight("bold")
+                                .fontWeight(AAChartFontWeightType.Bold)
                         )
                 )
         )
@@ -207,7 +210,7 @@ class ChartOptionsComposer {
          return aaOptions
     }
 
-     fun customAATooltipWithJSFuntion(): AAOptions {
+     fun customAATooltipWithJSFunction(): AAOptions {
         val aaChartModel = AAChartModel()
             .chartType(AAChartType.Area)//图形类型
             .title("近三个月金价起伏周期图")//图表主标题
@@ -317,7 +320,224 @@ function () {
         return aaOptions
     }
 
-        private fun customDoubleXAxesChart():AAOptions {
+         fun configureXAxisLabelsFontColorWithHTMLString(): AAOptions {
+            val categories = arrayOf(
+                "<font color=\\\"#CC0066\\\">孤岛危机<\\/font>",
+                "<font color=\\\"#CC0033\\\">使命召唤<\\/font>",
+                "<font color=\\\"#FF0066\\\">荣誉勋章<\\/font>",
+                "<font color=\\\"##66FF99\\\">狙击精英<\\/font>",
+                "<font color=\\\"#00FF00\\\">神秘海域<\\/font>",
+                "<font color=\\\"#00CC00\\\">美国末日<\\/font>",
+                "<font color=\\\"#666FF\\\">巫师狂猎<\\/font>",
+                "<font color=\\\"#000CC\\\">死亡搁浅<\\/font>",
+                "<font color=\\\"#9933CC\\\">地狱边境<\\/font>",
+                "<font color=\\\"##FFCC99\\\">忍者之印<\\/font>",
+                "<font color=\\\"#FFCC00\\\">合金装备<\\/font>",
+                "<font color=\\\"#CC99090\\\">全战三国<\\/font>"
+            )
+
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Areaspline)
+                .title("")
+                .subtitle("")
+                .stacking(AAChartStackingType.Normal)
+                .categories(categories)
+                .dataLabelsEnabled(false)
+                .markerRadius(0f)
+                .series(arrayOf(
+                        AASeriesElement()
+                            .name("Berlin Hot")
+                            .color(AAGradientColor.mysticMauveColor())
+                            .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))
+                    )
+                )
+
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.xAxis?.labels?.useHTML(true)
+            return aaOptions
+        }
+
+         fun configureXAxisLabelsFontColorAndFontSizeWithHTMLString(): AAOptions {
+            val categories = arrayOf(
+                "<span style=\\\"color:#CC0066;font-weight:bold;font-size:10px\\\">使命召唤</span>",
+                "<span style=\\\"color:#CC0033;font-weight:bold;font-size:11px\\\">荣誉勋章</span>",
+                "<span style=\\\"color:#FF0066;font-weight:bold;font-size:12px\\\">狙击精英</span>",
+                "<span style=\\\"color:#66FF99;font-weight:bold;font-size:13px\\\">神秘海域</span>",
+                "<span style=\\\"color:#00FF00;font-weight:bold;font-size:14px\\\">美国末日</span>",
+                "<span style=\\\"color:#00CC00;font-weight:bold;font-size:15px\\\">巫师狂猎</span>",
+                "<span style=\\\"color:#666FF;font-weight:bold;font-size:15px\\\">孤岛危机</span>",
+                "<span style=\\\"color:#000CC;font-weight:bold;font-size:14px\\\">地狱边境</span>",
+                "<span style=\\\"color:#9933CC;font-weight:bold;font-size:13px\\\">忍者之印</span>",
+                "<span style=\\\"color:#FFCC99;font-weight:bold;font-size:12px\\\">合金装备</span>",
+                "<span style=\\\"color:#FFCC00;font-weight:bold;font-size:11px\\\">全战三国</span>",
+                "<span style=\\\"color:#CC99090;font-weight:bold;font-size:10px\\\">死亡搁浅</span>"
+            )
+
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Areaspline)
+                .title("")
+                .subtitle("")
+                .stacking(AAChartStackingType.Normal)
+                .categories(categories)
+                .dataLabelsEnabled(false)
+                .markerRadius(0f)
+                .series(arrayOf(
+                        AASeriesElement()
+                            .name("Berlin Hot")
+                            .color(AAGradientColor.deepSeaColor())
+                            .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))
+                    )
+                )
+
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.xAxis?.labels?.useHTML(true)
+
+            return aaOptions
+        }
+
+         fun configure_DataLabels_XAXis_YAxis_Legend_Style(): AAOptions {
+            val backgroundColorGradientColor = AAGradientColor.linearGradient(
+                AALinearGradientDirection.ToBottom,
+                "#4F00BC",
+                "#29ABE2"//颜色字符串设置支持十六进制类型和 rgba 类型
+            )
+
+            val fillColorGradientColor = AAGradientColor.linearGradient(
+                AALinearGradientDirection.ToBottom,
+                "rgba(256,256,256,0.3)",
+                "rgba(256,256,256,1.0)"//颜色字符串设置支持十六进制类型和 rgba 类型
+            )
+
+
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Areaspline)
+                .title("")
+                .subtitle("")
+                .backgroundColor(backgroundColorGradientColor)
+                .yAxisVisible(true)
+                .yAxisTitle("")
+                .categories(arrayOf("一月", "二月", "三月", "四月", "五月", "六月",
+                        "七月", "八月", "九月", "十月", "十一月", "十二月"))
+                .markerRadius(0f)
+                .series(arrayOf(
+                        AASeriesElement()
+                            .name("Berlin Hot")
+                            .color(AAColor.whiteColor())
+                            .lineWidth(7f)
+                            .fillColor(fillColorGradientColor)
+                            .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))
+                    )
+                )
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.plotOptions?.areaspline
+                ?.dataLabels(AADataLabels()
+                             .enabled(true)
+                             .style(AAStyle()
+                                    .color(AAColor.blackColor())
+                                    .fontSize(14f)
+                                    .fontWeight(AAChartFontWeightType.Thin)))
+
+            val aaCrosshair = AACrosshair()
+                .dashStyle(AAChartLineDashStyleType.LongDashDot)
+                .color(AAColor.whiteColor())
+                .width(1f)
+
+            val aaLabels = AALabels()
+                .useHTML(true)
+                .style(AAStyle()
+                        .fontSize(10f)
+                        .fontWeight(AAChartFontWeightType.Bold)
+                        .color(AAColor.whiteColor())//轴文字颜色
+                )
+
+            aaOptions.yAxis!!
+                .opposite(true)
+                .tickWidth(2f)
+                .lineWidth(1.5f)//Y轴轴线颜色
+                .lineColor(AAColor.whiteColor())//Y轴轴线颜色
+                .gridLineWidth(0f)//Y轴网格线宽度
+                .crosshair(aaCrosshair)
+                .labels(aaLabels)
+
+            aaOptions.xAxis!!
+                .tickWidth(2f)//X轴刻度线宽度
+                .lineWidth(1.5f)//X轴轴线宽度
+                .lineColor(AAColor.whiteColor())//X轴轴线颜色
+                .crosshair(aaCrosshair)
+                .labels(aaLabels)
+
+
+            //设定图例项的CSS样式。只支持有关文本的CSS样式设定。
+            /*默认是:{
+         "color": "#333333",
+         "cursor": "pointer",
+         "fontSize": "12px",
+         "fontWeight": "bold"
+         }
+         */
+
+            aaOptions.legend!!
+                .itemStyle(
+                    AAItemStyle()
+                        .color(AAColor.whiteColor())//字体颜色
+                        .fontSize(13f)//字体大小
+                        .fontWeight("thin")//字体为细体字
+
+                )
+
+            return aaOptions
+        }
+         fun configureXAxisPlotBand(): AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Areaspline)
+                .title("")
+                .subtitle("")
+                .categories(arrayOf("一月", "二月", "三月", "四月", "五月", "六月",
+                    "七月", "八月", "九月", "十月", "十一月", "十二月"))
+                .yAxisTitle("")
+                .yAxisGridLineWidth(0f)
+                .markerRadius(8f)
+                .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
+                .series(arrayOf(
+                        AASeriesElement()
+                            .name("New York Hot")
+                            .lineWidth(5.0f)
+                            .color("rgba(220,20,60,1)")////猩红色, alpha 透明度 1
+                            .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6)),
+                        AASeriesElement()
+                            .type(AAChartType.Column)
+                            .name("Berlin Hot")
+                            .color("#25547c")
+                            .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))
+                        )
+                )
+
+
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            val aaPlotBandsElementArr = arrayOf<AAPlotBandsElement>(
+                AAPlotBandsElement()
+                    .from(-0.25f)//值域颜色带X轴起始值
+                    .to(4.75f)//值域颜色带X轴结束值
+                    .color("#06caf4")//值域颜色带填充色
+                ,
+                AAPlotBandsElement()
+                    .from(4.75f)
+                    .to(8.25f)
+                    .color("#ffd066")
+                ,
+                AAPlotBandsElement()
+                    .from(8.25f)
+                    .to(11.25f)
+                    .color("#04d69f")
+            )
+
+            val aaXAxis = aaOptions.xAxis
+            aaXAxis?.plotBands(aaPlotBandsElementArr)
+
+            return aaOptions
+        }
+
+         fun configureTheMirrorColumnChart(): AAOptions {
             val gradientColorDic1 = AAGradientColor.linearGradient(
                 AALinearGradientDirection.ToTop,
                 "#7052f4",
@@ -330,82 +550,254 @@ function () {
                 "#4740C8"//颜色字符串设置支持十六进制类型和 rgba 类型
             )
 
-            val aaChart = AAChart()
-                .type(AAChartType.Bar)
+            val aaYAxis1 = AAYAxis()
+                .visible(true)
+                .labels(AALabels()
+                        .enabled(true)//设置 y 轴是否显示数字
+                        .style(AAStyle()
+                                .color("#ff0000")//yAxis Label font color
+                                .fontSize(15f)//yAxis Label font size
+                                .fontWeight(AAChartFontWeightType.Bold)//yAxis Label font weight
+                        )
+                )
+                .gridLineWidth(0f)// Y 轴网格线宽度
+                .title(AATitle()
+                        .text("收入"))//Y 轴标题
+
+            val aaYAxis2 = AAYAxis()
+                .visible(true)
+                .opposite(true)
+                .title(AATitle()
+                        .text("支出"))
 
+            return AAOptions()
+                .chart(AAChart()
+                        .type(AAChartType.Column))
+                .title(AATitle()
+                        .text("正负镜像柱形图")
+                        .style(AAStyle()
+                                .color(AAColor.whiteColor())
+                                .fontSize(18f)))
+                .xAxis(AAXAxis()
+                        .categories(arrayOf("一月", "二月", "三月", "四月", "五月", "六月",
+                                "七月", "八月", "九月", "十月", "十一月", "十二月")))
+                .yAxisArray(arrayOf(aaYAxis1, aaYAxis2))
+                .plotOptions(AAPlotOptions()
+                             .series(AASeries()
+                                     .animation(AAAnimation()
+                                                .duration(800)
+                                                .easing(AAChartAnimationType.EaseInCirc)))
+                        .column(AAColumn()
+                                .grouping(false)
+                                .borderWidth(0f)
+                                .borderRadius(5f)))
+                .series(arrayOf(
+                        AASeriesElement()
+                            .name("收入")
+                            .color(gradientColorDic1)
+                            .data(arrayOf(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9,7.0, 6.9, 9.5, 14.5)),
+                        AASeriesElement()
+                            .name("支出")
+                            .color(gradientColorDic2)
+                            .data(arrayOf(-20.1, -14.1, -8.6, -2.5, -0.8, -5.7, -11.3, -17.0, -22.0, -24.8, -24.1, -20.1, -14.1, -8.6, -2.5)
+                            )))
+
+        }
+
+         fun configureDoubleYAxisChartOptions(): AAOptions {
             val aaTitle = AATitle()
-                .text("2015 年德国人口金字塔")
+                .text("")
+
+            val aaXAxis = AAXAxis()
+                .visible(true)
+                .min(0f)
+                .categories(arrayOf("Java", "Swift", "Python", "Ruby", "PHP", "Go","C",
+                        "C#", "C++", "Perl", "R", "MATLAB", "SQL"))
+
+            val aaYAxisTitleStyle = AAStyle()
+                .color("#1e90ff")//Title font color
+                .fontSize(14f)//Title font size
+                .fontWeight(AAChartFontWeightType.Bold)//Title font weight
+                .textOutline("0px 0px contrast")
+
+            val aaYAxisLabels = AALabels()
+                .enabled(true)//设置 y 轴是否显示数字
                 .style(AAStyle()
-                    .color("#000000")
-                    .fontSize(12.0f))
+                        .color("#ff0000")//yAxis Label font color
+                        .fontSize(15f)//yAxis Label font size
+                        .fontWeight(AAChartFontWeightType.Bold)//yAxis Label font weight
+                )
 
-            val aaCategories = arrayOf("0-4", "5-9", "10-14", "15-19", "20-24", "25-29", "30-34", "35-39", "40-44", "45-49", "50-54", "55-59", "60-64", "65-69", "70-74", "75-79", "80-84", "85-89", "90-94", "95-99", "100 + ")
+            val yAxisOne = AAYAxis()
+                .visible(true)
+                .labels(aaYAxisLabels)
+                .title(AATitle()
+                        .text("冬季降雨量")
+                        .style(aaYAxisTitleStyle)
+                )
+                .opposite(true)
 
-            val aaXAxis1 = AAXAxis()
-                .reversed(true)
-                .categories(aaCategories)
-                .labels(AALabels()
-                    .step(1))
 
-            val aaXAxis2 = AAXAxis()
-                .reversed(true)
-                .opposite(true)
-                .categories(aaCategories)
-                .linkedTo(0)
+            val yAxisTwo = AAYAxis()
+                .visible(true)
+                .labels(aaYAxisLabels)
+                .title(AATitle()
+                        .text("夏季降雨量")
+                        .style(aaYAxisTitleStyle)
+                )
+
+            val aaTooltip = AATooltip()
+                .enabled(true)
+                .shared(true)
+
+            val gradientColorDic1 = AAGradientColor.linearGradient(
+                AALinearGradientDirection.ToTop,
+                "#f54ea2",
+                "#ff7676"//颜色字符串设置支持十六进制类型和 rgba 类型
+            )
+
+            val gradientColorDic2 = AAGradientColor.linearGradient(
+                AALinearGradientDirection.ToTop,
+                "#17ead9",
+                "#6078ea"//颜色字符串设置支持十六进制类型和 rgba 类型
+            )
+
+            val aaMarker = AAMarker()
+                .radius(7f)//曲线连接点半径,默认是4
+                .symbol(AAChartSymbolType.Circle.value)//曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
+                .fillColor("#ffffff")//点的填充色(用来设置折线连接点的填充色)
+                .lineWidth(3f)//外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
+                .lineColor("")//外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)
+
+            val element1 = AASeriesElement()
+                .name("2017")
+                .type(AAChartType.Areaspline)
+                //          .borderRadius(4)
+                .color(gradientColorDic1)
+                .marker(aaMarker)
+                .yAxis(1)
+                .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))
+
+            val element2 = AASeriesElement()
+                .name("2018")
+                .type(AAChartType.Column)
+                .color(gradientColorDic2)
+                .yAxis(0)
+                .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))
+
+
+            return AAOptions()
+                .title(aaTitle)
+                .xAxis(aaXAxis)
+                .yAxisArray(arrayOf(yAxisOne, yAxisTwo))
+                .tooltip(aaTooltip)
+                .series(arrayOf(element1, element2))
+        }
+
+         fun configureTripleYAxesMixedChart(): AAOptions {
+            val colorsThemeArr = arrayOf("red", "mediumspringgreen", "deepskyblue")
+
+            val aaTitle = AATitle()
+                .text("东京月平均天气数据")
+
+            val aaSubtitle = AASubtitle()
+                .text("数据来源: WorldClimate.com")
+
+            val aaXAxis = AAXAxis()
+                .visible(true)
+                .min(0f)
+                .categories(arrayOf("一月", "二月", "三月", "四月", "五月", "六月",
+                        "七月", "八月", "九月", "十月", "十一月", "十二月"))
+
+            val yAxis1 = AAYAxis()
+                .visible(true)
+                .gridLineWidth(0f)
                 .labels(AALabels()
-                    .step(1))
+                        .enabled(true)//设置 y 轴是否显示数字
+                        .format("{value}°C")
+                        .style(AAStyle()
+                                .color(colorsThemeArr[2])))//yAxis Label font color
+                .title(AATitle()
+                        .text("温度")
+                        .style(AAStyle()
+                                .color(colorsThemeArr[2])))
+                .opposite(true)
 
-            val aaYAxis = AAYAxis()
-                .gridLineWidth(0f)// Y 轴网格线宽度
+            val yAxis2 = AAYAxis()
+                .visible(true)
+                .gridLineWidth(0f)
+                .labels(AALabels()
+                        .enabled(true)//设置 y 轴是否显示数字
+                        .format("{value}°mm")
+                        .style(AAStyle()
+                                .color(colorsThemeArr[0])))//yAxis Label font color
                 .title(AATitle()
-                    .text(""))//Y 轴标题
+                        .text("降雨量")
+                        .style(AAStyle()
+                                .color(colorsThemeArr[0])))
+
+            val yAxis3 = AAYAxis()
+                .visible(true)
+                .gridLineWidth(0f)
                 .labels(AALabels()
-                    .formatter(
-                        "function () {\n" +
-                                "    return (Math.abs(this.value) / 1000000) + 'M';\n" +
-                                "}"
-                    ))
-                .min(-4000000f)
-                .max(4000000f)
-
-            val aaPlotOptions = AAPlotOptions()
-                .series(AASeries()
-                    .animation(AAAnimation()
-                        .duration(800)
-                        .easing(AAChartAnimationType.Bounce)
-                    )
-                    .stacking(AAChartStackingType.Normal))
+                        .enabled(true)//设置 y 轴是否显示数字
+                        .format("{value}°mb")
+                        .style(AAStyle()
+                                .color(colorsThemeArr[1])))//yAxis Label font color
+                .title(AATitle()
+                        .text("海平面气压")
+                        .style(AAStyle()
+                                .color(colorsThemeArr[1])))
+                .opposite(true)
+
 
             val aaTooltip = AATooltip()
                 .enabled(true)
-                .shared(false)
-                .formatter(("function () {\n" +
-                        "    return '<b>' + this.series.name + ', age ' + this.point.category + '</b><br/>' +\n" +
-                        "        '人口: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0);\n" +
-                        "}"))
-
-            val aaSeriesElement1 = AASeriesElement()
-                .name("Men")
-                .color(gradientColorDic1)
-                .data(arrayOf(-1746181, -1884428, -2089758, -2222362, -2537431, -2507081, -2443179,
-                    -2664537, -3556505, -3680231, -3143062, -2721122, -2229181, -2227768, -2176300,
-                    -1329968, -836804, -354784, -90569, -28367, -3878))
+                .shared(true)
 
-            val aaSeriesElement2 = AASeriesElement()
-                .name("Women")
-                .color(gradientColorDic2)
-                .data(arrayOf(1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
-                    3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638, 1447162,
-                    1005011, 330870, 130632, 21208))
+            val aaLegend = AALegend()
+                .enabled(true)
+                .floating(true)
+                .layout(AAChartLayoutType.Vertical)
+                .align(AAChartAlignType.Left)
+                .x(80f)
+                .verticalAlign(AAChartVerticalAlignType.Top)
+                .y(55f)
+
+            val element1 = AASeriesElement()
+                .name("降雨量")
+                .type(AAChartType.Column)
+                .yAxis(1)
+                .data(arrayOf(49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4))
+                .tooltip(AATooltip()
+                        .valueSuffix(" mm"))
+
+            val element2 = AASeriesElement()
+                .name("海平面气压")
+                .type(AAChartType.Line)
+                .yAxis(2)
+                .data(arrayOf(1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7))
+                .dashStyle(AAChartLineDashStyleType.ShortDot)
+                .tooltip(AATooltip()
+                        .valueSuffix(" mb"))
+
+            val element3 = AASeriesElement()
+                .name("温度")
+                .type(AAChartType.Line)
+                .yAxis(0)
+                .data(arrayOf(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6))
+                .tooltip(AATooltip()
+                        .valueSuffix(" ℃"))
 
             return AAOptions()
-                .chart(aaChart)
                 .title(aaTitle)
-                .xAxisArray(arrayOf(aaXAxis1, aaXAxis2))
-                .yAxis(aaYAxis)
-                .plotOptions(aaPlotOptions)
+                .subtitle(aaSubtitle)
+                .colors(colorsThemeArr as Array<Any>)
+                .xAxis(aaXAxis)
+                .yAxisArray(arrayOf(yAxis1, yAxis2, yAxis3))
                 .tooltip(aaTooltip)
-                .series(arrayOf(aaSeriesElement1, aaSeriesElement2))
+                .legend(aaLegend)
+                .series(arrayOf(element1, element2, element3))
         }
 
     }

+ 436 - 200
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/ChartComposer/CustomTooltipComposer.kt

@@ -35,50 +35,48 @@
  */
 package com.aachartmodel.aainfographics.ChartsDemo.ChartComposer
 
-import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AAOptions
-import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AAStyle
-import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.AATooltip
+import com.aachartmodel.aainfographics.AAInfographicsLib.AAOptionsModel.*
 import com.example.chartcorekotlin.AAChartConfiger.*
 
 class CustomTooltipComposer {
     companion object {
-     fun customAreaChartTooltipStyleWithFormatterFunction1(): AAOptions {
-        val aaChartModel = AAChartModel()
-            .chartType(AAChartType.Area)//图形类型
-            .title("近三个月金价起伏周期图")//图表主标题
-            .subtitle("金价(元/克)")//图表副标题
-            .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
-            .dataLabelsEnabled(false)
-            .categories(arrayOf(
-                "10-01", "10-02", "10-03", "10-04", "10-05", "10-06", "10-07", "10-08", "10-09", "10-10", "10-11",
-                "10-12", "10-13", "10-14", "10-15", "10-16", "10-17", "10-18", "10-19", "10-20", "10-21", "10-22",
-                "10-23", "10-024", "10-25", "10-26", "10-27", "10-28", "10-29", "10-30", "10-31", "11-01", "11-02",
-                "11-03", "11-04", "11-05", "11-06", "11-07", "11-08", "11-09", "11-10", "11-11", "11-12", "11-13",
-                "11-14", "11-15", "11-16", "11-17", "11-18", "11-19", "11-20", "11-21", "11-22", "11-23", "11-024",
-                "11-25", "11-26", "11-27", "11-28", "11-29", "11-30", "12-01", "12-02", "12-03", "12-04", "12-05",
-                "12-06", "12-07", "12-08", "12-09", "12-10", "12-11", "12-12", "12-13", "12-14", "12-15", "12-16",
-                "12-17", "12-18", "12-19", "12-20", "12-21", "12-22", "12-23", "12-024", "12-25", "12-26", "12-27",
-                "12-28", "12-29", "12-30"))
-            .series(arrayOf(
-                AASeriesElement()
-                    .name("2020")
-                    .lineWidth(3f)
-                    .color("#FFD700"/*纯金色*/)
-                    .fillOpacity(0.5f)
-                    .data(arrayOf(
-                        1.51, 6.7, 0.94, 1.44, 1.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10,
-                        4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.51, 12.7, 0.94, 1.44,
-                        18.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46,
-                        3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.33, 4.68, 1.31, 1.10, 13.9, 1.10, 1.16, 1.67,
-                        2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05,
-                        2.18, 3.24, 3.23, 3.15, 2.90, 1.81, 2.11, 2.43, 5.59, 3.09, 4.09, 6.14, 5.33, 6.05,
-                        5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.48))
-            ))
-
-        val aaTooltip = AATooltip()
-            .useHTML(true)
-            .formatter(
-             """
+        fun customAreaChartTooltipStyleWithFormatterFunction1(): AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Area)//图形类型
+                .title("近三个月金价起伏周期图")//图表主标题
+                .subtitle("金价(元/克)")//图表副标题
+                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
+                .dataLabelsEnabled(false)
+                .categories(arrayOf(
+                    "10-01", "10-02", "10-03", "10-04", "10-05", "10-06", "10-07", "10-08", "10-09", "10-10", "10-11",
+                    "10-12", "10-13", "10-14", "10-15", "10-16", "10-17", "10-18", "10-19", "10-20", "10-21", "10-22",
+                    "10-23", "10-024", "10-25", "10-26", "10-27", "10-28", "10-29", "10-30", "10-31", "11-01", "11-02",
+                    "11-03", "11-04", "11-05", "11-06", "11-07", "11-08", "11-09", "11-10", "11-11", "11-12", "11-13",
+                    "11-14", "11-15", "11-16", "11-17", "11-18", "11-19", "11-20", "11-21", "11-22", "11-23", "11-024",
+                    "11-25", "11-26", "11-27", "11-28", "11-29", "11-30", "12-01", "12-02", "12-03", "12-04", "12-05",
+                    "12-06", "12-07", "12-08", "12-09", "12-10", "12-11", "12-12", "12-13", "12-14", "12-15", "12-16",
+                    "12-17", "12-18", "12-19", "12-20", "12-21", "12-22", "12-23", "12-024", "12-25", "12-26", "12-27",
+                    "12-28", "12-29", "12-30"))
+                .series(arrayOf(
+                    AASeriesElement()
+                        .name("2020")
+                        .lineWidth(3f)
+                        .color("#FFD700"/*纯金色*/)
+                        .fillOpacity(0.5f)
+                        .data(arrayOf(
+                            1.51, 6.7, 0.94, 1.44, 1.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10,
+                            4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.51, 12.7, 0.94, 1.44,
+                            18.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46,
+                            3.46, 3.55, 3.50, 4.13, 2.58, 2.28, 1.33, 4.68, 1.31, 1.10, 13.9, 1.10, 1.16, 1.67,
+                            2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05,
+                            2.18, 3.24, 3.23, 3.15, 2.90, 1.81, 2.11, 2.43, 5.59, 3.09, 4.09, 6.14, 5.33, 6.05,
+                            5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.48))
+                ))
+
+            val aaTooltip = AATooltip()
+                .useHTML(true)
+                .formatter(
+                    """
 function () {
         return ' 🌕 🌖 🌗 🌘 🌑 🌒 🌓 🌔 <br/> '
         + ' Support JavaScript Function Just Right Now !!! <br/> '
@@ -89,48 +87,48 @@ function () {
         + ' </b> Dollars ';
         }
              """.trimIndent()
-            )
-            .valueDecimals(2)//设置取值精确到小数点后几位//设置取值精确到小数点后几位
-            .backgroundColor("#000000")
-            .borderColor("#000000")
-            .style(
-                AAStyle()
-                    .color("#FFD700")
-                    .fontSize(12f)
-            )
-        val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
-         aaOptions.tooltip(aaTooltip)
-        return aaOptions
-    }
+                )
+                .valueDecimals(2)//设置取值精确到小数点后几位//设置取值精确到小数点后几位
+                .backgroundColor("#000000")
+                .borderColor("#000000")
+                .style(
+                    AAStyle()
+                        .color("#FFD700")
+                        .fontSize(12f)
+                )
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.tooltip(aaTooltip)
+            return aaOptions
+        }
 
-     fun customAreaChartTooltipStyleWithFormatterFunction2(): AAOptions {
-        val aaChartModel = AAChartModel()
-            .chartType(AAChartType.Area)//图形类型
-            .title("2014 ~ 2020 汪星人生存指数")//图表主标题
-            .subtitle("数据来源:www.无任何可靠依据.com")//图表副标题
-            .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
-            .dataLabelsEnabled(false)
-            .colorsTheme(arrayOf<Any>("#ff0000", "#0000ff"))
-            .stacking(AAChartStackingType.Normal)
-            .series(arrayOf(
-                AASeriesElement()
-                    .name("🐶狗子")
-                    .lineWidth(5f)
-                    .fillOpacity(0.5f)
-                    .data(arrayOf(0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58,
-                        0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36)),
-                AASeriesElement()
-                    .name("🌲树木")
-                    .lineWidth(5f)
-                    .fillOpacity(0.5f)
-                    .data(arrayOf(0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46,
-                        0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67))
-            ))
-
-        val aaTooltip = AATooltip()
-            .useHTML(true)
-            .formatter(
-                """
+        fun customAreaChartTooltipStyleWithFormatterFunction2(): AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Area)//图形类型
+                .title("2014 ~ 2020 汪星人生存指数")//图表主标题
+                .subtitle("数据来源:www.无任何可靠依据.com")//图表副标题
+                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
+                .dataLabelsEnabled(false)
+                .colorsTheme(arrayOf<Any>("#ff0000", "#0000ff"))
+                .stacking(AAChartStackingType.Normal)
+                .series(arrayOf(
+                    AASeriesElement()
+                        .name("🐶狗子")
+                        .lineWidth(5f)
+                        .fillOpacity(0.5f)
+                        .data(arrayOf(0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58,
+                            0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36)),
+                    AASeriesElement()
+                        .name("🌲树木")
+                        .lineWidth(5f)
+                        .fillOpacity(0.5f)
+                        .data(arrayOf(0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46,
+                            0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67))
+                ))
+
+            val aaTooltip = AATooltip()
+                .useHTML(true)
+                .formatter(
+                    """
 function () {
         var s = '第' + '<b>' +  this.x + '</b>' + '年' + '<br/>';
         var colorDot1 = '<span style=\"' + 'color:#1e90ff; font-size:13px\"' + '>◉</span> ';
@@ -141,39 +139,39 @@ function () {
         return s;
     }
              """.trimIndent()
-            )
-        val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
-         aaOptions.tooltip = aaTooltip
-        return aaOptions
-    }
+                )
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.tooltip = aaTooltip
+            return aaOptions
+        }
 
-     fun customAreaChartTooltipStyleWithFormatterFunction3(): AAOptions {
-        val aaChartModel = AAChartModel()
-            .chartType(AAChartType.Area)//图形类型
-            .title("2014 ~ 2020 汪星人生存指数")//图表主标题
-            .subtitle("数据来源:www.无任何可靠依据.com")//图表副标题
-            .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
-            .dataLabelsEnabled(false)
-            .categories(arrayOf("临床一期", "临床二期", "临床三期"))
-            .series(arrayOf(
-                AASeriesElement()
-                    .name("上市")
-                    .data(arrayOf(0, 0, 7)),
-                AASeriesElement()
-                    .name("中止")
-                    .data(arrayOf(4, 5, 1)),
-                AASeriesElement()
-                    .name("无进展")
-                    .data(arrayOf(2, 0, 1)),
-                AASeriesElement()
-                    .name("进行中")
-                    .data(arrayOf(3, 5, 2))
-            ))
-
-        val aaTooltip = AATooltip()
-            .useHTML(true)
-            .formatter(
-                """
+        fun customAreaChartTooltipStyleWithFormatterFunction3(): AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Area)//图形类型
+                .title("2014 ~ 2020 汪星人生存指数")//图表主标题
+                .subtitle("数据来源:www.无任何可靠依据.com")//图表副标题
+                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
+                .dataLabelsEnabled(false)
+                .categories(arrayOf("临床一期", "临床二期", "临床三期"))
+                .series(arrayOf(
+                    AASeriesElement()
+                        .name("上市")
+                        .data(arrayOf(0, 0, 7)),
+                    AASeriesElement()
+                        .name("中止")
+                        .data(arrayOf(4, 5, 1)),
+                    AASeriesElement()
+                        .name("无进展")
+                        .data(arrayOf(2, 0, 1)),
+                    AASeriesElement()
+                        .name("进行中")
+                        .data(arrayOf(3, 5, 2))
+                ))
+
+            val aaTooltip = AATooltip()
+                .useHTML(true)
+                .formatter(
+                    """
 function () {
         var colorDot0 = '<span style=\"' + 'color:red; font-size:13px\"' + '>◉</span> ';
         var colorDot1 = '<span style=\"' + 'color:mediumspringgreen; font-size:13px\"' + '>◉</span> ';
@@ -191,53 +189,53 @@ function () {
         return wholeContentString;
     }
                 """.trimIndent()
-            )
-        val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
-         aaOptions.tooltip = aaTooltip
-        return aaOptions
-    }
+                )
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.tooltip = aaTooltip
+            return aaOptions
+        }
 
-     fun customAreaChartTooltipStyleWithFormatterFunction4(): AAOptions {
-        val aaChartModel = AAChartModel()
-            .chartType(AAChartType.Areaspline)//图形类型
-            .title("")//图表主标题
-            .subtitle("")//图表副标题
-            .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
-            .dataLabelsEnabled(false)
-            .colorsTheme(arrayOf<Any>("#04d69f", "#1e90ff", "#ef476f", "#ffd066"))
-            .stacking(AAChartStackingType.Normal)
-            .markerRadius(0f)
-            .series(arrayOf(
-                AASeriesElement()
-                    .name("Tokyo Hot")
-                    .lineWidth(5.0f)
-                    .fillOpacity(0.4f)
-                    .data(arrayOf(0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50,
-                        0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36)),
-                AASeriesElement()
-                    .name("Berlin Hot")
-                    .lineWidth(5.0f)
-                    .fillOpacity(0.4f)
-                    .data(arrayOf(0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54,
-                        0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67)),
-                AASeriesElement()
-                    .name("New York Hot")
-                    .lineWidth(5.0f)
-                    .fillOpacity(0.4f)
-                    .data(arrayOf(0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60,
-                        0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64)),
-                AASeriesElement()
-                    .name("London Hot")
-                    .lineWidth(5.0f)
-                    .fillOpacity(0.4f)
-                    .data(arrayOf(0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65,
-                        0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53))
-            ))
-
-        val aaTooltip = AATooltip()
-            .useHTML(true)
-            .formatter(
-                """
+        fun customAreaChartTooltipStyleWithFormatterFunction4(): AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Areaspline)//图形类型
+                .title("")//图表主标题
+                .subtitle("")//图表副标题
+                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
+                .dataLabelsEnabled(false)
+                .colorsTheme(arrayOf<Any>("#04d69f", "#1e90ff", "#ef476f", "#ffd066"))
+                .stacking(AAChartStackingType.Normal)
+                .markerRadius(0f)
+                .series(arrayOf(
+                    AASeriesElement()
+                        .name("Tokyo Hot")
+                        .lineWidth(5.0f)
+                        .fillOpacity(0.4f)
+                        .data(arrayOf(0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50,
+                            0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36)),
+                    AASeriesElement()
+                        .name("Berlin Hot")
+                        .lineWidth(5.0f)
+                        .fillOpacity(0.4f)
+                        .data(arrayOf(0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54,
+                            0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67)),
+                    AASeriesElement()
+                        .name("New York Hot")
+                        .lineWidth(5.0f)
+                        .fillOpacity(0.4f)
+                        .data(arrayOf(0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60,
+                            0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64)),
+                    AASeriesElement()
+                        .name("London Hot")
+                        .lineWidth(5.0f)
+                        .fillOpacity(0.4f)
+                        .data(arrayOf(0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65,
+                            0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53))
+                ))
+
+            val aaTooltip = AATooltip()
+                .useHTML(true)
+                .formatter(
+                    """
 function () {
         var colorsArr = ["mediumspringgreen", "deepskyblue", "red", "sandybrown"];
         var wholeContentString ='<span style=\"' + 'color:lightGray; font-size:13px\"' + '>◉ Time: ' + this.x + ' year</span><br/>';
@@ -253,59 +251,297 @@ function () {
         return wholeContentString;
     }
                 """.trimIndent()
-            )
-            .backgroundColor("#050505")
-            .borderColor("#050505")
-        val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
-         aaOptions.tooltip = aaTooltip
-        return aaOptions
-    }
+                )
+                .backgroundColor("#050505")
+                .borderColor("#050505")
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.tooltip = aaTooltip
+            return aaOptions
+        }
 
-     fun customBoxplotTooltipContent(): AAOptions {
-        val aaChartModel = AAChartModel()
-            .chartType(AAChartType.Boxplot)
-            .title("BOXPLOT CHART")
-            .subtitle("virtual data")
-            .yAxisTitle("℃")
-            .series(arrayOf(
+        fun customBoxplotTooltipContent(): AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Boxplot)
+                .title("BOXPLOT CHART")
+                .subtitle("virtual data")
+                .yAxisTitle("℃")
+                .series(arrayOf(
                     AASeriesElement()
                         .name("Observed Data")
                         .color("#ef476f")
                         .fillColor(AAGradientColor.deepSeaColor())
                         .data(arrayOf(
-                                arrayOf(760, 801, 848, 895, 965),
-                                arrayOf(733, 853, 939, 980, 1080),
-                                arrayOf(714, 762, 817, 870, 918),
-                                arrayOf(724, 802, 806, 871, 950),
-                                arrayOf(834, 836, 864, 882, 910)
-                            )
+                            arrayOf(760, 801, 848, 895, 965),
+                            arrayOf(733, 853, 939, 980, 1080),
+                            arrayOf(714, 762, 817, 870, 918),
+                            arrayOf(724, 802, 806, 871, 950),
+                            arrayOf(834, 836, 864, 882, 910)
+                        )
                         )
                 )
-            )
-
-        val pointFormatStr = (
-                "◉</span> <b> {series.name}</b><br/>"
-                + "最大值: {point.high}<br/>"
-                + "Q2: {point.q3}<br/>"
-                + "中位数: {point.median}<br/>"
-                + "Q1: {point.q1}<br/>"
-                + "最小值: {point.low}<br/>"
                 )
 
-        val aaTooltip = AATooltip()
-            .useHTML(true)
-            .headerFormat("<em>实验号码: {point.key}</em><br/>")
-            .pointFormat(pointFormatStr)
-            .valueDecimals(2)//设置取值精确到小数点后几位//设置取值精确到小数点后几位
-            .backgroundColor("#000000")
-            .borderColor("#000000")
-            .style(AAStyle()
+            val pointFormatStr = (
+                    "◉</span> <b> {series.name}</b><br/>"
+                            + "最大值: {point.high}<br/>"
+                            + "Q2: {point.q3}<br/>"
+                            + "中位数: {point.median}<br/>"
+                            + "Q1: {point.q1}<br/>"
+                            + "最小值: {point.low}<br/>"
+                    )
+
+            val aaTooltip = AATooltip()
+                .useHTML(true)
+                .headerFormat("<em>实验号码: {point.key}</em><br/>")
+                .pointFormat(pointFormatStr)
+                .valueDecimals(2)//设置取值精确到小数点后几位//设置取值精确到小数点后几位
+                .backgroundColor("#000000")
+                .borderColor("#000000")
+                .style(AAStyle()
                     .color("#1e90ff")
                     .fontSize(12f)
-            )
-        val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
-         aaOptions.tooltip = aaTooltip
-        return aaOptions
+                )
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.tooltip = aaTooltip
+            return aaOptions
+        }
+
+         fun customYAxisLabels():AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Line)//图形类型
+                .title("")//图表主标题
+                .subtitle("")//图表副标题
+                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
+                .dataLabelsEnabled(false)
+                .colorsTheme(arrayOf("#04d69f", "#1e90ff", "#ef476f", "#ffd066"))
+                .stacking(AAChartStackingType.Normal)
+                .markerRadius(8f)
+                .series(arrayOf(AASeriesElement()
+                    .name("Tokyo Hot")
+                    .lineWidth(5.0f)
+                    .fillOpacity(0.4f)
+                    .data(arrayOf(29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4))))
+
+            val aaYAxisLabels = AALabels()
+                .formatter("""
+function () {
+        let yValue = this.value;
+        if (yValue >= 200) {
+            return "极佳";
+        } else if (yValue >= 150 && yValue < 200) {
+            return "非常棒";
+        } else if (yValue >= 100 && yValue < 150) {
+            return "相当棒";
+        } else if (yValue >= 50 && yValue < 100) {
+            return "还不错";
+        } else {
+            return "一般";
+        }
+    }
+                """.trimIndent()
+                )
+
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.yAxis?.labels(aaYAxisLabels)
+
+            return aaOptions
+        }
+
+         fun customYAxisLabels2():AAOptions {
+            val aaChartModel = AAChartModel()
+                .chartType(AAChartType.Line)//图形类型
+                .title("")//图表主标题
+                .subtitle("")//图表副标题
+                .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
+                .dataLabelsEnabled(false)
+                .colorsTheme(arrayOf("#04d69f", "#1e90ff", "#ef476f", "#ffd066"))
+                .stacking(AAChartStackingType.Normal)
+                .markerRadius(8f)
+                .series(arrayOf(AASeriesElement()
+                    .name("Tokyo Hot")
+                    .lineWidth(5.0f)
+                    .fillOpacity(0.4f)
+                    .data(arrayOf(229.9, 771.5, 1106.4, 1129.2, 6644.0, 1176.0, 8835.6, 148.5, 8816.4, 6694.1, 7795.6, 9954.4))))
+
+            val aaYAxisLabels = AALabels()
+                .style(AAStyle()
+                    .fontSize(10f)
+                    .fontWeight(AAChartFontWeightType.Bold)
+                    .color(AAColor.grayColor())
+                )
+                .formatter("""
+function () {
+        let yValue = this.value;
+        if (yValue == 0) {
+            return "0";
+        } else if (yValue == 2500) {
+            return "25%";
+        } else if (yValue == 5000) {
+            return "50%";
+        } else if (yValue == 7500) {
+            return "75%";
+        } else if (yValue == 10000) {
+            return "100%";
+        }
     }
+                """.trimIndent()
+                )
+
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.yAxis!!
+                .opposite(true)
+                .tickWidth(2f)
+                .lineWidth(1.5f)//Y轴轴线颜色
+                .lineColor(AAColor.lightGrayColor())//Y轴轴线颜色
+                .gridLineWidth(0f)//Y轴网格线宽度
+                .tickPositions(arrayOf(0, 2500, 5000, 7500, 10000))
+                .labels(aaYAxisLabels)
+
+            return aaOptions
+        }
+
+         fun customStackedAndGroupedColumnChartTooltip():AAOptions {
+            val aaChartModel = AAChartModel()
+                .title("Total fruit consumtion, grouped by gender")
+                .subtitle("stacked and grouped")
+                .yAxisTitle("Number of fruits")
+                .chartType(AAChartType.Column)
+                .legendEnabled(false)//隐藏图例(底部可点按的小圆点)
+                .stacking(AAChartStackingType.Normal)
+                .categories(arrayOf("Apples", "Oranges", "Pears", "Grapes", "Bananas"))
+                .dataLabelsEnabled(true)
+                .series(arrayOf(AASeriesElement()
+                    .name("John")
+                    .data(arrayOf(5, 3, 4, 7, 2))
+                    .stack("male"), AASeriesElement()
+                    .name("Joe")
+                    .data(arrayOf(3, 4, 4, 2, 5))
+                    .stack("male"), AASeriesElement()
+                    .name("Jane")
+                    .data(arrayOf(2, 5, 6, 2, 1))
+                    .stack("female"), AASeriesElement()
+                    .name("Janet")
+                    .data(arrayOf(3, 0, 4, 4, 3))
+                    .stack("female"))
+                )
+
+            /*Custom Tooltip Style --- 自定义图表浮动提示框样式及内容*/
+            val aaOptions = AAOptionsConstructor.configureChartOptions(aaChartModel)
+            aaOptions.tooltip
+                ?.shared(false)
+                ?.formatter("""
+function () {
+                return '<b>'
+                + this.x
+                + '</b><br/>'
+                + this.series.name
+                + ': '
+                + this.y
+                + '<br/>'
+                + 'Total: '
+                + this.point.stackTotal;
+     }
+                """.trimIndent()
+                )
+
+            return aaOptions
+        }
+
+         fun customDoubleXAxesChart():AAOptions {
+            val gradientColorDic1 = AAGradientColor.linearGradient(
+                AALinearGradientDirection.ToTop,
+                "#7052f4",
+                "#00b0ff"//颜色字符串设置支持十六进制类型和 rgba 类型
+            )
+
+            val gradientColorDic2 = AAGradientColor.linearGradient(
+                AALinearGradientDirection.ToTop,
+                "#EF71FF",
+                "#4740C8"//颜色字符串设置支持十六进制类型和 rgba 类型
+            )
+
+            val aaChart = AAChart()
+                .type(AAChartType.Bar)
+
+            val aaTitle = AATitle()
+                .text("2015 年德国人口金字塔")
+                .style(AAStyle()
+                    .color("#000000")
+                    .fontSize(12.0f))
+
+            val aaCategories = arrayOf("0-4", "5-9", "10-14", "15-19", "20-24", "25-29",
+                "30-34", "35-39", "40-44", "45-49", "50-54", "55-59", "60-64", "65-69", "70-74",
+                "75-79", "80-84", "85-89", "90-94", "95-99", "100 + ")
+
+            val aaXAxis1 = AAXAxis()
+                .reversed(true)
+                .categories(aaCategories)
+                .labels(AALabels()
+                    .step(1))
+
+            val aaXAxis2 = AAXAxis()
+                .reversed(true)
+                .opposite(true)
+                .categories(aaCategories)
+                .linkedTo(0)
+                .labels(AALabels()
+                    .step(1))
+
+            val aaYAxis = AAYAxis()
+                .gridLineWidth(0f)// Y 轴网格线宽度
+                .title(AATitle()
+                    .text(""))//Y 轴标题
+                .labels(AALabels()
+                    .formatter("""
+function () {
+    return (Math.abs(this.value) / 1000000) + 'M';
+}
+                    """.trimIndent()
+                    ))
+                .min(-4000000f)
+                .max(4000000f)
+
+            val aaPlotOptions = AAPlotOptions()
+                .series(AASeries()
+                    .animation(AAAnimation()
+                        .duration(800)
+                        .easing(AAChartAnimationType.Bounce)
+                    )
+                    .stacking(AAChartStackingType.Normal))
+
+            val aaTooltip = AATooltip()
+                .enabled(true)
+                .shared(false)
+                .formatter("""
+function () {
+    return '<b>' + this.series.name + ', age ' + this.point.category + '</b><br/>' +
+        '人口: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0);
+}
+                """.trimIndent()
+                )
+
+            val aaSeriesElement1 = AASeriesElement()
+                .name("Men")
+                .color(gradientColorDic1)
+                .data(arrayOf(-1746181, -1884428, -2089758, -2222362, -2537431, -2507081, -2443179,
+                    -2664537, -3556505, -3680231, -3143062, -2721122, -2229181, -2227768, -2176300,
+                    -1329968, -836804, -354784, -90569, -28367, -3878))
+
+            val aaSeriesElement2 = AASeriesElement()
+                .name("Women")
+                .color(gradientColorDic2)
+                .data(arrayOf(1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874,
+                    3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638, 1447162,
+                    1005011, 330870, 130632, 21208))
+
+            return AAOptions()
+                .chart(aaChart)
+                .title(aaTitle)
+                .xAxisArray(arrayOf(aaXAxis1, aaXAxis2))
+                .yAxis(aaYAxis)
+                .plotOptions(aaPlotOptions)
+                .tooltip(aaTooltip)
+                .series(arrayOf(aaSeriesElement1, aaSeriesElement2))
+        }
     }
 }

+ 2 - 3
app/src/main/java/com/aachartmodel/aainfographics/ChartsDemo/ChartComposer/MixedChartComposer.kt

@@ -184,8 +184,7 @@ companion object {
                     .data(arrayOf(82.89,67.54,62.07,59.43,67.02,67.09,35.66,71.78,81.61,78.85,79.12,72.30))
                     .dataLabels(AADataLabels()
                         .enabled(true)
-                        .style(
-                            AAStyle()
+                        .style(AAStyle()
                                 .color(AAColor.redColor())
                                 .fontSize(11f)
                         )
@@ -209,7 +208,7 @@ companion object {
                         .style(AAStyle()
                             .color("#000000")
                             .fontSize(15f)
-                            .fontWeight("bold")
+                            .fontWeight(AAChartFontWeightType.Bold)
                         )
                     )
             )