This commit is contained in:
coco
2026-07-03 15:56:07 +08:00
commit caef23209c
5767 changed files with 1004268 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdk 34
defaultConfig {
applicationId "com.github.aachartmodel.aainfographics.demo"
minSdkVersion 19
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
}
dependencies {
implementation project(':charts')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
implementation "com.google.code.gson:gson:2.10.1"
}
+23
View File
@@ -0,0 +1,23 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.github.aachartmodel.aainfographics.** { *; }
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.github.aachartmodel.aainfographics.demo">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup">
<activity android:name=".basiccontent.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".additionalcontent.ScrollingUpdateDataActivity" />
<activity android:name=".basiccontent.SpecialChartActivity" />
<activity android:name=".basiccontent.CustomStyleChartActivity" />
<activity android:name=".basiccontent.MixedChartActivity" />
<activity android:name=".basiccontent.BasicChartActivity" />
<activity android:name=".additionalcontent.JSFormatterFunctionActivity" />
<activity android:name=".additionalcontent.JSFunctionForAAAxisActivity" />
<activity android:name=".additionalcontent.JSFunctionForAALegendActivity" />
<activity android:name=".additionalcontent.JSFunctionForAAChartEventsActivity" />
<activity android:name=".additionalcontent.JSFunctionForAAOptionsActivity" />
<activity android:name=".additionalcontent.DrawChartWithAAOptionsActivity" />
<activity android:name=".additionalcontent.EvaluateJSStringFunctionActivity" />
<activity android:name=".additionalcontent.HideOrShowChartSeriesActivity" />
<activity android:name=".additionalcontent.OnlyRefreshChartDataActivity" />
<activity android:name=".additionalcontent.DoubleChartsLinkedWorkActivity" />
<activity android:name=".additionalcontent.ScrollableChartActivity" />
<activity android:name=".additionalcontent.AdvancedUpdatingFeatureActivity" />
</application>
</manifest>
@@ -0,0 +1,164 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import android.util.Log
import android.widget.CompoundButton
import android.widget.RadioGroup
import android.widget.Toast
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartStackingType
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartSymbolType
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartType
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.aaoptionsmodel.*
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.basiccontent.BasicChartActivity
class AdvancedUpdatingFeatureActivity : BasicChartActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun onCheckedChanged(group: RadioGroup, checkedId: Int) {
var options: Any? = Any()
when (group.id) {
R.id.stackingTypeRadioGroup -> {
var stackingType = AAChartStackingType.False
when (group.checkedRadioButtonId) {
R.id.noStackingRadio -> stackingType = AAChartStackingType.False
R.id.normalStackingRadio -> stackingType = AAChartStackingType.Normal
R.id.percentStackingRadio -> stackingType = AAChartStackingType.Percent
}
val aaPlotOptions: AAPlotOptions = AAPlotOptions()
.series(AASeries()
.stacking(stackingType))
options = aaPlotOptions
}
R.id.cornerStyleTypeRadioGroup -> {
var borderRadius: Float? = null
when (group.checkedRadioButtonId) {
R.id.squareCornersRadio -> borderRadius = 1f
R.id.roundedCornersRadio -> borderRadius = 10f
R.id.wedgeCornersRadio -> borderRadius = 100f
}
val aaPlotOptions: AAPlotOptions
aaPlotOptions = if (chartType == AAChartType.Column.value) {
AAPlotOptions()
.column(AAColumn()
.borderRadius(borderRadius))
} else {
AAPlotOptions()
.bar(AABar()
.borderRadius(borderRadius))
}
options = aaPlotOptions
}
else -> {
var markerSymbol = AAChartSymbolType.Circle
when (group.checkedRadioButtonId) {
R.id.circleSymbolRadio -> markerSymbol = AAChartSymbolType.Circle
R.id.diamondSymbolRadio -> markerSymbol = AAChartSymbolType.Diamond
R.id.squareSymbolRadio -> markerSymbol = AAChartSymbolType.Square
R.id.triangleSymbolRadio -> markerSymbol = AAChartSymbolType.Triangle
R.id.triangleDownSymbolRadio -> markerSymbol = AAChartSymbolType.TriangleDown
}
val aaPlotOptions: AAPlotOptions = AAPlotOptions()
.series(AASeries()
.marker(AAMarker()
.symbol(markerSymbol.value)))
options = aaPlotOptions
}
}
aaChartView?.aa_updateChartWithOptions(options, true)
}
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
var options = Any()
when (buttonView.id) {
R.id.xReversedSwitch -> {
val aaXAxis: AAXAxis = AAXAxis()
.reversed(isChecked)
options = aaXAxis
}
R.id.yReversedSwitch -> {
val aaYAxis: AAYAxis = AAYAxis()
.reversed(isChecked)
options = aaYAxis
}
R.id.xInvertedSwitch -> {
if (this.aaChartModel.chartType == AAChartType.Bar) {
Toast.makeText(
this,
"⚠️⚠️⚠️inverted is useless for Bar Chart",
Toast.LENGTH_SHORT
)
.show()
Log.d("", "⚠️⚠️⚠️inverted is useless for Bar Chart")
}
val aaChart: AAChart = AAChart()
.inverted(isChecked)
.polar(this.aaChartModel.polar)
options = aaChart
}
R.id.polarSwitch -> {
this.aaChartModel.polar = isChecked
val aaChart: AAChart = AAChart()
.polar(isChecked)
.inverted(this.aaChartModel.inverted)
options = aaChart
if (this.aaChartModel.chartType == AAChartType.Column) {
options = if (this.aaChartModel.polar == true) {
AAOptions()
.chart(aaChart)
.plotOptions(AAPlotOptions()
.column(AAColumn()
.pointPadding(0f)
.groupPadding(0.005f)))
} else {
AAOptions()
.chart(aaChart)
.plotOptions(AAPlotOptions()
.column(AAColumn()
.pointPadding(0.1f)
.groupPadding(0.2f)))
}
} else if (this.aaChartModel.chartType == AAChartType.Bar) {
options = if (this.aaChartModel.polar == true) {
AAOptions()
.chart(aaChart)
.plotOptions(AAPlotOptions()
.bar(AABar()
.pointPadding(0f)
.groupPadding(0.005f)))
} else {
AAOptions()
.chart(aaChart)
.plotOptions(AAPlotOptions()
.bar(AABar()
.pointPadding(0.1f)
.groupPadding(0.2f)))
}
}
}
R.id.dataShowSwitch -> {
val aaPlotOptions: AAPlotOptions = AAPlotOptions()
.series(AASeries()
.dataLabels(AADataLabels()
.enabled(isChecked)))
options = aaPlotOptions
}
R.id.markerHideSwitch -> {
val aaMarker: AAMarker = if (isChecked)
AAMarker()
.enabled(false)
else AAMarker()
.enabled(true)
.radius(6f)
val aaPlotOptions: AAPlotOptions = AAPlotOptions()
.series(AASeries()
.marker(aaMarker))
options = aaPlotOptions
}
}
aaChartView?.aa_updateChartWithOptions(options, true)
}
}
@@ -0,0 +1,167 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.aatools.AAColor
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
import com.github.aachartmodel.aainfographics.demo.R
class DoubleChartsLinkedWorkActivity : AppCompatActivity(),
AAChartView.AAChartViewCallBack {
private var selectedGradientColor: Any = AAColor.Red
private var aaChartView1: AAChartView? = null
private var aaChartView2: AAChartView? = null
private var gradientColorsArr: Array<Any>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_double_charts_linked_work)
aaChartView1 = findViewById(R.id.AAChartView1)
aaChartView1?.callBack = this
aaChartView2 = findViewById(R.id.AAChartView2)
aaChartView1?.aa_drawChartWithChartOptions(configureChartOptions1())
aaChartView2?.aa_drawChartWithChartOptions(configureChartOptions2())
}
private fun configureChartOptions1(): AAOptions {
val gradientColorNamesArr = arrayOf(
"oceanBlue",
"sanguine",
"lusciousLime",
"purpleLake",
"freshPapaya",
"ultramarine",
"pinkSugar",
"lemonDrizzle",
"victoriaPurple",
"springGreens",
"mysticMauve",
"reflexSilver",
"neonGlowColor",
"berrySmoothieColor",
"newLeaf",
"cottonCandy",
"pixieDust",
"fizzyPeach",
"sweetDream",
"firebrick",
"wroughtIron",
"deepSea",
"coastalBreeze",
"eveningDelight",
"neonGlowColor",
"berrySmoothieColor"
)
val gradientColorArr = arrayOf(
AAGradientColor.OceanBlue,
AAGradientColor.Sanguine,
AAGradientColor.LusciousLime,
AAGradientColor.PurpleLake,
AAGradientColor.FreshPapaya,
AAGradientColor.Ultramarine,
AAGradientColor.PinkSugar,
AAGradientColor.LemonDrizzle,
AAGradientColor.VictoriaPurple,
AAGradientColor.SpringGreens,
AAGradientColor.MysticMauve,
AAGradientColor.ReflexSilver,
AAGradientColor.NewLeaf,
AAGradientColor.CottonCandy,
AAGradientColor.PixieDust,
AAGradientColor.FizzyPeach,
AAGradientColor.SweetDream,
AAGradientColor.Firebrick,
AAGradientColor.WroughtIron,
AAGradientColor.DeepSea,
AAGradientColor.CoastalBreeze,
AAGradientColor.EveningDelight,
AAGradientColor.NeonGlow,
AAGradientColor.BerrySmoothie
)
gradientColorsArr = gradientColorArr as Array<Any>
val aaChartModel: AAChartModel = AAChartModel.Builder(this)
.setChartType(AAChartType.Column)
.setTitle("")
.setYAxisTitle("")
.setCategories(*gradientColorNamesArr)
.setColorsTheme(gradientColorArr)
.setXAxisReversed(true)
.setYAxisReversed(true)
.setInverted(true)
.setLegendEnabled(false)
.setTouchEventEnabled(true)
.setSeries(AASeriesElement()
.name("Tokyo")
.data(arrayOf(
211, 183, 157, 133, 111, 91, 73, 57, 43, 31, 21, 13,
211, 183, 157, 133, 111, 91, 73, 57, 43, 31, 21, 13
))
.colorByPoint(true)).build()
val aaOptions: AAOptions = aaChartModel.aa_toAAOptions()
aaOptions.plotOptions?.column?.groupPadding = 0f
return aaOptions
}
private fun configureChartOptions2(): AAOptions {
val aaChartModel: AAChartModel = AAChartModel.Builder(this)
.setChartType(AAChartType.Column)
.setTitle("")
.setYAxisTitle("")
.setLegendEnabled(false)
.setYAxisGridLineWidth(0f)
.setSeries(AASeriesElement()
.name("Tokyo")
.data(arrayOf(
211,183,157,133,111,91,73,57,43,31,21,13,
211,183,157,133,111,91,73,57,43,31,21,13,
))
).build()
val aaOptions: AAOptions = aaChartModel.aa_toAAOptions()
aaOptions.plotOptions?.column?.groupPadding = 0f
return aaOptions
}
private fun configureSeriesDataArray(): Array<AADataElement> {
val maxRange = 40
val numberArr1: Array<AADataElement?> = arrayOfNulls(maxRange)
var y1: Double
val max = 38
val min = 1
val random = (Math.random() * (max - min) + min).toInt()
for (i in 0 until maxRange) {
y1 = Math.sin(random * (i * Math.PI / 180)) + i * 2 * 0.01
val aaDataElement: AADataElement = AADataElement()
.color(selectedGradientColor)
.y(y1.toFloat())
numberArr1[i] = aaDataElement
}
return numberArr1 as Array<AADataElement>
}
override fun chartViewDidFinishLoad(aaChartView: AAChartView) {
}
override fun chartViewMoveOverEventMessage(
aaChartView: AAChartView,
messageModel: AAMoveOverEventMessageModel
) {
selectedGradientColor = gradientColorsArr?.get(messageModel.index!!)!!
val mainHandler = Handler(Looper.getMainLooper())
mainHandler.post {
//已在主线程中,可以更新UI
val aaSeriesElementsArr: Array<AASeriesElement> = arrayOf<AASeriesElement>(
AASeriesElement()
.data(configureSeriesDataArray() as Array<Any>)
)
aaChartView2?.aa_onlyRefreshTheChartDataWithChartOptionsSeriesArray(
aaSeriesElementsArr
)
}
}
}
@@ -0,0 +1,96 @@
/**
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureAAPlotBandsForChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureAAPlotLinesForChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureDoubleYAxesAndColumnLineMixedChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureDoubleYAxesMarketDepthChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureDoubleYAxisChartOptions
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureTheMirrorColumnChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureTripleYAxesMixedChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureXAxisLabelsFontColorAndFontSizeWithHTMLString
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureXAxisLabelsFontColorWithHTMLString
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configureXAxisPlotBand
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.configure_DataLabels_XAXis_YAxis_Legend_Style
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.customAATooltipWithJSFunction
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.customAreaChartTooltipStyleLikeHTMLTable
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.customChartLegendStyle
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.customLineChartDataLabelsFormat
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.customXAxisCrosshairStyle
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.doubleLayerHalfPieChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.gaugeChartWithPlotBand
import com.github.aachartmodel.aainfographics.demo.chartcomposer.ChartOptionsComposer.simpleGaugeChart
class DrawChartWithAAOptionsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_draw_chart_with_aaoptions)
val intent = intent
val chartType = intent.getStringExtra("chartType")
val aaOptions = configureTheChartOptions(chartType!!)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartOptions(aaOptions)
}
private fun configureTheChartOptions(chartType: String): AAOptions {
when (chartType) {
"customLegendStyle" -> return customChartLegendStyle()
"AAPlotBandsForChart" -> return configureAAPlotBandsForChart()
"AAPlotLinesForChart" -> return configureAAPlotLinesForChart()
"customAATooltipWithJSFunction" -> 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()
"customLineChartDataLabelsFormat" -> return customLineChartDataLabelsFormat()
"configureDoubleYAxesAndColumnLineMixedChart" -> return configureDoubleYAxesAndColumnLineMixedChart()
"configureDoubleYAxesMarketDepthChart" -> return configureDoubleYAxesMarketDepthChart()
"customAreaChartTooltipStyleLikeHTMLTable" -> return customAreaChartTooltipStyleLikeHTMLTable()
"simpleGaugeChart" -> return simpleGaugeChart()
"gaugeChartWithPlotBand" -> return gaugeChartWithPlotBand()
"doubleLayerHalfPieChart" -> return doubleLayerHalfPieChart()
}
return configureAAPlotBandsForChart()
}
}
@@ -0,0 +1,41 @@
/**
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.demo.R
class EvaluateJSStringFunctionActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_evaluate_jsstring_function)
}
}
@@ -0,0 +1,41 @@
/**
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.demo.R
class HideOrShowChartSeriesActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_hide_or_show_chart_series)
}
}
@@ -0,0 +1,84 @@
/**
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customAreaChartTooltipStyleWithColorfulHtmlLabels
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customAreaChartTooltipStyleWithDifferentUnitSuffix
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customAreaChartTooltipStyleWithSimpleFormatString
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customArearangeChartTooltip
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customBoxplotTooltipContent
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customDoubleXAxesChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customLineChartOriginalPointPositionByConfiguringXAxisFormatterAndTooltipFormatter
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customLineChartTooltipStyleWhenValueBeZeroDoNotShow
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customStackedAndGroupedColumnChartTooltip
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customTooltipWhichDataSourceComeFromOutSideRatherThanSeries
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customYAxisLabels
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAATooltipComposer.customYAxisLabels2
class JSFormatterFunctionActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_custom_tooltip_with_jsfunction)
val intent = intent
val chartType = intent.getStringExtra("chartType")
val aaOptions = configureTheChartOptions(chartType!!)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartOptions(aaOptions)
}
private fun configureTheChartOptions(chartType: String): AAOptions {
when (chartType) {
"customAreaChartTooltipStyleWithSimpleFormatString" -> return customAreaChartTooltipStyleWithSimpleFormatString()//简单字符串拼接
"customAreaChartTooltipStyleWithDifferentUnitSuffix" -> return customAreaChartTooltipStyleWithDifferentUnitSuffix()//自定义不同单位后缀
"customAreaChartTooltipStyleWithColorfulHtmlLabels" -> return customAreaChartTooltipStyleWithColorfulHtmlLabels()//自定义多彩颜色文字
"customLineChartTooltipStyleWhenValueBeZeroDoNotShow" -> return customLineChartTooltipStyleWhenValueBeZeroDoNotShow()//值为0时,在tooltip中不显示
"customBoxplotTooltipContent" -> return customBoxplotTooltipContent()
"customYAxisLabels" -> return customYAxisLabels()
"customYAxisLabels2" -> return customYAxisLabels2()
"customStackedAndGroupedColumnChartTooltip" -> return customStackedAndGroupedColumnChartTooltip()
"customDoubleXAxesChart" -> return customDoubleXAxesChart()
"customArearangeChartTooltip" -> return customArearangeChartTooltip()
"customLineChartOriginalPointPositionByConfiguringXAxisFormatterAndTooltipFormatter" ->
return customLineChartOriginalPointPositionByConfiguringXAxisFormatterAndTooltipFormatter()
"customTooltipWhichDataSourceComeFromOutSideRatherThanSeries" ->
return customTooltipWhichDataSourceComeFromOutSideRatherThanSeries()
}
return customAreaChartTooltipStyleWithSimpleFormatString()
}
}
@@ -0,0 +1,48 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customYAxisLabels
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customYAxisLabels2
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customAreaChartXAxisLabelsTextUnitSuffix1
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customAreaChartXAxisLabelsTextUnitSuffix2
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.configureTheAxesLabelsFormattersOfDoubleYAxesChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.configureTheAxesLabelsFormattersOfDoubleYAxesChart2
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.configureTheAxesLabelsFormattersOfDoubleYAxesChart3
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customColumnChartXAxisLabelsTextByInterceptTheFirstFourCharacters
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customSpiderChartStyle
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customizeEveryDataLabelSinglelyByDataLabelsFormatter
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAAxisComposer.customXAxisLabelsBeImages
class JSFunctionForAAAxisActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_custom_tooltip_with_jsfunction)
val intent = intent
val chartType = intent.getStringExtra("chartType")
val aaOptions: AAOptions = chartConfigurationWithSelectedIndex(chartType)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartOptions(aaOptions)
}
fun chartConfigurationWithSelectedIndex(chartType: String?): AAOptions {
return when (chartType) {
"customYAxisLabels" -> customYAxisLabels() //自定义Y轴文字
"customYAxisLabels2" -> customYAxisLabels2() //自定义Y轴文字2
"customAreaChartXAxisLabelsTextUnitSuffix1" -> customAreaChartXAxisLabelsTextUnitSuffix1() //自定义X轴文字单位后缀(通过 formatter 函数)
"customAreaChartXAxisLabelsTextUnitSuffix2" -> customAreaChartXAxisLabelsTextUnitSuffix2() //自定义X轴文字单位后缀(不通过 formatter 函数)
"configureTheAxesLabelsFormattersOfDoubleYAxesChart" -> configureTheAxesLabelsFormattersOfDoubleYAxesChart() //配置双 Y 轴图表的 Y 轴文字标签的 Formatter 函数 示例 1
"configureTheAxesLabelsFormattersOfDoubleYAxesChart2" -> configureTheAxesLabelsFormattersOfDoubleYAxesChart2() //配置双 Y 轴图表的 Y 轴文字标签的 Formatter 函数 示例 2
"configureTheAxesLabelsFormattersOfDoubleYAxesChart3" -> configureTheAxesLabelsFormattersOfDoubleYAxesChart3() //配置双 Y 轴图表的 Y 轴文字标签的 Formatter 函数 示例 3
"customColumnChartXAxisLabelsTextByInterceptTheFirstFourCharacters" -> customColumnChartXAxisLabelsTextByInterceptTheFirstFourCharacters() //通过截取前四个字符来自定义 X 轴 labels
"customSpiderChartStyle" -> customSpiderChartStyle() //自定义蜘蛛🕷🕸图样式
"customizeEveryDataLabelSinglelyByDataLabelsFormatter" -> customizeEveryDataLabelSinglelyByDataLabelsFormatter() //通过 DataLabels 的 formatter 函数来实现单个数据标签🏷自定义
"customXAxisLabelsBeImages" -> customXAxisLabelsBeImages() //自定义 X轴 labels 为一组图片
else -> customYAxisLabels()
}
}
}
@@ -0,0 +1,47 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.setCrosshairAndTooltipToTheDefaultPositionAfterLoadingChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.advancedTimeLineChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.automaticallyHideTooltipAfterItIsShown
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.configureBlinkMarkerChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.configureECGStyleChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.configureScatterChartWithBlinkEffect
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.configureSpecialStyleMarkerOfSingleDataElementChartWithBlinkEffect
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.customizeYAxisPlotLinesLabelBeSpecialStyle
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.dynamicHeightGridLineAreaChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAChartEventsComposer.generalDrawingChart
class JSFunctionForAAChartEventsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_custom_tooltip_with_jsfunction)
val intent = intent
val chartType = intent.getStringExtra("chartType")
val aaOptions = configureTheChartOptions(chartType!!)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartOptions(aaOptions) }
fun configureTheChartOptions(chartType: String?): AAOptions {
when (chartType) {
"setCrosshairAndTooltipToTheDefaultPositionAfterLoadingChart" -> return setCrosshairAndTooltipToTheDefaultPositionAfterLoadingChart() //图表加载完成后,自动设置默认的十字准星和浮动提示框的位置
"generalDrawingChart" -> return generalDrawingChart() //自由绘图
"advancedTimeLineChart" -> return advancedTimeLineChart() //高级时间线图
"configureBlinkMarkerChart" -> return configureBlinkMarkerChart() //配置闪烁的标记点
"configureSpecialStyleMarkerOfSingleDataElementChartWithBlinkEffect" -> return configureSpecialStyleMarkerOfSingleDataElementChartWithBlinkEffect() //配置单个数据元素的特殊样式标记点即闪烁特效
"configureScatterChartWithBlinkEffect" -> return configureScatterChartWithBlinkEffect() //配置散点图的闪烁特效
"automaticallyHideTooltipAfterItIsShown" -> return automaticallyHideTooltipAfterItIsShown() //图表加载完成后,自动隐藏浮动提示框
"dynamicHeightGridLineAreaChart" -> return dynamicHeightGridLineAreaChart() //动态高度网格线的区域填充图
"customizeYAxisPlotLinesLabelBeSpecialStyle" -> return customizeYAxisPlotLinesLabelBeSpecialStyle() //自定义 Y 轴轴线上面的标签文字特殊样式
"configureECGStyleChart" -> return configureECGStyleChart() //配置 ECG 样式的图表
}
return setCrosshairAndTooltipToTheDefaultPositionAfterLoadingChart()
}
}
@@ -0,0 +1,31 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAALegendComposer.customLegendItemClickEvent
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAALegendComposer.disableLegendClickEventForNormalChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAALegendComposer.disableLegendClickEventForPieChart
class JSFunctionForAALegendActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_custom_tooltip_with_jsfunction)
val intent = intent
val chartType = intent.getStringExtra("chartType")
val aaOptions: AAOptions = chartConfigurationWithSelectedIndex(chartType)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartOptions(aaOptions)
}
fun chartConfigurationWithSelectedIndex(chartType: String?): AAOptions {
return when (chartType) {
"disableLegendClickEventForNormalChart" -> disableLegendClickEventForNormalChart() //禁用普通图表的图例点击事件
"disableLegendClickEventForPieChart" -> disableLegendClickEventForPieChart() //禁用饼图图表的图例点击事件
"customLegendItemClickEvent" -> customLegendItemClickEvent() //自定义图例点击事件
else -> disableLegendClickEventForNormalChart()
}
}
}
@@ -0,0 +1,33 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAOptionsComposer.configureColorfulDataLabelsForPieChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAOptionsComposer.customDoubleXAxesChart
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAOptionsComposer.customizeEveryDataLabelSinglelyByDataLabelsFormatter
import com.github.aachartmodel.aainfographics.demo.chartcomposer.JSFunctionForAAOptionsComposer.disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction
class JSFunctionForAAOptionsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_custom_tooltip_with_jsfunction)
val intent = intent
val chartType = intent.getStringExtra("chartType")
val aaOptions: AAOptions = chartConfigurationWithSelectedIndex(chartType)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartOptions(aaOptions)
}
fun chartConfigurationWithSelectedIndex(chartType: String?): AAOptions {
return when (chartType) {
"customDoubleXAxesChart" -> customDoubleXAxesChart() //自定义双 X 轴图表
"disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction" -> disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction() //禁用柱状图图表的选中状态
"customizeEveryDataLabelSinglelyByDataLabelsFormatter" -> customizeEveryDataLabelSinglelyByDataLabelsFormatter() //自定义每个数据点的数据标签内容
"configureColorfulDataLabelsForPieChart" -> configureColorfulDataLabelsForPieChart() //为饼图图表配置多彩的数据标签
else -> customDoubleXAxesChart()
}
}
}
@@ -0,0 +1,164 @@
/**
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore ◉◉◉
* ◉◉◉ https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ◉◉◉................................................... ◉◉◉
* ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import android.os.Handler
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aachartcreator.AAOptions
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
import com.github.aachartmodel.aainfographics.demo.R
import kotlin.math.cos
import kotlin.math.sin
class OnlyRefreshChartDataActivity : AppCompatActivity() {
private var aaChartModel = AAChartModel()
private var aaChartView: AAChartView? = null
private var updateTimes: Int = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_only_refresh_chart_data)
setUpAAChartView()
repeatUpdateChartData()
}
fun setUpAAChartView() {
aaChartView = findViewById(R.id.AAChartView)
aaChartModel = configureAAChartModel()
val aaOptions: AAOptions = aaChartModel.aa_toAAOptions()
if (aaChartModel.chartType == AAChartType.Column) {
aaOptions.plotOptions?.column!!
.groupPadding(0f)
.pointPadding(0f)
.borderRadius(5f)
} else if (aaChartModel.chartType == AAChartType.Bar) {
aaOptions.plotOptions?.bar!!
.groupPadding(0f)
.pointPadding(0f)
.borderRadius(5f)
}
aaChartView?.aa_drawChartWithChartOptions(aaOptions)
}
private fun configureAAChartModel(): AAChartModel {
val aaChartModel = configureChartBasicContent()
aaChartModel.series(this.configureChartSeriesArray() as Array<Any>)
return aaChartModel
}
private fun configureChartBasicContent(): AAChartModel {
val intent = intent
val chartType = intent.getStringExtra("chartType")
return AAChartModel.Builder(this)
.setChartType(convertStringToEnum(chartType!!))
.setXAxisVisible(true)
.setYAxisVisible(false)
.setTitle("")
.setYAxisTitle("摄氏度")
.setColorsTheme(arrayOf(
AAGradientColor.Sanguine,
AAGradientColor.DeepSea,
AAGradientColor.NeonGlow,
AAGradientColor.WroughtIron
))
.setStacking(AAChartStackingType.Normal)
.build()
}
private fun convertStringToEnum(chartTypeStr: String): AAChartType {
var chartTypeEnum = AAChartType.Column
when (chartTypeStr) {
AAChartType.Column.value -> chartTypeEnum = AAChartType.Column
AAChartType.Bar.value -> chartTypeEnum = AAChartType.Bar
AAChartType.Area.value -> chartTypeEnum = AAChartType.Area
AAChartType.Areaspline.value -> chartTypeEnum = AAChartType.Areaspline
AAChartType.Line.value -> chartTypeEnum = AAChartType.Line
AAChartType.Spline.value -> chartTypeEnum = AAChartType.Spline
AAChartType.Scatter.value -> chartTypeEnum = AAChartType.Scatter
}
return chartTypeEnum
}
@Suppress("UNCHECKED_CAST")
private fun configureChartSeriesArray(): Array<AASeriesElement> {
val maxRange = 40
val numberArr1 = arrayOfNulls<Any>(maxRange)
val numberArr2 = arrayOfNulls<Any>(maxRange)
var y1: Double
var y2: Double
val max = 38
val min = 1
val random = (Math.random() * (max - min) + min).toInt()
for (i in 0 until maxRange) {
y1 = sin(random * (i * Math.PI / 180)) + i * 2 * 0.01
y2 = cos(random * (i * Math.PI / 180)) + i * 3 * 0.01
numberArr1[i] = y1
numberArr2[i] = y2
}
return arrayOf(
AASeriesElement()
.name("2017")
.data(numberArr1 as Array<Any>),
AASeriesElement()
.name("2018")
.data(numberArr2 as Array<Any>),
AASeriesElement()
.name("2019")
.data(numberArr1 as Array<Any>),
AASeriesElement()
.name("2020")
.data(numberArr2 as Array<Any>)
)
}
private fun repeatUpdateChartData() {
val mStartVideoHandler = Handler()
val mStartVideoRunnable: Runnable = object : Runnable {
override fun run() {
val seriesArr = configureChartSeriesArray()
aaChartView!!.aa_onlyRefreshTheChartDataWithChartOptionsSeriesArray(seriesArr)
mStartVideoHandler.postDelayed(this, 1000)
updateTimes += 1
print("图表数据正在刷新,刷新次数为:$updateTimes")
}
}
mStartVideoHandler.postDelayed(mStartVideoRunnable, 2000)
}
}
@@ -0,0 +1,259 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aaoptionsmodel.*
import com.github.aachartmodel.aainfographics.aatools.AAJSStringPurer
import com.github.aachartmodel.aainfographics.demo.R
import kotlin.math.sin
class ScrollableChartActivity : AppCompatActivity() {
private var aaChartView1: AAChartView? = null
private var aaChartModel: AAChartModel? = null
private var aaOptions: AAOptions? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_scollable_chart)
aaChartView1 = findViewById(R.id.AAChartView1)
val aaChartModel: AAChartModel = configureChartModel()
if (aaOptions == null) {
aaOptions = aaChartModel.aa_toAAOptions()
}
aaChartView1?.aa_drawChartWithChartOptions(aaOptions!!)
}
private fun configureChartModel(): AAChartModel {
val chartType = intent.getStringExtra("chartType").toString()
val position = intent.getIntExtra("position", 0)
val chartTypeEnum = convertStringToEnum(chartType)
val seriesDataArray = configureSeriesDataArray() as Array<Any>
val aaChartModel = AAChartModel.Builder(this)
.setChartType(chartTypeEnum)
.setTitle("")
.setYAxisTitle("")
.setLegendEnabled(false)
.setYAxisGridLineWidth(0f)
.setScrollablePlotArea(
AAScrollablePlotArea()
.minWidth(3000)
.scrollPositionX(1f))
.setSeries(
AASeriesElement()
.name("Tokyo")
.data(seriesDataArray)
)
.build()
this.aaChartModel = aaChartModel
configureTheStyleForDifferentTypeChart(chartTypeEnum, position)
return aaChartModel
}
private fun convertStringToEnum(chartTypeStr: String): AAChartType {
var chartTypeEnum = AAChartType.Column
when (chartTypeStr) {
AAChartType.Column.value -> chartTypeEnum = AAChartType.Column
AAChartType.Bar.value -> chartTypeEnum = AAChartType.Bar
AAChartType.Area.value -> chartTypeEnum = AAChartType.Area
AAChartType.Areaspline.value -> chartTypeEnum = AAChartType.Areaspline
AAChartType.Line.value -> chartTypeEnum = AAChartType.Line
AAChartType.Spline.value -> chartTypeEnum = AAChartType.Spline
}
return chartTypeEnum
}
fun configureTheStyleForDifferentTypeChart(
chartType: AAChartType,
position: Int
) {
if ((chartType == AAChartType.Area || chartType == AAChartType.Line)
&& (position == 4 || position == 5)
) {
configureStepAreaChartAndStepLineChart()
} else if (chartType == AAChartType.Column || chartType == AAChartType.Bar) {
configureColumnChartAndBarChartStyle()
} else if (chartType == AAChartType.Area || chartType == AAChartType.Areaspline) {
configureAreaChartAndAreasplineChartStyle(chartType)
} else if (chartType == AAChartType.Line || chartType == AAChartType.Spline) {
configureLineChartAndSplineChartStyle(chartType)
}
}
private fun configureStepAreaChartAndStepLineChart() {
val element1 = AASeriesElement()
.name("Tokyo")
.step(true)
.data(arrayOf(149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4))
val element2 = AASeriesElement()
.name("NewYork")
.step(true)
.data(arrayOf(83.6, 78.8, 188.5, 93.4, 106.0, 84.5, 105.0, 104.3, 131.2, 153.5, 226.6, 192.3))
val element3 = AASeriesElement()
.name("London")
.step(true)
.data(arrayOf(48.9, 38.8, 19.3, 41.4, 47.0, 28.3, 59.0, 69.6, 52.4, 65.2, 53.3, 72.2))
aaChartModel?.series(arrayOf(element1, element2, element3))
}
private fun configureColumnChartAndBarChartStyle() {
if (aaChartModel?.chartType == AAChartType.Bar) {
val pureJSStr: String = AAJSStringPurer.pureJavaScriptFunctionString(
"Source: <a href=\"https://highcharts.uservoice.com/forums/55896-highcharts-javascript-api\">UserVoice</a>"
)
val element: AASeriesElement = AASeriesElement()
.data(arrayOf(
arrayOf("Gantt chart", 1000),
arrayOf("Autocalculation and plotting of trend lines", 575),
arrayOf("Allow navigator to have multiple data series", 523),
arrayOf("Implement dynamic font size", 427),
arrayOf("Multiple axis alignment control", 399),
arrayOf("Stacked area (spline etc) in irregular datetime series", 309),
arrayOf("Adapt chart height to legend height", 278),
arrayOf("Export charts in excel sheet", 239),
arrayOf("Toggle legend box", 235),
arrayOf("Venn Diagram", 203),
arrayOf("Add ability to change Rangeselector position", 182),
arrayOf("Draggable legend box", 157),
arrayOf("Sankey Diagram", 149),
arrayOf("Add Navigation bar for Y-Axis in Highstock", 144),
arrayOf("Grouped x-axis", 143),
arrayOf("ReactJS plugin", 137),
arrayOf("3D surface charts", 134),
arrayOf("Draw lines over a stock chart, for analysis purpose", 118),
arrayOf("Data module for database tables", 118),
arrayOf("Draggable points", 117)
))
val aaOptions: AAOptions = AAOptions()
.chart(AAChart()
.type(AAChartType.Bar)
.scrollablePlotArea(
AAScrollablePlotArea()
.minHeight(900)
))
.title(AATitle()
.text("Most popular ideas by April 2016"))
.subtitle(AASubtitle()
.text(pureJSStr))
.xAxis(AAXAxis()
.type(AAChartAxisType.Category))
.series(arrayOf(element))
this.aaOptions = aaOptions
} else {
aaChartModel!!
.categories(arrayOf(
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
))
.legendEnabled(true)
.colorsTheme(arrayOf("#fe117c", "#ffc069", "#06caf4", "#7dffc0"))
.animationType(AAChartAnimationType.EaseOutCubic)
.animationDuration(1200)
}
}
private fun configureAreaChartAndAreasplineChartStyle(chartType: AAChartType) {
aaChartModel!!
.animationType(AAChartAnimationType.EaseOutQuart)
.legendEnabled(true)
.markerRadius(5f)
.markerSymbol(AAChartSymbolType.Circle)
.markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
if (chartType == AAChartType.Areaspline) {
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))
aaChartModel!!
.animationType(AAChartAnimationType.EaseFrom) //设置图表渲染动画类型为 EaseFrom
.series(arrayOf(element1, element2, element3, element4))
}
}
private fun configureLineChartAndSplineChartStyle(chartType: AAChartType) {
aaChartModel!!
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank) //设置折线连接点样式为:边缘白色
.markerRadius(6f)
if (chartType == AAChartType.Line) {
val element1 = AASeriesElement()
.name("Hestavollane")
.data(arrayOf(
0.2, 0.8, 0.8, 0.8, 1, 1.3, 1.5, 2.9, 1.9, 2.6, 1.6, 3, 4, 3.6,
5.5, 6.2, 5.5, 4.5, 4, 3.1, 2.7, 4, 2.7, 2.3, 2.3, 4.1, 7.7, 7.1,
5.6, 6.1, 5.8, 8.6, 7.2, 9, 10.9, 11.5, 11.6, 11.1, 12, 12.3, 10.7,
9.4, 9.8, 9.6, 9.8, 9.5, 8.5, 7.4, 7.6
))
val element2 = AASeriesElement()
.name("Vik")
.data(arrayOf(
0, 0, 0.6, 0.9, 0.8, 0.2, 0, 0, 0, 0.1, 0.6, 0.7, 0.8, 0.6, 0.2,
0, 0.1, 0.3, 0.3, 0, 0.1, 0, 0, 0, 0.2, 0.1, 0, 0.3, 0, 0.1, 0.2,
0.1, 0.3, 0.3, 0, 3.1, 3.1, 2.5, 1.5, 1.9, 2.1, 1, 2.3, 1.9, 1.2,
0.7, 1.3, 0.4, 0.3
))
aaChartModel!!
.series(arrayOf(element1, element2))
} else if (chartType == AAChartType.Spline) {
val element1 = AASeriesElement()
.name("Tokyo")
.lineWidth(7f)
.data(arrayOf(50, 320, 230, 370, 230, 400))
val element2 = AASeriesElement()
.name("Berlin")
.lineWidth(7f)
.data(arrayOf(80, 390, 210, 340, 240, 350))
val element3 = AASeriesElement()
.name("New York")
.lineWidth(7f)
.data(arrayOf(100, 370, 180, 280, 260, 300))
val element4 = AASeriesElement()
.name("London")
.lineWidth(7f)
.data(arrayOf(130, 350, 160, 310, 250, 268))
aaChartModel!!
.animationType(AAChartAnimationType.SwingFromTo)
.series(arrayOf(element1, element2, element3, element4))
}
}
private fun configureSeriesDataArray(): Array<AADataElement?> {
val maxRange = 388
val numberArr1 = arrayOfNulls<AADataElement>(maxRange)
var y1: Double
val max = 38
val min = 1
val random = (Math.random() * (max - min) + min).toInt()
for (i in 0 until maxRange) {
y1 = sin(random * (i * Math.PI / 180)) + i * 2 * 0.01
val aaDataElement: AADataElement = AADataElement()
.y(y1.toFloat())
numberArr1[i] = aaDataElement
}
return numberArr1
}
}
@@ -0,0 +1,14 @@
package com.github.aachartmodel.aainfographics.demo.additionalcontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.demo.R
class ScrollingUpdateDataActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_scrolling_update_data)
}
}
@@ -0,0 +1,313 @@
/**
* ...... SOURCE CODE ......
* ...................................................
* https://github.com/AAChartModel/AAChartCore ◉◉◉
* https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ...................................................
* ...... SOURCE CODE ......
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 WARM TIPS!!! 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.basiccontent
import android.os.Bundle
import android.view.View
import android.widget.CompoundButton
import android.widget.RadioGroup
import android.widget.Switch
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
import com.github.aachartmodel.aainfographics.aatools.AALinearGradientDirection
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.BasicChartComposer
import com.google.gson.Gson
open class BasicChartActivity : AppCompatActivity(), RadioGroup.OnCheckedChangeListener,
CompoundButton.OnCheckedChangeListener, AAChartView.AAChartViewCallBack {
var aaChartModel = AAChartModel()
var aaChartView: AAChartView? = null
var chartType: String = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_basic_chart)
setUpAAChartView()
setUpRadioButtonsAndSwitches()
}
private fun setUpAAChartView() {
aaChartView = findViewById(R.id.AAChartView)
aaChartView?.setBackgroundColor(0)
aaChartView?.callBack = this
aaChartModel = configureAAChartModel()
aaChartView?.aa_drawChartWithChartModel(aaChartModel)
}
private fun configureAAChartModel(): AAChartModel {
val intent = intent
chartType = intent.getStringExtra("chartType").toString()
val position = intent.getIntExtra("position", 0)
aaChartModel = BasicChartComposer.configureAreaChart()
val chartTypeEnum = convertStringToEnum(chartType)
aaChartModel.chartType(chartTypeEnum)
configureTheStyleForDifferentTypeChart(chartType,position)
configureViewsVisibility(chartType)
return aaChartModel
}
private fun configureTheStyleForDifferentTypeChart(chartType: String, position: Int) {
if ((chartType == AAChartType.Area.value || chartType == AAChartType.Line.value)
&& (position == 4 || position == 5)) {
configureStepAreaChartAndStepLineChartStyle()
} else if (chartType == AAChartType.Column.value || chartType == AAChartType.Bar.value) {
configureColumnChartAndBarChartStyle()
} else if (chartType == AAChartType.Area.value || chartType == AAChartType.Areaspline.value) {
configureAreaChartAndAreasplineChartStyle(chartType)
} else if (chartType == AAChartType.Line.value || chartType == AAChartType.Spline.value) {
configureLineChartAndSplineChartStyle(chartType)
}
}
private fun configureViewsVisibility(chartType: String) {
val squareCornersRadio: RadioGroup = findViewById(R.id.cornerStyleTypeRadioGroup)
val markerSymbolTypeRadioGroup: RadioGroup = findViewById(R.id.markerSymbolTypeRadioGroup)
if (chartType == AAChartType.Column.value || chartType == AAChartType.Bar.value) {
squareCornersRadio.visibility = View.VISIBLE
markerSymbolTypeRadioGroup.visibility = View.GONE
val markerHideSwitch: Switch = findViewById(R.id.markerHideSwitch)
markerHideSwitch.visibility = View.GONE
val markerHideTextView: TextView = findViewById(R.id.markerHideTextView)
markerHideTextView.visibility = View.GONE
} else {
squareCornersRadio.visibility = View.GONE
markerSymbolTypeRadioGroup.visibility = View.VISIBLE
}
}
private fun configureStepAreaChartAndStepLineChartStyle() {
val element1 = AASeriesElement()
.name("Tokyo")
.step(true)
.data(arrayOf(149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4))
val element2 = AASeriesElement()
.name("NewYork")
.step(true)
.data(arrayOf(83.6, 78.8, 188.5, 93.4, 106.0, 84.5, 105.0, 104.3, 131.2, 153.5, 226.6, 192.3))
val element3 = AASeriesElement()
.name("London")
.step(true)
.data(arrayOf(48.9, 38.8, 19.3, 41.4, 47.0, 28.3, 59.0, 69.6, 52.4, 65.2, 53.3, 72.2))
aaChartModel.series(arrayOf(element1, element2, element3))
}
private fun configureColumnChartAndBarChartStyle() {
aaChartModel
.categories(arrayOf("Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Spe", "Oct", "Nov", "Dec"))
.colorsTheme(arrayOf("#fe117c", "#ffc069", "#06caf4", "#7dffc0"))
.animationType(AAChartAnimationType.EaseInCubic)
.animationDuration(1200)
}
private fun configureAreaChartAndAreasplineChartStyle(chartType:String) {
aaChartModel
.animationType(AAChartAnimationType.EaseOutQuart)
.markerRadius(5f)
.markerSymbol(AAChartSymbolType.Circle)
.markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
if (chartType == AAChartType.Areaspline.value) {
val gradientColorDic = AAGradientColor.linearGradient(
AALinearGradientDirection.ToBottomRight,
"rgba(138,43,226,1)",
"rgba(30,144,255,1)" //颜色字符串设置支持十六进制类型和 rgba 类型
)
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))
aaChartModel
.animationType(AAChartAnimationType.EaseFrom)//设置图表渲染动画类型为 EaseFrom
.series(arrayOf(element1, element2, element3, element4))
}
}
private fun configureLineChartAndSplineChartStyle(chartType: String) {
aaChartModel
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//设置折线连接点样式为:边缘白色
.markerRadius(6f)
if (chartType == AAChartType.Spline.value) {
val element1 = AASeriesElement()
.name("Tokyo")
.lineWidth(7f)
.data(arrayOf(50, 320, 230, 370, 230, 400))
val element2 = AASeriesElement()
.name("Berlin")
.lineWidth(7f)
.data(arrayOf(80, 390, 210, 340, 240, 350))
val element3 = AASeriesElement()
.name("New York")
.lineWidth(7f)
.data(arrayOf(100, 370, 180, 280, 260, 300))
val element4 = AASeriesElement()
.name("London")
.lineWidth(7f)
.data(arrayOf(130, 350, 160, 310, 250, 268))
aaChartModel
.animationType(AAChartAnimationType.SwingFromTo)
.series(arrayOf(element1, element2, element3, element4))
}
}
private fun convertStringToEnum(chartTypeStr: String): AAChartType {
var chartTypeEnum = AAChartType.Column
when (chartTypeStr) {
AAChartType.Column.value -> chartTypeEnum = AAChartType.Column
AAChartType.Bar.value -> chartTypeEnum = AAChartType.Bar
AAChartType.Area.value -> chartTypeEnum = AAChartType.Area
AAChartType.Areaspline.value -> chartTypeEnum = AAChartType.Areaspline
AAChartType.Line.value -> chartTypeEnum = AAChartType.Line
AAChartType.Spline.value -> chartTypeEnum = AAChartType.Spline
}
return chartTypeEnum
}
private fun setUpRadioButtonsAndSwitches() {
val stackingTypeRadioGroup = findViewById<RadioGroup>(R.id.stackingTypeRadioGroup)
stackingTypeRadioGroup.setOnCheckedChangeListener(this)
val cornerStyleTypeRadioGroup = findViewById<RadioGroup>(R.id.cornerStyleTypeRadioGroup)
cornerStyleTypeRadioGroup.setOnCheckedChangeListener(this)
val markerSymbolTypeRadioGroup: RadioGroup = findViewById(R.id.markerSymbolTypeRadioGroup)
markerSymbolTypeRadioGroup.setOnCheckedChangeListener(this)
val boolSwitch1: Switch = findViewById(R.id.xReversedSwitch)
boolSwitch1.setOnCheckedChangeListener(this)
val boolSwitch2: Switch = findViewById(R.id.yReversedSwitch)
boolSwitch2.setOnCheckedChangeListener(this)
val boolSwitch3: Switch = findViewById(R.id.polarSwitch)
boolSwitch3.setOnCheckedChangeListener(this)
val boolSwitch4: Switch = findViewById(R.id.xInvertedSwitch)
boolSwitch4.setOnCheckedChangeListener(this)
val boolSwitch5: Switch = findViewById(R.id.dataShowSwitch)
boolSwitch5.setOnCheckedChangeListener(this)
val boolSwitch6: Switch = findViewById(R.id.markerHideSwitch)
boolSwitch6.setOnCheckedChangeListener(this)
}
/**
* 重写的状态改变的事件的方法
* @param group 单选组合框
* @param checkedId 其中的每个RadioButton的Id
*/
override fun onCheckedChanged(group: RadioGroup, checkedId: Int) {
if (group.id == R.id.stackingTypeRadioGroup) {
when (group.checkedRadioButtonId) {
R.id.noStackingRadio -> aaChartModel.stacking(AAChartStackingType.False)
R.id.normalStackingRadio -> aaChartModel.stacking(AAChartStackingType.Normal)
R.id.percentStackingRadio -> aaChartModel.stacking(AAChartStackingType.Percent)
}
} else {
if (aaChartModel.chartType == AAChartType.Bar
|| aaChartModel.chartType == AAChartType.Column
) {
when (group.checkedRadioButtonId) {
R.id.squareCornersRadio -> aaChartModel.borderRadius(1f)
R.id.roundedCornersRadio -> aaChartModel.borderRadius(10f)
R.id.wedgeCornersRadio -> aaChartModel.borderRadius(1000f)
}
} else {
when (group.checkedRadioButtonId) {
R.id.circleSymbolRadio -> aaChartModel.markerSymbol(AAChartSymbolType.Circle)
R.id.squareSymbolRadio -> aaChartModel.markerSymbol(AAChartSymbolType.Square)
R.id.diamondSymbolRadio -> aaChartModel.markerSymbol(AAChartSymbolType.Diamond)
R.id.triangleSymbolRadio -> aaChartModel.markerSymbol(AAChartSymbolType.Triangle)
R.id.triangleDownSymbolRadio -> aaChartModel.markerSymbol(AAChartSymbolType.TriangleDown)
}
}
}
aaChartView?.aa_refreshChartWithChartModel(aaChartModel)
}
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
when (buttonView.id) {
R.id.xReversedSwitch -> aaChartModel.xAxisReversed(isChecked)
R.id.yReversedSwitch -> aaChartModel.yAxisReversed(isChecked)
R.id.xInvertedSwitch -> aaChartModel.inverted(isChecked)
R.id.polarSwitch -> aaChartModel.polar(isChecked)
R.id.dataShowSwitch -> aaChartModel.dataLabelsEnabled(isChecked)
R.id.markerHideSwitch -> aaChartModel.markerRadius(if (isChecked) 0f else 6f)
}
aaChartView?.aa_refreshChartWithChartModel(aaChartModel)
}
override fun chartViewDidFinishLoad(aaChartView: AAChartView) {
println("🔥图表加载完成回调方法 ")
}
override fun chartViewMoveOverEventMessage(
aaChartView: AAChartView,
messageModel: AAMoveOverEventMessageModel
) {
val gson = Gson()
println("🚀move over event message " + gson.toJson(messageModel))
}
}
@@ -0,0 +1,143 @@
/**
* ...... SOURCE CODE ......
* ...................................................
* https://github.com/AAChartModel/AAChartCore ◉◉◉
* https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ...................................................
* ...... SOURCE CODE ......
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 WARM TIPS!!! 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.basiccontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.CustomStyleChartComposer
class CustomStyleChartActivity : AppCompatActivity() {
private var aaChartModel: AAChartModel? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_custom_style_chart)
val intent = intent
val chartType = intent.getStringExtra("chartType")
aaChartModel = configureTheAAChartModel(chartType!!)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartModel(aaChartModel!!)
}
private fun configureTheAAChartModel(chartType: String): AAChartModel {
when (chartType) {
"colorfulChart" ->
return CustomStyleChartComposer.configureColorfulChart()
"gradientColorfulChart" ->
return CustomStyleChartComposer.configureColorfulGradientColorChart()
"discontinuousDataChart" ->
return CustomStyleChartComposer.configureDiscontinuousDataChart()
"colorfulColumnChart" ->
return CustomStyleChartComposer.configureColorfulColumnChart()
"nightingaleRoseChart" ->
return CustomStyleChartComposer.configureNightingaleRoseChart()
"chartWithShadowStyle" ->
return CustomStyleChartComposer.configureChartWithShadowStyle()
"colorfulGradientAreaChart" ->
return CustomStyleChartComposer.configureColorfulGradientAreaChart()
"colorfulGradientSplineChart" ->
return CustomStyleChartComposer.configureColorfulGradientSplineChart()
"gradientColorAreasplineChart" ->
return CustomStyleChartComposer.configureGradientColorAreasplineChart()
"SpecialStyleMarkerOfSingleDataElementChart" ->
return CustomStyleChartComposer.configureSpecialStyleMarkerOfSingleDataElementChart()
"SpecialStyleColumnOfSingleDataElementChart" ->
return CustomStyleChartComposer.configureSpecialStyleColumnOfSingleDataElementChart()
"AreaChartThreshold" ->
return CustomStyleChartComposer.configureAreaChartThreshold()
"customScatterChartMarkerSymbolContent" ->
return CustomStyleChartComposer.customScatterChartMarkerSymbolContent()
"customLineChartMarkerSymbolContent" ->
return CustomStyleChartComposer.customLineChartMarkerSymbolContent()
"TriangleRadarChart" ->
return CustomStyleChartComposer.configureTriangleRadarChart()
"QuadrangleRadarChart" ->
return CustomStyleChartComposer.configureQuadrangleRadarChart()
"PentagonRadarChart" ->
return CustomStyleChartComposer.configurePentagonRadarChart()
"HexagonRadarChart" ->
return CustomStyleChartComposer.configureHexagonRadarChart()
"adjustYAxisMaxAndMinValues"-> return CustomStyleChartComposer.adjustYAxisMaxAndMinValues()
"customSpecialStyleDataLabelOfSingleDataElementChart"-> return CustomStyleChartComposer.customSpecialStyleDataLabelOfSingleDataElementChart()
"customBarChartHoverColorAndSelectColor"-> return CustomStyleChartComposer.customBarChartHoverColorAndSelectColor()
"customChartHoverAndSelectHaloStyle"-> return CustomStyleChartComposer.customChartHoverAndSelectHaloStyle()
"customSplineChartMarkerStatesHoverStyle"-> return CustomStyleChartComposer.customSplineChartMarkerStatesHoverStyle()
"splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle" -> return CustomStyleChartComposer.splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle()
"customNormalStackingChartDataLabelsContentAndStyle"-> return CustomStyleChartComposer.customNormalStackingChartDataLabelsContentAndStyle()
"upsideDownPyramidChart"-> return CustomStyleChartComposer.upsideDownPyramidChart()
"doubleLayerPieChart"-> return CustomStyleChartComposer.doubleLayerPieChart()
"disableSomeOfLinesMouseTrackingEffect"-> return CustomStyleChartComposer.disableSomeOfLinesMouseTrackingEffect()
"configureColorfulShadowSplineChart"-> return CustomStyleChartComposer.configureColorfulShadowSplineChart()
"configureColorfulDataLabelsStepLineChart"-> return CustomStyleChartComposer.configureColorfulDataLabelsStepLineChart()
"configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart"-> return CustomStyleChartComposer.configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart()
"disableSplineChartMarkerHoverEffect"-> return CustomStyleChartComposer.disableSplineChartMarkerHoverEffect()
"configureMaxAndMinDataLabelsForChart"-> return CustomStyleChartComposer.configureMaxAndMinDataLabelsForChart()
"customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag"-> return CustomStyleChartComposer.customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag()
"noMoreGroupingAndOverlapEachOtherColumnChart" ->
return CustomStyleChartComposer.noMoreGroupingAndOverlapEachOtherColumnChart()
"noMoreGroupingAndNestedColumnChart" ->
return CustomStyleChartComposer.noMoreGroupingAndNestedColumnChart()
"topRoundedCornersStackingColumnChart" ->
return CustomStyleChartComposer.topRoundedCornersStackingColumnChart()
"freeStyleRoundedCornersStackingColumnChart" ->
return CustomStyleChartComposer.freeStyleRoundedCornersStackingColumnChart()
"customColumnChartBorderStyleAndStatesHoverColor" ->
return CustomStyleChartComposer.customColumnChartBorderStyleAndStatesHoverColor()
"customLineChartWithColorfulMarkersAndLines" ->
return CustomStyleChartComposer.customLineChartWithColorfulMarkersAndLines()
"customLineChartWithColorfulMarkersAndLines2" ->
return CustomStyleChartComposer.customLineChartWithColorfulMarkersAndLines2()
"drawLineChartWithPointsCoordinates" ->
return CustomStyleChartComposer.drawLineChartWithPointsCoordinates()
"configureSpecialStyleColumnForNegativeDataMixedPositiveData" ->
return CustomStyleChartComposer.configureSpecialStyleColumnForNegativeDataMixedPositiveData()
"configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart" ->
return CustomStyleChartComposer.configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart()
"connectNullsForSingleAASeriesElement" ->
return CustomStyleChartComposer.connectNullsForSingleAASeriesElement()
"lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement" ->
return CustomStyleChartComposer.lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement()
"customAreasplineChartWithColorfulGradientColorZones" ->
return CustomStyleChartComposer.customAreasplineChartWithColorfulGradientColorZones()
}
return CustomStyleChartComposer.configureColorfulChart()
}
}
@@ -0,0 +1,615 @@
package com.github.aachartmodel.aainfographics.demo.basiccontent
import android.content.Intent
import android.os.Bundle
import android.widget.ExpandableListView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartType
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.additionalcontent.*
class MainActivity : AppCompatActivity() {
private val chartTypeNameArr =
arrayOf(
arrayOf(
"Column Chart---柱形图",
"Bar Chart---条形图",
"Area Chart---折线填充图",
"Areaspline Chart---曲线填充图",
"Step Area Chart---直方折线填充图",
"Step Line Chart---直方折线图",
"Line Chart---折线图",
"Spline Chart---曲线图"
), arrayOf(
"Polar Column Chart---玫瑰图",
"Polar Bar Chart---径向条形图",
"Polar Line Chart---蜘蛛图",
"Polar Area Chart---雷达图",
"Step Line Chart---直方折线图",
"Step Area Chart---直方折线填充图",
"Pie Chart---扇形图",
"Bubble Chart---气泡图",
"Scatter Chart---散点图",
"Arearange Chart---区域范围图",
"Columnrange Chart---柱形范围图",
"Boxplot Chart---箱线图",
"Waterfall Chart---瀑布图",
"Pyramid Chart---金字塔图",
"Funnel Chart---漏斗图",
"Errorbar Chart---误差图",
"Gauge Chart---仪表图",
"Polygon Chart---多边形图"
), arrayOf(
"arearangeMixedLine",
"columnrangeMixedLine",
"stackingColumnMixedLine",
"dashStyleTypeMixed",
"negativeColorMixed",
"scatterMixedLine",
"negativeColorMixedBubble",
"polygonMixedScatter",
"polarChartMixed",
"configurePieMixedLineMixedColumnChart",
"configureNegativeColorMixedAreasplineChart",
), arrayOf(
"colorfulChart",
"gradientColorfulChart",
"discontinuousDataChart",
"colorfulColumnChart",
"nightingaleRoseChart",
"chartWithShadowStyle",
"colorfulGradientAreaChart",
"colorfulGradientSplineChart",
"gradientColorAreasplineChart",
"SpecialStyleMarkerOfSingleDataElementChart",
"SpecialStyleColumnOfSingleDataElementChart",
"AreaChartThreshold",
"customScatterChartMarkerSymbolContent",
"customLineChartMarkerSymbolContent",
"TriangleRadarChart",
"QuadrangleRadarChart",
"PentagonRadarChart",
"HexagonRadarChart",
"adjustYAxisMaxAndMinValues---调整 X 轴和 Y 轴最大值",
"custom Special Style DataLabel Of Single Data Element Chart---指定单个数据元素的 DataLabel 为特殊样式",
"custom Bar Chart Hover Color and Select Color---自定义条形图手指滑动颜色和单个长条被选中颜色",
"custom Line Chart Chart Hover And Select Halo Style---自定义直线图手指略过和选中的 Halo 样式",
"custom Spline Chart Marker States Hover Style---自定义曲线图手指略过时的 Marker 样式",
"splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle---曲线图手指掠过时的 Hover 线不变形,并且自定义 Marker 样式",
"customNormalStackingChartDataLabelsContentAndStyle---自定义堆积柱状图 DataLabels 的内容及样式",
"upsideDownPyramidChart---倒立的金字塔图",
"doubleLayerPieChart---双层嵌套扇形图",
"disableSomeOfLinesMouseTrackingEffect---针对部分数据列关闭鼠标或手指跟踪行为",
"configureColorfulShadowChart---彩色阴影效果的曲线图",
"configureColorfulDataLabelsStepLineChart---彩色 DataLabels 的直方折线图",
"configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart---彩色渐变效果且彩色 DataLabels 的直方折线填充图",
"disableSplineChartMarkerHoverEffect---禁用曲线图的手指滑动 marker 点的光圈变化放大的效果",
"configureMaxAndMinDataLabelsForChart---为图表最大值最小值添加 DataLabels 标记",
"customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag---通过 HTML 的换行标签来实现图表的 X 轴的 分类文字标签的换行效果",
"noMoreGroupingAndOverlapEachOtherColumnChart---不分组的相互重叠柱状图📊",
"noMoreGroupingAndNestedColumnChart---不分组的嵌套柱状图📊",
"topRoundedCornersStackingColumnChart---顶部为圆角的堆积柱状图📊",
"freeStyleRoundedCornersStackingColumnChart---各个圆角自由独立设置的堆积柱状图📊",
"customColumnChartBorderStyleAndStatesHoverColor---自定义柱状图 border 样式及手指掠过图表 series 元素时的柱形颜色",
"customLineChartWithColorfulMarkersAndLines---彩色连接点和连接线的折线图📈",
"customLineChartWithColorfulMarkersAndLines2---彩色连接点和连接线的多组折线的折线图📈",
"drawLineChartWithPointsCoordinates---通过点坐标来绘制折线图",
"configureSpecialStyleColumnForNegativeDataMixedPositiveData---为正负数混合的柱形图自定义特殊样式效果",
"configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart---多层次半透明渐变效果的曲线填充图混合折线图📈",
"connectNullsForSingleAASeriesElement---为单个 AASeriesElement 单独设置是否断点重连",
"lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement---不同数据列数据量差异较大的折线图",
"customAreasplineChartWithColorfulGradientColorZones---彩色渐变填充区域曲线图",
), arrayOf(
"customLegendStyle",
"drawChartWithOptionsOne",
"AAPlotLinesForChart",
"customAATooltipWithJSFunction",
"customXAxisCrosshairStyle",
"XAxisLabelsFontColorWithHTMLString",
"XAxisLabelsFontColorAndFontSizeWithHTMLString",
"_DataLabels_XAXis_YAxis_Legend_Style",
"XAxisPlotBand",
"configureTheMirrorColumnChart",
"configureDoubleYAxisChartOptions",
"configureTripleYAxesMixedChart",
"customLineChartDataLabelsFormat",
"configureDoubleYAxesAndColumnLineMixedChart",
"configureDoubleYAxesMarketDepthChart",
"customAreaChartTooltipStyleLikeHTMLTable",
"simpleGaugeChart",
"gaugeChartWithPlotBand",
"doubleLayerHalfPieChart",
), arrayOf(
"Column Chart---柱形图",
"Bar Chart---条形图",
"Area Chart---折线填充图",
"Areaspline Chart---曲线填充图",
"Step Area Chart---直方折线填充图",
"Step Line Chart---直方折线图",
"Line Chart---折线图",
"Spline Chart---曲线图",
"Scatter Chart---散点图"
), arrayOf(
"简单字符串拼接",
"自定义不同单位后缀",
"自定义多彩颜色文字",
"值为0时,在tooltip中不显示",
"自定义箱线图的浮动提示框头部内容",
"自定义Y轴文字",
"自定义Y轴文字2",
"自定义分组堆积柱状图tooltip内容",
"双 X 轴镜像图表",
"customArearangeChartTooltip---自定义折线范围图的tooltip",
"调整折线图的 X 轴左边距",
"通过来自外部的数据源来自定义 tooltip (而非常规的来自图表的 series)"
), arrayOf(
"eval JS function 1",
"eval JS function 2",
"eval JS function 3"
), arrayOf(
"doubleChartsLinkedWork"
), arrayOf(
"Column Chart---柱形图",
"Bar Chart---条形图",
"Area Chart---折线填充图",
"Areaspline Chart---曲线填充图",
"Step Area Chart---直方折线填充图",
"Step Line Chart---直方折线图",
"Line Chart---折线图",
"Spline Chart---曲线图"
), arrayOf(
"Column Chart---柱形图",
"Bar Chart---条形图",
"Area Chart---折线填充图",
"Areaspline Chart---曲线填充图",
"Step Area Chart---直方折线填充图",
"Step Line Chart---直方折线图",
"Line Chart---折线图",
"Spline Chart---曲线图"
),
/*JS Function For AAAXis Labels*/
arrayOf(
"customYAxisLabels---自定义Y轴文字",
"customYAxisLabels2---自定义Y轴文字2",
"customAreaChartXAxisLabelsTextUnitSuffix1---自定义X轴文字单位后缀(通过 formatter 函数)",
"customAreaChartXAxisLabelsTextUnitSuffix2---自定义X轴文字单位后缀(不通过 formatter 函数)",
"configureTheAxesLabelsFormattersOfDoubleYAxesChart---配置双 Y 轴图表的 Y 轴文字标签的 Formatter 函数 示例 1",
"configureTheAxesLabelsFormattersOfDoubleYAxesChart2---配置双 Y 轴图表的 Y 轴文字标签的 Formatter 函数 示例 2",
"configureTheAxesLabelsFormattersOfDoubleYAxesChart3---配置双 Y 轴图表的 Y 轴文字标签的 Formatter 函数 示例 3",
"customColumnChartXAxisLabelsTextByInterceptTheFirstFourCharacters---通过截取前四个字符来自定义 X 轴 labels",
"customSpiderChartStyle---自定义蜘蛛🕷🕸图样式",
"customizeEveryDataLabelSinglelyByDataLabelsFormatter---通过 DataLabels 的 formatter 函数来实现单个数据标签🏷自定义",
"customXAxisLabelsBeImages---自定义 X轴 labels 为一组图片"
),
/*JS Function For AALegend*/
arrayOf(
"disableLegendClickEventForNormalChart---禁用常规图表 legend 点击事件",
"disableLegendClickEventForPieChart---禁用饼图 legend 点击事件",
"customLegendItemClickEvent---自定义图例 legend 的点击事件"
),
/*JS Function For AAChartEvents*/
arrayOf(
"setCrosshairAndTooltipToTheDefaultPositionAfterLoadingChart---图表加载完成后设置 crosshair 和 tooltip 到默认位置",
"generalDrawingChart---普通绘图",
"advancedTimeLineChart---高级时间轴绘图",
"configureBlinkMarkerChart---配置闪烁特效的 marker 图表",
"configureSpecialStyleMarkerOfSingleDataElementChartWithBlinkEffect---配置闪烁特效的 marker 图表2",
"configureScatterChartWithBlinkEffect---配置闪烁特效的散点图",
"automaticallyHideTooltipAfterItIsShown---在浮动提示框显示后自动隐藏",
"dynamicHeightGridLineAreaChart---动态高度的网格线区域填充图",
"customizeYAxisPlotLinesLabelBeSpecialStyle---自定义 Y 轴轴线上面的标签文字特殊样式",
"configureECGStyleChart---配置心电图样式图表",
),
/*JS Function For AAOptions*/
arrayOf(
"customDoubleXAxesChart---自定义双 X 轴图表",
"disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction---通过 Series 的 Point 的选中事件函数来禁用条形图反选效果",
"customizeEveryDataLabelSinglelyByDataLabelsFormatter---通过 formatter 来自定义单个 dataLabels 元素",
"configureColorfulDataLabelsForPieChart---为饼图配置多彩 dataLabels"
),
)
private val chartTypeArr =
arrayOf(
arrayOf( /*基础类型图表*/
AAChartType.Column.value,
AAChartType.Bar.value,
AAChartType.Area.value,
AAChartType.Areaspline.value,
AAChartType.Area.value,
AAChartType.Line.value,
AAChartType.Line.value,
AAChartType.Spline.value
), arrayOf(
/*特殊类型图表*/
AAChartType.Column.value,
AAChartType.Bar.value,
AAChartType.Line.value,
AAChartType.Area.value,
AAChartType.Spline.value,
AAChartType.Areaspline.value,
AAChartType.Pie.value,
AAChartType.Bubble.value,
AAChartType.Scatter.value,
AAChartType.Arearange.value,
AAChartType.Columnrange.value,
AAChartType.Boxplot.value,
AAChartType.Waterfall.value,
AAChartType.Pyramid.value,
AAChartType.Funnel.value,
AAChartType.Errorbar.value,
AAChartType.Gauge.value,
AAChartType.Polygon.value,
), arrayOf(
/*Mixed Chart---混合图*/
"arearangeMixedLine",
"columnrangeMixedLine",
"stackingColumnMixedLine",
"dashStyleTypeMixed",
"negativeColorMixed",
"scatterMixedLine",
"negativeColorMixedBubble",
"polygonMixedScatter",
"polarChartMixed",
"configurePieMixedLineMixedColumnChart",
"configureNegativeColorMixedAreasplineChart",
), arrayOf(
/*自定义样式图表*/
"colorfulChart",
"gradientColorfulChart",
"discontinuousDataChart",
"colorfulColumnChart",
"nightingaleRoseChart",
"chartWithShadowStyle",
"colorfulGradientAreaChart",
"colorfulGradientSplineChart",
"gradientColorAreasplineChart",
"SpecialStyleMarkerOfSingleDataElementChart",
"SpecialStyleColumnOfSingleDataElementChart",
"AreaChartThreshold",
"customScatterChartMarkerSymbolContent",
"customLineChartMarkerSymbolContent",
"TriangleRadarChart",
"QuadrangleRadarChart",
"PentagonRadarChart",
"HexagonRadarChart",
"adjustYAxisMaxAndMinValues",
"customSpecialStyleDataLabelOfSingleDataElementChart",
"customBarChartHoverColorAndSelectColor",
"customChartHoverAndSelectHaloStyle",
"customSplineChartMarkerStatesHoverStyle",
"splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle",
"customNormalStackingChartDataLabelsContentAndStyle",
"upsideDownPyramidChart",
"doubleLayerPieChart",
"disableSomeOfLinesMouseTrackingEffect",
"configureColorfulShadowSplineChart",
"configureColorfulDataLabelsStepLineChart",
"configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart",
"disableSplineChartMarkerHoverEffect",
"configureMaxAndMinDataLabelsForChart",
"customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag",
"noMoreGroupingAndOverlapEachOtherColumnChart",
"noMoreGroupingAndNestedColumnChart",
"topRoundedCornersStackingColumnChart",
"freeStyleRoundedCornersStackingColumnChart",
"customColumnChartBorderStyleAndStatesHoverColor",
"customLineChartWithColorfulMarkersAndLines",
"customLineChartWithColorfulMarkersAndLines2",
"drawLineChartWithPointsCoordinates",
"configureSpecialStyleColumnForNegativeDataMixedPositiveData",
"configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart",
"connectNullsForSingleAASeriesElement",
"lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement",
"customAreasplineChartWithColorfulGradientColorZones",
), arrayOf( /*使用AAOptions绘制图表*/
"customLegendStyle",
"AAPlotBandsForChart",
"AAPlotLinesForChart",
"customAATooltipWithJSFunction",
"customXAxisCrosshairStyle",
"XAxisLabelsFontColorWithHTMLString",
"XAxisLabelsFontColorAndFontSizeWithHTMLString",
"_DataLabels_XAXis_YAxis_Legend_Style",
"XAxisPlotBand",
"configureTheMirrorColumnChart",
"configureDoubleYAxisChartOptions",
"configureTripleYAxesMixedChart",
"customLineChartDataLabelsFormat",
"configureDoubleYAxesAndColumnLineMixedChart",
"configureDoubleYAxesMarketDepthChart",
"customAreaChartTooltipStyleLikeHTMLTable",
"simpleGaugeChart",
"gaugeChartWithPlotBand",
"doubleLayerHalfPieChart"
), arrayOf( /*即时刷新📈📊图表数据*/
AAChartType.Column.value,
AAChartType.Bar.value,
AAChartType.Area.value,
AAChartType.Areaspline.value,
"stepArea",
"stepLine",
AAChartType.Line.value,
AAChartType.Spline.value,
AAChartType.Scatter.value
), arrayOf( /*自定义 formatter 函数*/
"customAreaChartTooltipStyleWithSimpleFormatString",
"customAreaChartTooltipStyleWithDifferentUnitSuffix",
"customAreaChartTooltipStyleWithColorfulHtmlLabels",
"customLineChartTooltipStyleWhenValueBeZeroDoNotShow",
"customBoxplotTooltipContent",
"customYAxisLabels",
"customYAxisLabels2",
"customStackedAndGroupedColumnChartTooltip",
"customDoubleXAxesChart",
"customArearangeChartTooltip",
"customLineChartOriginalPointPositionByConfiguringXAxisFormatterAndTooltipFormatter",
"customTooltipWhichDataSourceComeFromOutSideRatherThanSeries"
), arrayOf( /*执行由 JavaScript 字符串映射转换成的 js function 函数*/
"evalJSFunction1",
"evalJSFunction2",
"evalJSFunction3"
), arrayOf( /*Double Charts Linked Work---双表联动*/
"doubleChartsLinkedWork"
), arrayOf( /*Scrollable Chart---可滚动图表*/
AAChartType.Column.value,
AAChartType.Bar.value,
AAChartType.Area.value,
AAChartType.Areaspline.value,
AAChartType.Area.value,
AAChartType.Line.value,
AAChartType.Line.value,
AAChartType.Spline.value
), arrayOf( /*高级更新*/
AAChartType.Column.value,
AAChartType.Bar.value,
AAChartType.Area.value,
AAChartType.Areaspline.value,
AAChartType.Area.value,
AAChartType.Line.value,
AAChartType.Line.value,
AAChartType.Spline.value
),
arrayOf( /*JS Function For AAAXis Labels*/
"customYAxisLabels",
"customYAxisLabels2",
"customAreaChartXAxisLabelsTextUnitSuffix1",
"customAreaChartXAxisLabelsTextUnitSuffix2",
"configureTheAxesLabelsFormattersOfDoubleYAxesChart",
"configureTheAxesLabelsFormattersOfDoubleYAxesChart2",
"configureTheAxesLabelsFormattersOfDoubleYAxesChart3",
"customColumnChartXAxisLabelsTextByInterceptTheFirstFourCharacters",
"customSpiderChartStyle",
"customizeEveryDataLabelSinglelyByDataLabelsFormatter",
"customXAxisLabelsBeImages"
),
arrayOf( /*JS Function For AALegend*/
"disableLegendClickEventForNormalChart",
"disableLegendClickEventForPieChart",
"customLegendItemClickEvent"
),
arrayOf( /*JS Function For AAChartEvents*/
"setCrosshairAndTooltipToTheDefaultPositionAfterLoadingChart",
"generalDrawingChart",
"advancedTimeLineChart",
"configureBlinkMarkerChart",
"configureSpecialStyleMarkerOfSingleDataElementChartWithBlinkEffect",
"configureScatterChartWithBlinkEffect",
"automaticallyHideTooltipAfterItIsShown",
"dynamicHeightGridLineAreaChart",
"customizeYAxisPlotLinesLabelBeSpecialStyle",
"configureECGStyleChart"
),
arrayOf( /*JS Function For AAOptions*/
"customDoubleXAxesChart",
"disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction",
"customizeEveryDataLabelSinglelyByDataLabelsFormatter",
"configureColorfulDataLabelsForPieChart"
),
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupExpandableListView()
}
private fun setupExpandableListView() {
val groupTitleArr = arrayOf(
"Basic Type Chart ---基础类型图表",
"Special Type Chart ---特殊类型图表",
"Mixed Chart ---混合图形",
"Custom Style Chart---一些自定义风格样式图表",
"Draw Chart With AAOptions---通过Options绘图",
"Only Refresh data ---即时刷新图表数据",
"JS Function For AAOptions ---通过带有 JS 函数的 Options 绘图",
"Evaluate JS String Function---执行js函数",
"Double Charts Linked Work---双表联动",
"Scrollable chart ---可滚动の图表",
"Chart Options Advanced Updating---图表高级更新",
"JS Function For AAAxis Labels | 通过带有 JS 函数的自定义 AAAxis 的文字标签",
"JS Function For AALegend | 通过带有 JS 函数的自定义 AALegend",
"JS Function For AAChartEvents---通过 JSFunction 自定义 AAChartEvents 的事件",
"JS Function For AAOptions---通过 JSFunction 自定义 AAOptions 内容",
)
val listView = findViewById<ExpandableListView>(R.id.exlist_lol)
val myAdapter =
MyBaseExpandableListAdapter(groupTitleArr, chartTypeNameArr, this)
listView.setAdapter(myAdapter)
//为列表设置点击事件
listView.setOnChildClickListener { parent, v, groupPosition, childPosition, id ->
val chartType = chartTypeArr[groupPosition][childPosition] as String
when (groupPosition) {
0 -> goToCommonChartActivity(chartType, childPosition)
1 -> goToSpecialChartActivity(chartType)
2 -> goToMixedChartActivity(chartType)
3 -> goToCustomStyleChartActivity(chartType)
4 -> goToDrawChartWithAAOptionsActivity(chartType)
5 -> goToOnlyRefreshChartDataActivity(chartType)
6 -> goToCustomTooltipWithJSFunctionActivity(chartType)
7 -> goToEvaluateJSStringFunctionActivity(chartType)
8 -> goToDoubleChartsLinkedWorkActivity(chartType)
9 -> goToScrollableChartActivity(chartType, childPosition)
10 -> goToAdvancedUpdatingFeatureActivity(chartType,childPosition)
11 -> goToJSFunctionForAAAxisActivity(chartType,childPosition)
12 -> goToJSFunctionForAALegendActivity(chartType,childPosition)
13 -> goToJSFunctionForAAChartEventsActivity(chartType,childPosition)
14 -> goToJSFunctionForAAOptionsActivity(chartType,childPosition)
}
Toast.makeText(
this@MainActivity,
"你点击了:" + chartTypeNameArr[groupPosition][childPosition],
Toast.LENGTH_SHORT
).show()
true
}
}
private fun goToCommonChartActivity(chartType: String?, position: Int) {
val intent =
Intent(this, BasicChartActivity::class.java)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
private fun goToSpecialChartActivity(chartType: String?) {
val intent =
Intent(this, SpecialChartActivity::class.java)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToCustomStyleChartActivity(chartType: String?) {
val intent =
Intent(this, CustomStyleChartActivity::class.java)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToMixedChartActivity(chartType: String?) {
val intent =
Intent(this, MixedChartActivity::class.java)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToDrawChartWithAAOptionsActivity(chartType: String?) {
val intent = Intent(
this,
DrawChartWithAAOptionsActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToOnlyRefreshChartDataActivity(chartType: String?) {
val intent = Intent(
this,
OnlyRefreshChartDataActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToCustomTooltipWithJSFunctionActivity(chartType: String?) {
val intent = Intent(
this,
JSFormatterFunctionActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToEvaluateJSStringFunctionActivity(chartType: String?) {
val intent = Intent(
this,
EvaluateJSStringFunctionActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToHideOrShowChartSeriesActivity(chartType: String?) {
val intent = Intent(
this,
HideOrShowChartSeriesActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToDoubleChartsLinkedWorkActivity(chartType: String?) {
val intent = Intent(
this,
DoubleChartsLinkedWorkActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
startActivity(intent)
}
private fun goToScrollableChartActivity(chartType: String?, position: Int) {
val intent =
Intent(this, ScrollableChartActivity::class.java)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
private fun goToAdvancedUpdatingFeatureActivity(chartType: String?, position: Int) {
val intent = Intent(
this,
AdvancedUpdatingFeatureActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
private fun goToJSFunctionForAAAxisActivity(chartType: String?, position: Int) {
val intent = Intent(this, JSFunctionForAAAxisActivity::class.java)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
private fun goToJSFunctionForAALegendActivity(chartType: String?, position: Int) {
val intent = Intent(
this,
JSFunctionForAALegendActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
private fun goToJSFunctionForAAChartEventsActivity(chartType: String?, position: Int) {
val intent = Intent(
this,
JSFunctionForAAChartEventsActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
private fun goToJSFunctionForAAOptionsActivity(chartType: String?, position: Int) {
val intent = Intent(
this,
JSFunctionForAAOptionsActivity::class.java
)
intent.putExtra(kChartTypeKey, chartType)
intent.putExtra("position", position)
startActivity(intent)
}
companion object {
private const val kChartTypeKey = "chartType"
}
}
@@ -0,0 +1,73 @@
/**
* ...... SOURCE CODE ......
* ...................................................
* https://github.com/AAChartModel/AAChartCore ◉◉◉
* https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ...................................................
* ...... SOURCE CODE ......
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 WARM TIPS!!! 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.basiccontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.MixedChartComposer
class MixedChartActivity : AppCompatActivity() {
private var aaChartModel: AAChartModel? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_mixed_chart)
val intent = intent
val chartType = intent.getStringExtra("chartType")
this.aaChartModel = configureTheAAChartModel(chartType!!)
aaChartModel = configureTheAAChartModel(chartType)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartModel(aaChartModel!!)
}
private fun configureTheAAChartModel(chartType: String): AAChartModel {
when (chartType) {
"arearangeMixedLine" -> return MixedChartComposer.arearangeMixedLine()
"columnrangeMixedLine" -> return MixedChartComposer.configureColumnrangeMixedLineChart()
"stackingColumnMixedLine" -> return MixedChartComposer.configureStackingColumnMixedLineChart()
"dashStyleTypeMixed" -> return MixedChartComposer.dashStyleTypeMixedChart()
"negativeColorMixed" -> return MixedChartComposer.negativeColorMixedChart()
"scatterMixedLine" -> return MixedChartComposer.scatterMixedLine()
"negativeColorMixedBubble" -> return MixedChartComposer.negativeColorMixedBubble()
"polygonMixedScatter" -> return MixedChartComposer.polygonMixedScatter()
"polarChartMixed" -> return MixedChartComposer.polarChartMixedChart()
"configurePieMixedLineMixedColumnChart" -> return MixedChartComposer.configurePieMixedLineMixedColumnChart()
"configureNegativeColorMixedAreasplineChart" -> return MixedChartComposer.configureNegativeColorMixedAreasplineChart()
}
return MixedChartComposer.arearangeMixedLine()
}
}
@@ -0,0 +1,130 @@
package com.github.aachartmodel.aainfographics.demo.basiccontent
import android.content.Context
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseExpandableListAdapter
import android.widget.TextView
import com.github.aachartmodel.aainfographics.demo.R
class MyBaseExpandableListAdapter(
private val gData: Array<String>,
private val iData: Array<Array<String>>,
private val mContext: Context,
private val colorsArr: Array<String> = arrayOf("#5470c6",
"#91cc75",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc",
"#5470c6",
"#91cc75",
"#fac858",
"#ee6666",
"#73c0de",
"#3ba272",
"#fc8452",
"#9a60b4",
"#ea7ccc"
)
) :
BaseExpandableListAdapter() {
override fun getGroupCount(): Int {
return gData.size
}
override fun getChildrenCount(groupPosition: Int): Int {
return iData[groupPosition].count()
}
override fun getGroup(groupPosition: Int): String {
return gData[groupPosition]
}
override fun getChild(groupPosition: Int, childPosition: Int): String {
return iData[groupPosition][childPosition]
}
override fun getGroupId(groupPosition: Int): Long {
return groupPosition.toLong()
}
override fun getChildId(groupPosition: Int, childPosition: Int): Long {
return childPosition.toLong()
}
override fun hasStableIds(): Boolean {
return false
}
//取得用于显示给定分组的视图. 这个方法仅返回分组的视图对象
override fun getGroupView(
groupPosition: Int,
isExpanded: Boolean,
convertView: View?,
parent: ViewGroup
): View? {
var convertView = convertView
val groupHolder: ViewHolderGroup
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(
R.layout.item_exlist_group, parent, false
)
groupHolder = ViewHolderGroup()
groupHolder.tv_group_name = convertView.findViewById<View>(R.id.tv_group_name) as TextView
convertView.tag = groupHolder
} else {
groupHolder = convertView.tag as ViewHolderGroup
}
groupHolder.tv_group_name!!.text = gData[groupPosition]
return convertView
}
//取得显示给定分组给定子位置的数据用的视图
override fun getChildView(
groupPosition: Int,
childPosition: Int,
isLastChild: Boolean,
convertView: View?,
parent: ViewGroup
): View? {
var convertView = convertView
val itemHolder: ViewHolderItem
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(
R.layout.item_exlist_item, parent, false
)
itemHolder = ViewHolderItem()
itemHolder.tv_color_dot = convertView.findViewById<View>(R.id.tv_color_dot) as TextView
itemHolder.tv_name = convertView.findViewById<View>(R.id.tv_name) as TextView
convertView.tag = itemHolder
} else {
itemHolder =
convertView.tag as ViewHolderItem
}
val colorStr = colorsArr[groupPosition]
itemHolder.tv_color_dot?.setTextColor(Color.parseColor(colorStr))
itemHolder.tv_name?.text = iData[groupPosition][childPosition]
return convertView
}
//设置子列表是否可选中
override fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean {
return true
}
private class ViewHolderGroup {
var tv_group_name: TextView? = null
}
private class ViewHolderItem {
var tv_color_dot: TextView? = null
var tv_name: TextView? = null
}
}
@@ -0,0 +1,81 @@
/**
* ...... SOURCE CODE ......
* ...................................................
* https://github.com/AAChartModel/AAChartCore ◉◉◉
* https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ...................................................
* ...... SOURCE CODE ......
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 WARM TIPS!!! 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.basiccontent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartType
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
import com.github.aachartmodel.aainfographics.demo.R
import com.github.aachartmodel.aainfographics.demo.chartcomposer.SpecialChartComposer
class SpecialChartActivity : AppCompatActivity() {
private var aaChartModel: AAChartModel? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_special_chart)
val intent = intent
val chartType = intent.getStringExtra("chartType")
aaChartModel = configureChartModelWithChartType(chartType!!)
val aaChartView: AAChartView = findViewById(R.id.AAChartView)
aaChartView.aa_drawChartWithChartModel(aaChartModel!!)
}
private fun configureChartModelWithChartType(chartType: String): AAChartModel? {
when (chartType) {
AAChartType.Column.value -> return SpecialChartComposer.configurePolarColumnChart()
AAChartType.Bar.value -> return SpecialChartComposer.configurePolarBarChart()
AAChartType.Line.value -> return SpecialChartComposer.configurePolarLineChart()
AAChartType.Area.value -> return SpecialChartComposer.configurePolarAreaChart()
AAChartType.Pie.value -> return SpecialChartComposer.configurePieChart()
AAChartType.Bubble.value -> return SpecialChartComposer.configureBubbleChart()
AAChartType.Scatter.value -> return SpecialChartComposer.configureScatterChart()
AAChartType.Arearange.value -> return SpecialChartComposer.configureArearangeChart()
AAChartType.Areasplinerange.value -> return SpecialChartComposer.configureAreasplinerangeChart()
AAChartType.Columnrange.value -> return SpecialChartComposer.configureColumnrangeChart()
AAChartType.Spline.value -> return SpecialChartComposer.configureStepLineChart()
AAChartType.Areaspline.value -> return SpecialChartComposer.configureStepAreaChart()
AAChartType.Boxplot.value -> return SpecialChartComposer.configureBoxplotChart()
AAChartType.Waterfall.value -> return SpecialChartComposer.configureWaterfallChart()
AAChartType.Pyramid.value -> return SpecialChartComposer.configurePyramidChart()
AAChartType.Funnel.value -> return SpecialChartComposer.configureFunnelChart()
AAChartType.Errorbar.value -> return SpecialChartComposer.configureErrorbarChart()
AAChartType.Gauge.value -> return SpecialChartComposer.configureGaugeChart()
AAChartType.Polygon.value -> return SpecialChartComposer.configurePolygonChart()
}
return SpecialChartComposer.configurePolarColumnChart()
}
}
@@ -0,0 +1,9 @@
package com.github.aachartmodel.aainfographics.demo.chartcomposer
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartSymbolType
val predefinedSymbol1 = AAChartSymbolType.Triangle.value
val predefinedSymbol2 = AAChartSymbolType.Circle.value
val imageSymbol = "url(https://www.highcharts.com/samples/graphics/sun.png)"
val base64Symbol =
"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5Si +ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVi +pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+ 1dT1gvWd+ 1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx+ 1/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb+ 16EHTh0kX/i +c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAVVJREFUeNpi/P37NwOxYM2pHtm7lw8uYmBgYGAiVtPC3RWh+88vuneT474Dv4DkcUZibJy8PG72le/nkn+zMzAaMhnNyY1clMpCjKbz/86lMLAzMMA0MTAwMOC1Ea6JgYFB9pPwncbMg6owOaY1p3pk15zqkcWnie8j63ddY18nZHmWI2eW3vzN/Jf168c3UfGuHathAXHl+7lkBnYGBtafDP8NVd3jQ8xKHiNrZMyeqPPtE/9vTgYGBgb1H4oHlHXt43ZfWfDwNzsDIwMDA4POX831RXGrg9BdxLhob63VgTurjsAUsv5k+A9jC3/g/NCdfVoQm/+ZIu3qjhnyW3XABJANMNL19cYVcPBQrZpq9eyFwCdJmIT6D8UD5cmbHXFphKccI9Mgc84vTH9goYhPE4rGELOSx0bSjsUMDAwMunJ2FQST0+/fv1Hw5BWJbehi2DBgAHTKsWmiz+rJAAAAAElFTkSuQmCC)"
@@ -0,0 +1,138 @@
package com.github.aachartmodel.aainfographics.demo.chartcomposer
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartAnimationType
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartModel
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartSymbolStyleType
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartSymbolType
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartType
import com.github.aachartmodel.aainfographics.aachartcreator.AASeriesElement
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
import com.github.aachartmodel.aainfographics.aatools.AALinearGradientDirection
object BasicChartComposer {
private fun configureBasicOptions(): AAChartModel {
return AAChartModel()
.backgroundColor("#4b2b7f")
.dataLabelsEnabled(false)
.yAxisGridLineWidth(0)
.touchEventEnabled(true)
}
fun configureAreaChart(): AAChartModel {
val element1: AASeriesElement = AASeriesElement()
.name("Tokyo")
.data(arrayOf<Any>(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6))
val element2: AASeriesElement = AASeriesElement()
.name("NewYork")
.data(arrayOf<Any>(0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5))
val element3: AASeriesElement = AASeriesElement()
.name("London")
.data(arrayOf<Any>(0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0))
val element4: AASeriesElement = AASeriesElement()
.name("Berlin")
.data(arrayOf<Any>(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8))
return configureBasicOptions()
.chartType(AAChartType.Area)
.categories(arrayOf("Java","Swift","Python","Ruby", "PHP","Go","C","C#","C++"))
.series(arrayOf(element1, element2, element3, element4))
}
fun configureStepAreaChartAndStepLineChart(): AAChartModel {
val element1 = AASeriesElement()
.name("Tokyo")
.step(true)
.data(arrayOf(149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4))
val element2 = AASeriesElement()
.name("NewYork")
.step(true)
.data(arrayOf(83.6, 78.8, 188.5, 93.4, 106.0, 84.5, 105.0, 104.3, 131.2, 153.5, 226.6, 192.3))
val element3 = AASeriesElement()
.name("London")
.step(true)
.data(arrayOf(48.9, 38.8, 19.3, 41.4, 47.0, 28.3, 59.0, 69.6, 52.4, 65.2, 53.3, 72.2))
return configureBasicOptions()
.chartType(AAChartType.Area)
.series(arrayOf(element1, element2, element3))
}
fun configureColumnChartAndBarChart(): AAChartModel {
return configureAreaChart()
.categories(arrayOf(
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))
.legendEnabled(true)
.colorsTheme(arrayOf("#fe117c", "#ffc069", "#06caf4", "#7dffc0"))
.animationType(AAChartAnimationType.EaseOutCubic)
.animationDuration(1200)
}
fun configureAreaChartAndAreasplineChartStyle(chartType: String): AAChartModel {
val aaChartModel: AAChartModel = configureAreaChart()
.animationType(AAChartAnimationType.EaseOutQuart)
.legendEnabled(true)
.markerRadius(6)
.markerSymbol(AAChartSymbolType.Circle)
.markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
if (chartType == AAChartType.Areaspline.value) {
val gradientColorDic: Map<String, Any> = AAGradientColor.linearGradient(
AALinearGradientDirection.ToBottomRight,
"rgba(138,43,226,1)",
"rgba(30,144,255,1)" //颜色字符串设置支持十六进制类型和 rgba 类型
)
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))
aaChartModel
.animationType(AAChartAnimationType.EaseFrom) //设置图表渲染动画类型为 EaseFrom
.series(arrayOf(element1, element2, element3, element4))
}
return aaChartModel
}
fun configureLineChartAndSplineChartStyle(chartType: String): AAChartModel {
val aaChartModel: AAChartModel = configureAreaChart()
// .chartType(chartType)
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank) //设置折线连接点样式为:边缘白色
.markerRadius(6)
if (chartType == AAChartType.Spline.value) {
val element1: AASeriesElement = AASeriesElement()
.name("Tokyo")
.lineWidth(7)
.data(arrayOf<Any>(50, 320, 230, 370, 230, 400))
val element2: AASeriesElement = AASeriesElement()
.name("Berlin")
.lineWidth(7)
.data(arrayOf<Any>(80, 390, 210, 340, 240, 350))
val element3: AASeriesElement = AASeriesElement()
.name("New York")
.lineWidth(7)
.data(arrayOf<Any>(100, 370, 180, 280, 260, 300))
val element4: AASeriesElement = AASeriesElement()
.name("London")
.lineWidth(7)
.data(arrayOf<Any>(130, 350, 160, 310, 250, 268))
aaChartModel
.animationType(AAChartAnimationType.SwingFromTo)
.series(arrayOf(element1, element2, element3, element4))
}
return aaChartModel
}
}
@@ -0,0 +1,758 @@
package com.github.aachartmodel.aainfographics.demo.chartcomposer
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aaoptionsmodel.*
import com.github.aachartmodel.aainfographics.aatools.AAColor
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
import com.github.aachartmodel.aainfographics.aatools.AALinearGradientDirection
import com.github.aachartmodel.aainfographics.aatools.AARgba
object JSFunctionForAAAxisComposer {
fun customYAxisLabels(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Line)//图形类型
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.dataLabelsEnabled(false)
.colorsTheme(arrayOf("#04d69f", "#1e90ff", "#ef476f", "#ffd066"))
.stacking(AAChartStackingType.Normal)
.markerRadius(8)
.series(arrayOf(
AASeriesElement()
.name("Tokyo Hot")
.lineWidth(5.0)
.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 () {
var 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 = aaChartModel.aa_toAAOptions()
aaOptions.yAxis?.labels(aaYAxisLabels)
return aaOptions
}
fun customYAxisLabels2(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Line)//图形类型
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)//折线连接点样式为外边缘空白
.dataLabelsEnabled(false)
.colorsTheme(arrayOf("#04d69f", "#1e90ff", "#ef476f", "#ffd066"))
.stacking(AAChartStackingType.Normal)
.markerRadius(8)
.series(arrayOf(
AASeriesElement()
.name("Tokyo Hot")
.lineWidth(5.0)
.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(10)
.fontWeight(AAChartFontWeightType.Bold)
.color(AAColor.Gray))
.formatter("""
function () {
var 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 = aaChartModel.aa_toAAOptions()
aaOptions.yAxis?.apply {
opposite(true)
.tickWidth(2)
.lineWidth(1.5)//Y轴轴线颜色
.lineColor(AAColor.LightGray)//Y轴轴线颜色
.gridLineWidth(0)//Y轴网格线宽度
.tickPositions(arrayOf(0, 2500, 5000, 7500, 10000))
.labels(aaYAxisLabels)
}
return aaOptions
}
//Stupid method
fun customAreaChartXAxisLabelsTextUnitSuffix1(): AAOptions {
val gradientColorDic1 = AAGradientColor.linearGradient(
AALinearGradientDirection.ToTop,
"#7052f4",
"#00b0ff"
)
val aaChartModel = AAChartModel()
.chartType(AAChartType.Area)
.title("Custom X Axis Labels Text")
.subtitle("By Using JavaScript Formatter Function")
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)
.yAxisGridLineWidth(0)
.series(arrayOf(
AASeriesElement()
.lineWidth(1.5)
.color("#00b0ff")
.fillColor(gradientColorDic1)
.name("2018")
.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, 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 aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.xAxis?.labels
?.formatter(
"function () {" +
"const xValue = this.value;" +
"if (xValue%10 == 0) {" +
"return xValue + \" sec\";" +
"} else {" +
"return \"\";" +
"}" +
"}"
)
return aaOptions
}
//Smart method
fun customAreaChartXAxisLabelsTextUnitSuffix2(): AAOptions {
val aaOptions = customAreaChartXAxisLabelsTextUnitSuffix1()
aaOptions.xAxis?.labels?.apply {
step(10)
.format("{value} sec")
}
return aaOptions
}
//https://github.com/AAChartModel/AAChartKit/issues/901
//https://github.com/AAChartModel/AAChartKit/issues/952
fun configureTheAxesLabelsFormattersOfDoubleYAxesChart(): AAOptions {
val aaChart = AAChart()
.backgroundColor(AAColor.White)
val aaTitle = AATitle()
.text("")
val aaXAxis = AAXAxis()
.visible(true)
.min(0)
.categories(arrayOf(
"Java", "Swift", "Python", "Ruby", "PHP", "Go", "C",
"C#", "C++", "Perl", "R", "MATLAB", "SQL"
))
val aaPlotOptions = AAPlotOptions()
.series(
AASeries()
.marker(
AAMarker()
.radius(7) //曲线连接点半径,默认是4
.symbol(AAChartSymbolType.Circle.value) //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
.fillColor(AAColor.White) //点的填充色(用来设置折线连接点的填充色)
.lineWidth(3) //外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
.lineColor("") //外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)
))
val yAxis1 = AAYAxis()
.visible(true)
.lineWidth(1)
.tickPositions(arrayOf(0, 50, 100, 150, 200))
.labels(AALabels()
.enabled(true)
.style(AAStyle()
.color("DodgerBlue"))
.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 "一般";
}
}"""))
.gridLineWidth(0)
.title(
AATitle()
.text("中文")
.style(AAStyle.style("DodgerBlue", 14, AAChartFontWeightType.Bold)))
val yAxis2 = AAYAxis()
.visible(true)
.lineWidth(1)
.tickPositions(arrayOf(0, 50, 100, 150, 200))
.labels(AALabels()
.enabled(true)
.style(AAStyle()
.color(AAColor.Red))
.formatter("""function () {
let yValue = this.value;
if (yValue >= 200) {
return "Awesome";
} else if (yValue >= 150 && yValue < 200) {
return "Great";
} else if (yValue >= 100 && yValue < 150) {
return "Very Good";
} else if (yValue >= 50 && yValue < 100) {
return "Not Bad";
} else {
return "Just So So";
}
}"""))
.gridLineWidth(0)
.title(
AATitle()
.text("ENGLISH")
.style(AAStyle.style(AAColor.Red, 14, AAChartFontWeightType.Bold)))
.opposite(true)
val aaTooltip = AATooltip()
.enabled(true)
.shared(true)
val seriesArr: Array<Any> = arrayOf(
AASeriesElement()
.name("2020")
.type(AAChartType.Spline)
.lineWidth(7)
.color(AAGradientColor.DeepSea)
.borderRadius(4)
.yAxis(1)
.data(arrayOf(
0, 71.5, 106.4, 129.2, 144.0, 176.0,
135.6, 148.5, 216.4, 194.1, 95.6, 54.4
)),
AASeriesElement()
.name("2021")
.type(AAChartType.Spline)
.lineWidth(7)
.color(AAGradientColor.Sanguine)
.yAxis(0)
.data(arrayOf(
135.6, 148.5, 216.4, 194.1, 95.6, 54.4,
0, 71.5, 106.4, 129.2, 144.0, 176.0
)))
return AAOptions()
.chart(aaChart)
.title(aaTitle)
.plotOptions(aaPlotOptions)
.xAxis(aaXAxis)
.yAxisArray(arrayOf(yAxis1, yAxis2))
.tooltip(aaTooltip)
.series(seriesArr)
}
//https://github.com/AAChartModel/AAChartKit/issues/1324
fun configureTheAxesLabelsFormattersOfDoubleYAxesChart2(): AAOptions {
val aaChart = AAChart()
.backgroundColor(AAColor.White)
val aaTitle = AATitle()
.text("")
val aaXAxis = AAXAxis()
.visible(true)
.min(0)
.categories(arrayOf(
"Java", "Swift", "Python", "Ruby", "PHP", "Go", "C",
"C#", "C++", "Perl", "R", "MATLAB", "SQL"))
val aaPlotOptions = AAPlotOptions()
.series(
AASeries()
.marker(
AAMarker()
.radius(7) //曲线连接点半径,默认是4
.symbol(AAChartSymbolType.Circle.value) //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
.fillColor(AAColor.White) //点的填充色(用来设置折线连接点的填充色)
.lineWidth(3) //外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
.lineColor("") //外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)
))
val yAxis1 = AAYAxis()
.visible(true)
.lineWidth(1)
.tickPositions(arrayOf(0, 50, 100, 150, 200))
.labels(AALabels()
.enabled(true)
.style(AAStyle()
.color("DodgerBlue"))
.formatter("""function () {
var yValue = this.value;
var formattedYValue = (yValue / 1000).toFixed(3) + '千';
return formattedYValue;
}"""
))
.gridLineWidth(0)
.title(
AATitle()
.text("以「千」为单位")
.style(AAStyle.style("DodgerBlue", 14, AAChartFontWeightType.Bold)))
val yAxis2 = AAYAxis()
.visible(true)
.lineWidth(1)
.tickPositions(arrayOf(0, 50, 100, 150, 200))
.labels(AALabels()
.enabled(true)
.style(AAStyle()
.color(AAColor.Red))
.formatter("""function () {
var yValue = this.value;
var formattedYValue = (yValue / 10000).toFixed(4) + '万';
return formattedYValue;
}"""
))
.gridLineWidth(0)
.title(
AATitle()
.text("以『万』为单位")
.style(AAStyle.style(AAColor.Red, 14, AAChartFontWeightType.Bold)))
.opposite(true)
val aaTooltip = AATooltip()
.enabled(true)
.shared(true)
val seriesArr: Array<Any> = arrayOf(
AASeriesElement()
.name("2020")
.type(AAChartType.Spline)
.lineWidth(7)
.color(AAGradientColor.DeepSea)
.borderRadius(4)
.yAxis(1)
.data(arrayOf(
0, 71.5, 106.4, 129.2, 144.0, 176.0,
135.6, 148.5, 216.4, 194.1, 95.6, 54.4)),
AASeriesElement()
.name("2021")
.type(AAChartType.Spline)
.lineWidth(7)
.color(AAGradientColor.Sanguine)
.yAxis(0)
.data(arrayOf(
135.6, 148.5, 216.4, 194.1, 95.6, 54.4,
0, 71.5, 106.4, 129.2, 144.0, 176.0
)))
return AAOptions()
.chart(aaChart)
.title(aaTitle)
.plotOptions(aaPlotOptions)
.xAxis(aaXAxis)
.yAxisArray(arrayOf(yAxis1, yAxis2))
.tooltip(aaTooltip)
.series(seriesArr)
}
//https://github.com/AAChartModel/AAChartKit/issues/1324
//https://github.com/AAChartModel/AAChartKit/issues/1330
fun configureTheAxesLabelsFormattersOfDoubleYAxesChart3(): AAOptions {
val aaChart = AAChart()
.backgroundColor(AAColor.White)
val aaTitle = AATitle()
.text("")
val aaXAxis = AAXAxis()
.visible(true)
.min(0)
.categories(arrayOf(
"Java", "Swift", "Python", "Ruby", "PHP", "Go", "C",
"C#", "C++", "Perl", "R", "MATLAB", "SQL"
))
val aaPlotOptions = AAPlotOptions()
.series(
AASeries()
.marker(
AAMarker()
.radius(7) //曲线连接点半径,默认是4
.symbol(AAChartSymbolType.Circle.value) //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
.fillColor(AAColor.White) //点的填充色(用来设置折线连接点的填充色)
.lineWidth(3) //外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
.lineColor("") //外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)
))
val yAxis1 = AAYAxis()
.visible(true)
.lineWidth(1)
.tickPositions(arrayOf(0, 50, 100, 150, 200))
.labels(AALabels()
.enabled(true)
.style(AAStyle()
.color("DodgerBlue"))
.formatter("""function () {
var yValue = this.value;
var unitStr = "";
if (yValue == 0) {
unitStr = "";
}
var formattedYValue = (yValue / 1000).toFixed(3) + unitStr;
return formattedYValue;
}""")) //Y轴文字数值为 0 的时候, 不显示单位
.gridLineWidth(0)
.title(
AATitle()
.text("以「千」为单位")
.style(AAStyle.style("DodgerBlue", 14, AAChartFontWeightType.Bold)))
val yAxis2 = AAYAxis()
.visible(true)
.lineWidth(1)
.tickPositions(arrayOf(0, 50, 100, 150, 200))
.labels(AALabels()
.enabled(true)
.style(AAStyle()
.color(AAColor.Red))
.formatter("""function () {
var yValue = this.value;
var unitStr = "";
if (yValue == 0) {
unitStr = "";
}
var formattedYValue = (yValue / 10000).toFixed(4) + unitStr;
return formattedYValue;
}""")) //Y轴文字数值为 0 的时候, 不显示单位
.gridLineWidth(0)
.title(
AATitle()
.text("以『万』为单位")
.style(AAStyle.style(AAColor.Red, 14, AAChartFontWeightType.Bold)))
.opposite(true)
val aaTooltip = AATooltip()
.enabled(true)
.shared(true)
val seriesArr: Array<Any> = arrayOf(
AASeriesElement()
.name("2020")
.type(AAChartType.Spline)
.lineWidth(7)
.color(AAGradientColor.DeepSea)
.borderRadius(4)
.yAxis(1)
.data(arrayOf(
0, 71.5, 106.4, 129.2, 144.0, 176.0,
135.6, 148.5, 216.4, 194.1, 95.6, 54.4)),
AASeriesElement()
.name("2021")
.type(AAChartType.Spline)
.lineWidth(7)
.color(AAGradientColor.Sanguine)
.yAxis(0)
.data(arrayOf(
135.6, 148.5, 216.4, 194.1, 95.6, 54.4,
0, 71.5, 106.4, 129.2, 144.0, 176.0)))
return AAOptions()
.chart(aaChart)
.title(aaTitle)
.plotOptions(aaPlotOptions)
.xAxis(aaXAxis)
.yAxisArray(arrayOf(yAxis1, yAxis2))
.tooltip(aaTooltip)
.series(seriesArr)
}
//https://github.com/AAChartModel/AAChartKit/issues/1217
fun customColumnChartXAxisLabelsTextByInterceptTheFirstFourCharacters(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Bar) //图表类型
.title("春江花月夜") //图表主标题
.subtitle("张若虚") //图表副标题
// .yAxisGridLineStyle([AALineStyle styleWithWidth:0})//y轴横向分割线宽度(为0即是隐藏分割线)
.xAxisReversed(true) // .xAxisLabelsStyle(AAStyle.style(AAColor.Black))
.legendEnabled(false)
.categories(arrayOf(
"春江潮水连海平", "海上明月共潮生",
"滟滟随波千万里", "何处春江无月明",
"江流宛转绕芳甸", "月照花林皆似霰",
"空里流霜不觉飞", "汀上白沙看不见",
"江天一色无纤尘", "皎皎空中孤月轮",
"江畔何人初见月", "江月何年初照人",
"人生代代无穷已", "江月年年望相似",
"不知江月待何人", "但见长江送流水",
"白云一片去悠悠", "青枫浦上不胜愁",
"谁家今夜扁舟子", "何处相思明月楼",
"可怜楼上月裴回", "应照离人妆镜台",
"玉户帘中卷不去", "捣衣砧上拂还来",
"此时相望不相闻", "愿逐月华流照君",
"鸿雁长飞光不度", "鱼龙潜跃水成文",
"昨夜闲潭梦落花", "可怜春半不还家",
"江水流春去欲尽", "江潭落月复西斜",
"斜月沉沉藏海雾", "碣石潇湘无限路",
"不知乘月几人归", "落月摇情满江树"))
.series(arrayOf(
AASeriesElement()
.lineWidth(1.5)
.color(AAGradientColor.DeepSea)
.name("2018")
.data(arrayOf(
1.51, 3.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, 2.7, 0.94, 1.44,
3.6, 1.63, 1.56, 1.91, 2.45, 3.87, 3.24, 4.90,))))
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.xAxis?.labels
?.formatter("function () {\n" +
" let xAxisCategory = this.value;\n" +
" if (xAxisCategory.length > 4) {\n" +
" return xAxisCategory.substr(0, 4);\n" +
" } else {\n" +
" return xAxisCategory;\n" +
" }\n" +
" }")
return aaOptions
}
//https://github.com/AAChartModel/AAChartKit/issues/852 自定义蜘蛛🕷图样式
fun customSpiderChartStyle(): AAOptions {
val categoryArr = arrayOf(
"周转天数(天)",
"订单满足率",
"订单履约时效",
"动销率",
"畅销商品缺货率",
"高库存金额占比",
"不动销金额占比",
"停采金额占比"
)
// String categoryJSArrStr = {categoryArr aa_toJSArray];
//
// String xAxisLabelsFormatter ={String stringWithFormat:(AAJSFunc(function () {
// return %[this.value];
// })),categoryJSArrStr];
val categoryJSArrStr = javaScriptArrayStringWithJavaArray(categoryArr)
val xAxisLabelsFormatter = String.format(
"function () {\n" +
" return %s[this.value];\n" +
" }", categoryJSArrStr
)
val aaChartModel = AAChartModel()
.chartType(AAChartType.Line) //图表类型
.title("健康体检表") //图表主标题
.colorsTheme(arrayOf("#fe117c", "#ffc069")) //设置主体颜色数组
.yAxisLineWidth(0) // .yAxisGridLineStyle([AALineStyle styleWithWidth:0})
// .yAxisTickPositions([0, 5, 10, 15, 20, 25, 30, 35})
.markerRadius(5)
.markerSymbol(AAChartSymbolType.Circle)
.polar(true)
.series(arrayOf(
AASeriesElement()
.name("本月得分")
.data(arrayOf(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5)),
AASeriesElement()
.name("上月得分")
.data(arrayOf(0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1))))
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.chart?.apply {
marginLeft(80)
.marginRight(80)
}
aaOptions.xAxis?.apply {
lineWidth(0) //避免多边形外环之外有额外套了一层无用的外环
.labels?.style(AAStyle.style(AAColor.Black))
?.formatter(xAxisLabelsFormatter)
}
aaOptions.yAxis?.apply {
gridLineInterpolation("polygon") //设置蜘蛛网🕸图表的网线为多边形
.labels?.style(AAStyle.style(AAColor.Black))
}
//设定图例项的CSS样式。只支持有关文本的CSS样式设定。
// /默认是:{
// "color": "#333333",
// "cursor": "pointer",
// "fontSize": "12px",
// "fontWeight": "bold"
// }
// /
val aaItemStyle = AAItemStyle()
.color(AAColor.Gray) //字体颜色
.cursor("pointer") //(在移动端这个属性没什么意义,其实不用设置)指定鼠标滑过数据列时鼠标的形状。当绑定了数据列点击事件时,可以将此参数设置为 "pointer",用来提醒用户改数据列是可以点击的。
.fontSize(14) //字体大小
.fontWeight(AAChartFontWeightType.Thin) //字体为细体字
aaOptions.legend?.apply {
enabled(true)
.align(AAChartAlignType.Center) //设置图例位于水平方向上的右侧
.layout(AAChartLayoutType.Horizontal) //设置图例排列方式为垂直排布
.verticalAlign(AAChartVerticalAlignType.Top) //设置图例位于竖直方向上的顶部
.itemStyle(aaItemStyle)
}
return aaOptions
}
// Refer to the issue https://github.com/AAChartModel/AAChartKit/issues/589
fun customizeEveryDataLabelSinglelyByDataLabelsFormatter(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Areaspline) //图表类型
.dataLabelsEnabled(true)
.tooltipEnabled(false)
.colorsTheme(arrayOf(AAGradientColor.FizzyPeach))
.markerRadius(0)
.legendEnabled(false)
.categories(arrayOf(
"美国🇺🇸",
"欧洲🇪🇺",
"中国🇨🇳",
"日本🇯🇵",
"韩国🇰🇷",
"越南🇻🇳",
"中国香港🇭🇰"))
.series(arrayOf(
AASeriesElement()
.data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2))))
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.yAxis?.gridLineDashStyle = AAChartLineDashStyleType.LongDash.value //设置Y轴的网格线样式为 AAChartLineDashStyleType.LongDash
val unitArr = arrayOf("美元", "欧元", "人民币", "日元", "韩元", "越南盾", "港币")
val unitJSArrStr: String =
JSFunctionForAAOptionsComposer.javaScriptArrayStringWithJavaArray(unitArr)
val dataLabelsFormatter = String.format(
"function () {\n" +
" return this.y + %s[this.point.index]; \n" + //单组 series 图表, 获取选中的点的索引是 this.point.index ,多组并且共享提示框,则是this.points[0].index
" }", unitJSArrStr
)
val aaDatalabels = aaOptions.plotOptions?.series?.dataLabels
aaDatalabels?.apply {
style(AAStyle.style(AAColor.Red, 10, AAChartFontWeightType.Bold, "1px 1px contrast"))
.formatter(dataLabelsFormatter)
.backgroundColor(AAColor.White) // white color
.borderColor(AAColor.Red) // red color
.borderRadius(1.5)
.borderWidth(1.3)
.x(3).y(-20)
.verticalAlign(AAChartVerticalAlignType.Middle)
}
return aaOptions
}
// Refer to GitHub issue: https://github.com/AAChartModel/AAChartKit/issues/938
// Refer to online chart sample: https://www.highcharts.com/demo/column-comparison
fun customXAxisLabelsBeImages(): AAOptions {
val nameArr: Array<String> = arrayOf(
"South Korea",
"Japan",
"Australia",
"Germany",
"Russia",
"China",
"Great Britain",
"United States"
)
val colorArr: Array<Any> = arrayOf(
AARgba(201, 36, 39, 1f),
AARgba(201, 36, 39, 1f),
AARgba(0, 82, 180, 1f),
AARgba(0, 0, 0, 1f),
AARgba(240, 240, 240, 1f),
AARgba(255, 217, 68, 1f),
AARgba(0, 82, 180, 1f),
AARgba(215, 0, 38, 1f)
)
val imageLinkFlagArr: Array<String> = arrayOf(
"197582",
"197604",
"197507",
"197571",
"197408",
"197375",
"197374",
"197484"
)
val aaChartModel = AAChartModel()
.chartType(AAChartType.Column)
.title("Custom X Axis Labels Be Images")
.subtitle("use HTML")
.categories(nameArr)
.colorsTheme(colorArr)
.borderRadius(5)
.series(arrayOf(
AASeriesElement()
.name("AD 2020")
.data(arrayOf(9.0, 9.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5))
.colorByPoint(true)
.borderRadiusTopLeft("50%")
.borderRadiusTopRight("50%")))
val imageLinkFlagJSArrStr: String = javaScriptArrayStringWithJavaArray(imageLinkFlagArr)
val xLabelsFormatter = String.format(
"function () {\n" +
" let imageFlag = %s[this.pos];\n" +
" let imageLink = \"\";\n" +
" return imageLink;\n" +
" }", imageLinkFlagJSArrStr
)
// https://api.highcharts.com.cn/highcharts#xAxis.labels.formatter
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.xAxis?.labels?.apply {
useHTML(true)
.formatter(xLabelsFormatter)
}
aaOptions.plotOptions?.column?.groupPadding(0.005f)
// /Custom tooltip style/
// String tooltipFormatter ={String stringWithFormat:(AAJSFunc(function () {
// let imageFlag = %[this.point.index];
// let imageLink = "
// ";
// return imageLink
// + " 🌕 🌖 🌗 🌘 🌑 🌒 🌓 🌔
// "
// + " Support JavaScript Function Just Right Now !!!
// "
// + " The Gold Price For 2020 "
// + this.x
// + " Is "
// + this.y
// + " Dollars ";
// })),imageLinkFlagJSArrStr];
val tooltipFormatter = String.format(
("function () {\n" +
" let imageFlag = %s[this.point.index];\n" +
" let imageLink = \"<span><img src=\\\"https://image.flaticon.com/icons/svg/197/\" + imageFlag + \".svg\\\" style=\\\"width: 30px; height: 30px;\\\"/><br></span>\";\n" +
" return imageLink\n" +
" + \" \uD83C\uDF15 \uD83C\uDF16 \uD83C\uDF17 \uD83C\uDF18 \uD83C\uDF11 \uD83C\uDF12 \uD83C\uDF13 \uD83C\uDF14 <br/> \"\n" +
" + \" Support JavaScript Function Just Right Now !!! <br/> \"\n" +
" + \" The Gold Price For <b>2020 \"\n" +
" + this.x\n" +
" + \" </b> Is <b> \"\n" +
" + this.y\n" +
" + \" </b> Dollars \";\n" +
" }"), imageLinkFlagJSArrStr
)
aaOptions.tooltip?.apply {
shared(false)
.useHTML(true)
.formatter(tooltipFormatter)
}
return aaOptions
}
private fun javaScriptArrayStringWithJavaArray(javaArray: Array<String>): String {
val originalJsArrStr = StringBuilder()
for (element: Any in javaArray) {
originalJsArrStr.append("'").append(element.toString()).append("',")
}
return "[$originalJsArrStr]"
}
}
@@ -0,0 +1,217 @@
package com.github.aachartmodel.aainfographics.demo.chartcomposer
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aaoptionsmodel.*
import com.github.aachartmodel.aainfographics.aatools.AAColor
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
object JSFunctionForAALegendComposer {
fun disableLegendClickEventForNormalChart(): 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, "null", "null", "null", "null", "null", "null", "null", 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 aaChartModel = AAChartModel()
.chartType(AAChartType.Line)
.title("CUSTOM LEGEND STYLE")
.subtitle("LEGEND ON THE TOP_RIGHT SIDE WITH VERTICAL STYLE")
.subtitleAlign(AAChartAlignType.Left)
.markerRadius(0)
.backgroundColor(AAColor.White)
.dataLabelsEnabled(false)
.yAxisGridLineWidth(0)
.yAxisTitle("percent values")
.stacking(AAChartStackingType.Normal)
.colorsTheme(arrayOf("mediumspringgreen", "deepskyblue", "red", "sandybrown"))
.series(arrayOf(element1, element2, element3, element4))
val aaOptions = aaChartModel.aa_toAAOptions()
//https://github.com/AAChartModel/AAChartCore-Kotlin/issues/61
aaOptions.chart?.animation = false //turn off animation
aaOptions.tooltip?.apply {
backgroundColor(AAGradientColor.Firebrick)
.style(AAStyle.style(AAColor.White))
}
aaOptions.yAxis?.labels?.format = "{value} %"//给y轴添加单位
aaOptions.xAxis?.apply {
gridLineColor(AAColor.DarkGray)
.gridLineWidth(1)
.minorGridLineColor(AAColor.LightGray)
.minorGridLineWidth(0.5)
.minorTickInterval("auto")
}
aaOptions.yAxis?.apply {
gridLineColor(AAColor.DarkGray)
.gridLineWidth(1)
.minorGridLineColor(AAColor.LightGray)
.minorGridLineWidth(0.5)
.minorTickInterval("auto")
}
aaOptions.legend?.apply {
enabled(true)
.verticalAlign(AAChartVerticalAlignType.Top)
.layout(AAChartLayoutType.Vertical)
.align(AAChartAlignType.Right)
}
aaOptions.defaultOptions = AALang()
.resetZoom("重置缩放比例")
.thousandsSep(",")
aaOptions.plotOptions?.series?.connectNulls(true)
return aaOptions
}
// //https://github.com/AAChartModel/AAChartKit-Swift/issues/391
// //https://github.com/AAChartModel/AAChartKit-Swift/issues/393
fun disableLegendClickEventForPieChart(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Pie)
.backgroundColor(AAColor.White)
.title("LANGUAGE MARKET SHARES JANUARY,2020 TO MAY")
.subtitle("virtual data")
.dataLabelsEnabled(true) //是否直接显示扇形图数据
.yAxisTitle("")
.series(arrayOf(
AASeriesElement()
.name("Language market shares")
.innerSize("20%") //内部圆环半径大小占比(内部圆环半径/扇形图半径),
.allowPointSelect(true)
.states(AAStates()
.hover(AAHover()
.enabled(false))) //禁用点击区块之后出现的半透明遮罩层
.data(arrayOf(
arrayOf("Java", 67),
arrayOf("Swift", 999),
arrayOf("Python", 83),
arrayOf("OC", 11),
arrayOf("Go", 30)))))
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.legend?.labelFormat("{name} {percentage:.2f}%")
//禁用饼图图例点击事件
aaOptions.plotOptions?.series
?.point(AAPoint()
.events(AAPointEvents()
.legendItemClick(
"" +
"function() { " +
"return false; " +
"}")))
return aaOptions
}
//https://bbs.hcharts.cn/article-109-1.html
//图表自带的图例点击事件是:
//点击某个显示/隐藏的图例,该图例对应的serie就隐藏/显示。
//个人觉得不合理,正常来说,有多条折线(或其他类型的图表),点击某个图例是想只看该图例对应的数据;
//于是修改了图例点击事件。
//
//实现的效果是(以折线图为例)
//1. 当某条折线隐藏时,点击该折线的图例 --> 该折线显示;
//2. 当全部折线都显示时,点击某个图例 --> 该图例对应的折线显示,其他折线均隐藏;
//3. 当只有一条折线显示时,点击该折线的图例 --> 全部折线均显示;
//4. 其他情况,按默认处理:
//显示 --> 隐藏;
//隐藏 --> 显示;
//Customized legengItemClick Event online: http://code.hcharts.cn/rencht/hhhhLv/share
fun customLegendItemClickEvent(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Column)
.stacking(AAChartStackingType.Normal)
.colorsTheme(arrayOf("#fe117c", "#ffc069", "#06caf4", "#7dffc0")) //设置主题颜色数组
.markerRadius(0)
.series(arrayOf(
AASeriesElement()
.name("Tokyo")
.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)),
AASeriesElement()
.name("NewYork")
.data(arrayOf(0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5)),
AASeriesElement()
.name("London")
.data(arrayOf(0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0)),
AASeriesElement()
.name("Berlin")
.data(arrayOf(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8))))
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.legend?.apply {
enabled(true)
.align(AAChartAlignType.Right) //设置图例位于水平方向上的右侧
.layout(AAChartLayoutType.Vertical) //设置图例排列方式为垂直排布
.verticalAlign(AAChartVerticalAlignType.Top) //设置图例位于竖直方向上的顶部
}
//自定义图例点击事件
aaOptions.plotOptions?.series?.events = AASeriesEvents()
.legendItemClick(
"""function(event) {
function getVisibleMode(series, serieName) {
var allVisible = true;
var allHidden = true;
for (var i = 0; i < series.length; i++) {
if (series[i].name == serieName)
continue;
allVisible &= series[i].visible;
allHidden &= (!series[i].visible);
}
if (allVisible && !allHidden)
return 'all-visible';
if (allHidden && !allVisible)
return 'all-hidden';
return 'other-cases';
}
var series = this.chart.series;
var mode = getVisibleMode(series, this.name);
var enableDefault = false;
if (!this.visible) {
enableDefault = true;
}
else if (mode == 'all-visible') {
var seriesLength = series.length;
for (var i = 0; i < seriesLength; i++) {
var serie = series[i];
serie.hide();
}
this.show();
}
else if (mode == 'all-hidden') {
var seriesLength = series.length;
for (var i = 0; i < seriesLength; i++) {
var serie = series[i];
serie.show();
}
}
else {
enableDefault = true;
}
return enableDefault;
}"""
)
return aaOptions
}
}
@@ -0,0 +1,236 @@
package com.github.aachartmodel.aainfographics.demo.chartcomposer
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aaoptionsmodel.*
import com.github.aachartmodel.aainfographics.aatools.AAColor
import com.github.aachartmodel.aainfographics.aatools.AAGradientColor
import com.github.aachartmodel.aainfographics.aatools.AALinearGradientDirection
object JSFunctionForAAOptionsComposer {
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.0))
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(0)// Y 轴网格线宽度
.title(AATitle()
.text(""))//Y 轴标题
.labels(AALabels()
.formatter("""
function () {
return (Math.abs(this.value) / 1000000) + 'M';
}
""".trimIndent()
))
.min(-4000000)
.max(4000000)
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))
}
//https://github.com/AAChartModel/AAChartKit/issues/967
fun disableColumnChartUnselectEventEffectBySeriesPointEventClickFunction(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Bar)
.title("Custom Bar Chart select color")
.yAxisReversed(true)
.xAxisReversed(true)
.series(arrayOf(
AASeriesElement()
.name("ElementOne")
.data(arrayOf(211, 183, 157, 133, 111, 91, 73, 57, 43, 31, 21, 13, 7, 3))
.allowPointSelect(true)
.states(AAStates()
.hover(AAHover()
.color(AAColor.Yellow))
.select(AASelect()
.color(AAColor.Red)))))
val aaOptions = aaChartModel.aa_toAAOptions()
val aaPoint: AAPoint = AAPoint()
.events(AAPointEvents()
.click("""
function () {
if (this.selected == true) {
this.selected = false;
}
return;
}
"""))
aaOptions.plotOptions?.series
?.point(aaPoint)
return aaOptions
}
// Refer to the issue https://github.com/AAChartModel/AAChartKit/issues/589
fun customizeEveryDataLabelSinglelyByDataLabelsFormatter(): AAOptions {
val aaChartModel = AAChartModel()
.chartType(AAChartType.Areaspline) //图表类型
.dataLabelsEnabled(true)
.tooltipEnabled(false)
.colorsTheme(arrayOf(AAGradientColor.FizzyPeach))
.markerRadius(0)
.legendEnabled(false)
.categories(arrayOf(
"美国🇺🇸",
"欧洲🇪🇺",
"中国🇨🇳",
"日本🇯🇵",
"韩国🇰🇷",
"越南🇻🇳",
"中国香港🇭🇰"))
.series(arrayOf(
AASeriesElement()
.data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2))))
val aaOptions = aaChartModel.aa_toAAOptions()
aaOptions.yAxis?.gridLineDashStyle = AAChartLineDashStyleType.LongDash.value //设置Y轴的网格线样式为 AAChartLineDashStyleType.LongDash
val unitArr = arrayOf("美元", "欧元", "人民币", "日元", "韩元", "越南盾", "港币")
val unitJSArrStr: String = javaScriptArrayStringWithJavaArray(unitArr)
val dataLabelsFormatter = String.format(
"function () {\n" +
" return this.y + %s[this.point.index]; \n" + //单组 series 图表, 获取选中的点的索引是 this.point.index ,多组并且共享提示框,则是this.points[0].index
" }", unitJSArrStr
)
val aaDatalabels = aaOptions.plotOptions?.series?.dataLabels
aaDatalabels?.apply {
style(AAStyle.style(AAColor.Red, 10, AAChartFontWeightType.Bold, "1px 1px contrast"))
.formatter(dataLabelsFormatter)
.backgroundColor(AAColor.White) // white color
.borderColor(AAColor.Red) // red color
.borderRadius(1.5)
.borderWidth(1.3)
.x(3).y(-20)
.verticalAlign(AAChartVerticalAlignType.Middle)
}
return aaOptions
}
//https://github.com/AAChartModel/AAChartKit-Swift/issues/404
fun configureColorfulDataLabelsForPieChart(): AAOptions {
return AAOptions()
.title(AATitle()
.text("Colorful DataLabels For Pie Chart"))
.colors(arrayOf(
"#0c9674", "#7dffc0", "#ff3333", "#facd32", "#ffffa0",
"#EA007B", "#fe117c", "#ffc069", "#06caf4", "#7dffc0"))
.series(arrayOf(
AASeriesElement()
.type(AAChartType.Pie)
.name("语言热度值")
.innerSize("20%") //内部圆环半径大小占比
.borderWidth(0) //描边的宽度
.allowPointSelect(true) //是否允许在点击数据点标记(扇形图点击选中的块发生位移)
.states(AAStates()
.hover(AAHover()
.enabled(false))) //禁用点击区块之后出现的半透明遮罩层
.dataLabels(AADataLabels()
.allowOverlap(true) //允许字符重叠
.useHTML(true)
.formatter("""
function () {
const point = this.point;
return '<span style=\"color: ' + point.color + '\">' +
point.name + ': ' + point.y + '%</span>';
}
"""))
.data(arrayOf(
arrayOf("Firefox", 3336.2),
arrayOf("IE", 26.8),
arrayOf("Chrome", 666.8),
arrayOf("Safari", 88.5),
arrayOf("Opera", 46.0),
arrayOf("Others", 223.0),
arrayOf("Firefox", 3336.2),
arrayOf("IE", 26.8),
arrayOf("Chrome", 666.8),
arrayOf("Safari", 88.5),
arrayOf("Opera", 46.0),
arrayOf("Others", 223.0)
))))
}
fun javaScriptArrayStringWithJavaArray(javaArray: Array<String>): String {
val originalJsArrStr = StringBuilder()
for (element: Any in javaArray) {
originalJsArrStr.append("'").append(element.toString()).append("',")
}
return "[$originalJsArrStr]"
}
}
@@ -0,0 +1,712 @@
/**
* ...... SOURCE CODE ......
* ...................................................
* https://github.com/AAChartModel/AAChartCore ◉◉◉
* https://github.com/AAChartModel/AAChartCore-Kotlin ◉◉◉
* ...................................................
* ...... SOURCE CODE ......
*/
/**
* -------------------------------------------------------------------------------
*
* 🌕 🌖 🌗 🌘 WARM TIPS!!! 🌑 🌒 🌓 🌔
*
* Please contact me on GitHub,if there are any problems encountered in use.
* GitHub Issues : https://github.com/AAChartModel/AAChartCore-Kotlin/issues
* -------------------------------------------------------------------------------
* And if you want to contribute for this project, please contact me as well
* GitHub : https://github.com/AAChartModel
* StackOverflow : https://stackoverflow.com/users/7842508/codeforu
* JianShu : http://www.jianshu.com/u/f1e6753d4254
* SegmentFault : https://segmentfault.com/u/huanghunbieguan
*
* -------------------------------------------------------------------------------
*/
package com.github.aachartmodel.aainfographics.demo.chartcomposer
import com.github.aachartmodel.aainfographics.aachartcreator.*
import com.github.aachartmodel.aainfographics.aaoptionsmodel.*
import com.github.aachartmodel.aainfographics.aatools.*
import java.util.*
object MixedChartComposer {
fun arearangeMixedLine(): AAChartModel {
return AAChartModel()
.title("LANGUAGE MARKET SHARES JANUARY,2020 TO MAY")
.subtitle("virtual data")
.series(arrayOf(
AASeriesElement()
.name("Temperature")
.color("#1E90FF")
.type(AAChartType.Line)
.data(arrayOf(
arrayOf(12464064, 21.5),
arrayOf(12464928, 22.1),
arrayOf(12465792, 23.0),
arrayOf(12466656, 23.8),
arrayOf(12467520, 21.4),
arrayOf(12468384, 21.3),
arrayOf(12469248, 18.3),
arrayOf(12470112, 15.4),
arrayOf(12470976, 16.4),
arrayOf(12471840, 17.7),
arrayOf(12472704, 17.5),
arrayOf(12473568, 17.6),
arrayOf(12474432, 17.7),
arrayOf(12475296, 16.8),
arrayOf(12476160, 17.7),
arrayOf(12477024, 16.3),
arrayOf(12477888, 17.8),
arrayOf(12478752, 18.1),
arrayOf(12479616, 17.2),
arrayOf(12480480, 14.4),
arrayOf(12481344, 13.7),
arrayOf(12482208, 15.7),
arrayOf(12483072, 14.6),
arrayOf(12483936, 15.3),
arrayOf(12484800, 15.3),
arrayOf(12485664, 15.8),
arrayOf(12486528, 15.2),
arrayOf(12487392, 14.8),
arrayOf(12488256, 14.4),
arrayOf(12489120, 15.0),
arrayOf(12489984, 13.6)
))
.zIndex(1),
AASeriesElement()
.name("Range")
.color("#1E90FF")
.type(AAChartType.Arearange)
.lineWidth(0f)
.fillOpacity(0.3f)
.data(arrayOf(
arrayOf(12464064, 14.3, 27.7),
arrayOf(12464928, 14.5, 27.8),
arrayOf(12465792, 15.5, 29.6),
arrayOf(12466656, 16.7, 30.7),
arrayOf(12467520, 16.5, 25.0),
arrayOf(12468384, 17.8, 25.7),
arrayOf(12469248, 13.5, 24.8),
arrayOf(12470112, 10.5, 21.4),
arrayOf(12470976, 9.20, 23.8),
arrayOf(12471840, 11.6, 21.8),
arrayOf(12472704, 10.7, 23.7),
arrayOf(12473568, 11.0, 23.3),
arrayOf(12474432, 11.6, 23.7),
arrayOf(12475296, 11.8, 20.7),
arrayOf(12476160, 12.6, 22.4),
arrayOf(12477024, 13.6, 19.6),
arrayOf(12477888, 11.4, 22.6),
arrayOf(12478752, 13.2, 25.0),
arrayOf(12479616, 14.2, 21.6),
arrayOf(12480480, 13.1, 17.1),
arrayOf(12481344, 12.2, 15.5),
arrayOf(12482208, 12.0, 20.8),
arrayOf(12483072, 12.0, 17.1),
arrayOf(12483936, 12.7, 18.3),
arrayOf(12484800, 12.4, 19.4),
arrayOf(12485664, 12.6, 19.9),
arrayOf(12486528, 11.9, 20.2),
arrayOf(12487392, 11.0, 19.3),
arrayOf(12488256, 10.8, 17.8),
arrayOf(12489120, 11.8, 18.5),
arrayOf(12489984, 10.8, 16.1)
))
.zIndex(0)))
}
fun configureColumnrangeMixedLineChart(): AAChartModel {
return AAChartModel()
.colorsTheme(arrayOf("#1e90ff", "#EA007B", "#49C1B6", "#FDC20A", "#F78320", "#068E81"))//主题颜色数组
.chartType(AAChartType.Line)
.dataLabelsEnabled(false)
.markerSymbolStyle(AAChartSymbolStyleType.BorderBlank)
.series(arrayOf(
AASeriesElement()
.name("Temperature")
.type(AAChartType.Columnrange) //COLUMN_RANGE
.data(arrayOf(
arrayOf(-9.7, 9.4),
arrayOf(-8.7, 6.5),
arrayOf(-3.5, 9.4),
arrayOf(-1.4, 19.9),
arrayOf(0.0, 22.6),
arrayOf(2.9, 29.5),
arrayOf(9.2, 30.7),
arrayOf(7.3, 26.5),
arrayOf(4.4, 18.0),
arrayOf(-3.1, 11.4),
arrayOf(-5.2, 10.4),
arrayOf(-9.9, 16.8)
)),
AASeriesElement()
.name("Tokyo")
.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)),
AASeriesElement()
.name("New York")
.data(arrayOf(0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5)),
AASeriesElement()
.name("Berlin")
.data(arrayOf(0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0)),
AASeriesElement()
.name("London")
.data(arrayOf(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8))
))
}
fun configureStackingColumnMixedLineChart(): AAChartModel {
return AAChartModel()
.title("16年1月-16年11月充值客单分析")//图形标题
.subtitle("BY MICVS")//图形副标题
.chartType(AAChartType.Column)
.stacking(AAChartStackingType.Normal)
.legendEnabled(true)
.colorsTheme(arrayOf(
AAGradientColor.OceanBlue,
AAGradientColor.Sanguine,
AAGradientColor.LusciousLime))
.series(arrayOf(
AASeriesElement()
.name("新用户")
.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()
.color(AAColor.Red)
.fontSize(11))),
AASeriesElement()
.name("老用户")
.data(arrayOf(198.66,330.81,151.95,160.12,222.56,229.05,128.53,250.91,224.47,473.99,126.85,260.50))
.dataLabels(
AADataLabels()
.enabled(true)
.style(AAStyle()
.color("#000000")
.fontSize(11))),
AASeriesElement()
.name("总量")
.type(AAChartType.Line)
.data(arrayOf(281.55,398.35,214.02,219.55,289.57,296.14,164.18,322.69,306.08,552.84,205.97,332.79))
.dataLabels(
AADataLabels()
.enabled(true)
.style(AAStyle()
.color("#000000")
.fontSize(15)
.fontWeight(AAChartFontWeightType.Bold)))))
}
fun dashStyleTypeMixedChart(): AAChartModel {
return AAChartModel()
.chartType(AAChartType.Spline)//图形类型
.dataLabelsEnabled(false)//是否显示数字
.stacking(AAChartStackingType.Normal)
.markerRadius(0)
.series(arrayOf(
AASeriesElement()
.name("SolidLine")
.lineWidth(3)
.data(arrayOf(50, 320, 230, 370, 230, 400, 320)),
AASeriesElement()
.name("Dash")
.lineWidth(3)
.dashStyle(AAChartLineDashStyleType.Dash)
.data(arrayOf(50, 320, 230, 370, 230, 400, 320)),
AASeriesElement()
.name("DashDot")
.lineWidth(3)
.dashStyle(AAChartLineDashStyleType.DashDot)
.data(arrayOf(50, 320, 230, 370, 230, 400, 320)),
AASeriesElement()
.name("LongDash")
.lineWidth(3)
.dashStyle(AAChartLineDashStyleType.LongDash)
.data(arrayOf(50, 320, 230, 370, 230, 400, 320)),
AASeriesElement()
.name("LongDashDot")
.lineWidth(3)
.dashStyle(AAChartLineDashStyleType.LongDashDot)
.data(arrayOf(50, 320, 230, 370, 230, 400, 320))
))
}
fun negativeColorMixedChart(): AAChartModel {
return AAChartModel()
.dataLabelsEnabled(false)//是否显示数字
.series(arrayOf(
AASeriesElement()
.name("Column")
.type(AAChartType.Column)
.data(arrayOf(
-6.4, -5.2, -3.0, 0.2, 2.3, 5.5, 8.4, 8.3, 5.1, 0.9, -1.1, -4.0,
-6.4, -5.2, -3.0, 0.2, 2.3, 5.5, 8.4, 8.3, 5.1, 0.9, -1.1, -4.0,
-6.4, -5.2, -3.0, 0.2, 2.3, 5.5, 8.4, 8.3, 5.1, 0.9, -1.1, -4.0
))
.color("#0088FF")
.negativeColor("#FF0000")
.threshold(4)//default:0
))
}
internal fun scatterMixedLine(): AAChartModel {
return AAChartModel()
.dataLabelsEnabled(false)//是否显示数字
.chartType(AAChartType.Scatter)
.markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
.markerSymbol(AAChartSymbolType.Circle)
.markerRadius(8)
.series(arrayOf(
AASeriesElement()
.name("Scatter")
.data(arrayOf(
arrayOf(0.067732, 3.176513),
arrayOf(0.427810, 3.816464),
arrayOf(0.995731, 4.550095),
arrayOf(0.738336, 4.256571),
arrayOf(0.981083, 4.560815),
arrayOf(0.526171, 3.929515),
arrayOf(0.378887, 3.526170),
arrayOf(0.033859, 3.156393),
arrayOf(0.132791, 3.110301),
arrayOf(0.138306, 3.149813),
arrayOf(0.247809, 3.476346),
arrayOf(0.648270, 4.119688),
arrayOf(0.731209, 4.282233),
arrayOf(0.236833, 3.486582),
arrayOf(0.969788, 4.655492),
arrayOf(0.607492, 3.965162),
arrayOf(0.358622, 3.514900),
arrayOf(0.147846, 3.125947),
arrayOf(0.637820, 4.094115),
arrayOf(0.230372, 3.476039),
arrayOf(0.070237, 3.210610),
arrayOf(0.067154, 3.190612),
arrayOf(0.925577, 4.631504),
arrayOf(0.717733, 4.295890),
arrayOf(0.015371, 3.085028),
arrayOf(0.335070, 3.448080),
arrayOf(0.040486, 3.167440),
arrayOf(0.212575, 3.364266),
arrayOf(0.617218, 3.993482),
arrayOf(0.541196, 3.891471),
arrayOf(0.045353, 3.143259),
arrayOf(0.126762, 3.114204),
arrayOf(0.556486, 3.851484),
arrayOf(0.901144, 4.621899),
arrayOf(0.958476, 4.580768),
arrayOf(0.274561, 3.620992),
arrayOf(0.394396, 3.580501),
arrayOf(0.872480, 4.618706),
arrayOf(0.409932, 3.676867),
arrayOf(0.908969, 4.641845),
arrayOf(0.166819, 3.175939),
arrayOf(0.665016, 4.264980),
arrayOf(0.263727, 3.558448),
arrayOf(0.231214, 3.436632),
arrayOf(0.552928, 3.831052),
arrayOf(0.047744, 3.182853),
arrayOf(0.365746, 3.498906),
arrayOf(0.495002, 3.946833),
arrayOf(0.493466, 3.900583),
arrayOf(0.792101, 4.238522),
arrayOf(0.769660, 4.233080),
arrayOf(0.251821, 3.521557),
arrayOf(0.181951, 3.203344),
arrayOf(0.808177, 4.278105),
arrayOf(0.334116, 3.555705),
arrayOf(0.338630, 3.502661),
arrayOf(0.452584, 3.859776),
arrayOf(0.694770, 4.275956),
arrayOf(0.590902, 3.916191),
arrayOf(0.307928, 3.587961),
arrayOf(0.148364, 3.183004),
arrayOf(0.702180, 4.225236),
arrayOf(0.721544, 4.231083),
arrayOf(0.666886, 4.240544),
arrayOf(0.124931, 3.222372),
arrayOf(0.618286, 4.021445),
arrayOf(0.381086, 3.567479),
arrayOf(0.385643, 3.562580),
arrayOf(0.777175, 4.262059),
arrayOf(0.116089, 3.208813),
arrayOf(0.115487, 3.169825),
arrayOf(0.663510, 4.193949),
arrayOf(0.254884, 3.491678),
arrayOf(0.993888, 4.533306),
arrayOf(0.295434, 3.550108),
arrayOf(0.952523, 4.636427),
arrayOf(0.307047, 3.557078),
arrayOf(0.277261, 3.552874),
arrayOf(0.279101, 3.494159),
arrayOf(0.175724, 3.206828),
arrayOf(0.156383, 3.195266),
arrayOf(0.733165, 4.221292),
arrayOf(0.848142, 4.413372),
arrayOf(0.771184, 4.184347),
arrayOf(0.429492, 3.742878),
arrayOf(0.162176, 3.201878),
arrayOf(0.917064, 4.648964),
arrayOf(0.315044, 3.510117),
arrayOf(0.201473, 3.274434),
arrayOf(0.297038, 3.579622),
arrayOf(0.336647, 3.489244),
arrayOf(0.666109, 4.237386),
arrayOf(0.583888, 3.913749),
arrayOf(0.085031, 3.228990),
arrayOf(0.687006, 4.286286),
arrayOf(0.949655, 4.628614),
arrayOf(0.189912, 3.239536),
arrayOf(0.844027, 4.457997),
arrayOf(0.333288, 3.513384),
arrayOf(0.427035, 3.729674),
arrayOf(0.466369, 3.834274),
arrayOf(0.550659, 3.811155),
arrayOf(0.278213, 3.598316),
arrayOf(0.918769, 4.692514),
arrayOf(0.886555, 4.604859),
arrayOf(0.569488, 3.864912),
arrayOf(0.066379, 3.184236),
arrayOf(0.335751, 3.500796),
arrayOf(0.426863, 3.743365),
arrayOf(0.395746, 3.622905),
arrayOf(0.694221, 4.310796),
arrayOf(0.272760, 3.583357),
arrayOf(0.503495, 3.901852),
arrayOf(0.067119, 3.233521),
arrayOf(0.038326, 3.105266),
arrayOf(0.599122, 3.865544),
arrayOf(0.947054, 4.628625),
arrayOf(0.671279, 4.231213),
arrayOf(0.434811, 3.791149),
arrayOf(0.509381, 3.968271),
arrayOf(0.749442, 4.253910),
arrayOf(0.058014, 3.194710),
arrayOf(0.482978, 3.996503),
arrayOf(0.466776, 3.904358),
arrayOf(0.357767, 3.503976),
arrayOf(0.949123, 4.557545),
arrayOf(0.417320, 3.699876),
arrayOf(0.920461, 4.613614),
arrayOf(0.156433, 3.140401),
arrayOf(0.656662, 4.206717),
arrayOf(0.616418, 3.969524),
arrayOf(0.853428, 4.476096),
arrayOf(0.133295, 3.136528),
arrayOf(0.693007, 4.279071),
arrayOf(0.178449, 3.200603),
arrayOf(0.199526, 3.299012),
arrayOf(0.073224, 3.209873),
arrayOf(0.286515, 3.632942),
arrayOf(0.182026, 3.248361),
arrayOf(0.621523, 3.995783),
arrayOf(0.344584, 3.563262),
arrayOf(0.398556, 3.649712),
arrayOf(0.480369, 3.951845),
arrayOf(0.153350, 3.145031),
arrayOf(0.171846, 3.181577),
arrayOf(0.867082, 4.637087),
arrayOf(0.223855, 3.404964),
arrayOf(0.528301, 3.873188),
arrayOf(0.890192, 4.633648),
arrayOf(0.106352, 3.154768),
arrayOf(0.917886, 4.623637),
arrayOf(0.014855, 3.078132),
arrayOf(0.567682, 3.913596),
arrayOf(0.068854, 3.221817),
arrayOf(0.603535, 3.938071),
arrayOf(0.532050, 3.880822),
arrayOf(0.651362, 4.176436),
arrayOf(0.901225, 4.648161),
arrayOf(0.204337, 3.332312),
arrayOf(0.696081, 4.240614),
arrayOf(0.963924, 4.532224),
arrayOf(0.981390, 4.557105),
arrayOf(0.987911, 4.610072),
arrayOf(0.990947, 4.636569),
arrayOf(0.736021, 4.229813),
arrayOf(0.253574, 3.500860),
arrayOf(0.674722, 4.245514),
arrayOf(0.939368, 4.605182),
arrayOf(0.235419, 3.454340),
arrayOf(0.110521, 3.180775),
arrayOf(0.218023, 3.380820),
arrayOf(0.869778, 4.565020),
arrayOf(0.196830, 3.279973),
arrayOf(0.958178, 4.554241),
arrayOf(0.972673, 4.633520),
arrayOf(0.745797, 4.281037),
arrayOf(0.445674, 3.844426),
arrayOf(0.470557, 3.891601),
arrayOf(0.549236, 3.849728),
arrayOf(0.335691, 3.492215),
arrayOf(0.884739, 4.592374),
arrayOf(0.918916, 4.632025),
arrayOf(0.441815, 3.756750),
arrayOf(0.116598, 3.133555),
arrayOf(0.359274, 3.567919),
arrayOf(0.814811, 4.363382),
arrayOf(0.387125, 3.560165),
arrayOf(0.982243, 4.564305),
arrayOf(0.780880, 4.215055),
arrayOf(0.652565, 4.174999),
arrayOf(0.870030, 4.586640),
arrayOf(0.604755, 3.960008),
arrayOf(0.255212, 3.529963),
arrayOf(0.730546, 4.213412),
arrayOf(0.493829, 3.908685),
arrayOf(0.257017, 3.585821),
arrayOf(0.833735, 4.374394),
arrayOf(0.070095, 3.213817),
arrayOf(0.527070, 3.952681),
arrayOf(0.116163, 3.129283)
))
.color("#0088FF"),
AASeriesElement()
.name("线性回归线")
.type(AAChartType.Line)
.data(arrayOf(
arrayOf(0.014, 3.078),
arrayOf(0.969, 4.655)))
.color("#FF0000")))
}
internal fun negativeColorMixedBubble(): AAChartModel {
return AAChartModel()
.categories(arrayOf("Saturday", "Friday", "Thursday", "Wednesday", "Tuesday", "Monday", "Sunday"))
.series(arrayOf(
AASeriesElement()
.name("Bubble")
.type(AAChartType.Bubble)
.data(arrayOf(
arrayOf(0,0,5),arrayOf(0,1,1),arrayOf(0,2,0),arrayOf(0,3,0),arrayOf(0,4,0),arrayOf(0,5,0),arrayOf(0,6,0),arrayOf(0,7,0),arrayOf(0,8,0),arrayOf(0,9,0),
arrayOf(0,10,0),arrayOf(0,11,2),arrayOf(0,12,4),arrayOf(0,13,1),arrayOf(0,14,1),arrayOf(0,15,3),arrayOf(0,16,4),arrayOf(0,17,6),arrayOf(0,18,4),
arrayOf(0,19,4),arrayOf(0,20,3),arrayOf(0,21,3),arrayOf(0,22,2),arrayOf(0,23,5),arrayOf(1,0,7),arrayOf(1,1,0),arrayOf(1,2,0),arrayOf(1,3,0),
arrayOf(1,4,0),arrayOf(1,5,0),arrayOf(1,6,0),arrayOf(1,7,0),arrayOf(1,8,0),arrayOf(1,9,0),arrayOf(1,10,5),arrayOf(1,11,2),arrayOf(1,12,2),
arrayOf(1,13,6),arrayOf(1,14,9),arrayOf(1,15,11),arrayOf(1,16,6),arrayOf(1,17,7),arrayOf(1,18,8),arrayOf(1,19,12),arrayOf(1,20,5),arrayOf(1,21,5),
arrayOf(1,22,7),arrayOf(1,23,2),arrayOf(2,0,1),arrayOf(2,1,1),arrayOf(2,2,0),arrayOf(2,3,0),arrayOf(2,4,0),arrayOf(2,5,0),arrayOf(2,6,0),arrayOf(2,7,0),
arrayOf(2,8,0),arrayOf(2,9,0),arrayOf(2,10,3),arrayOf(2,11,2),arrayOf(2,12,1),arrayOf(2,13,9),arrayOf(2,14,8),arrayOf(2,15,10),arrayOf(2,16,6),
arrayOf(2,17,5),arrayOf(2,18,5),arrayOf(2,19,5),arrayOf(2,20,7),arrayOf(2,21,4),arrayOf(2,22,2),arrayOf(2,23,4),arrayOf(3,0,7),arrayOf(3,1,3),
arrayOf(3,2,0),arrayOf(3,3,0),arrayOf(3,4,0),arrayOf(3,5,0),arrayOf(3,6,0),arrayOf(3,7,0),arrayOf(3,8,1),arrayOf(3,9,0),arrayOf(3,10,5),arrayOf(3,11,4),
arrayOf(3,12,7),arrayOf(3,13,14),arrayOf(3,14,13),arrayOf(3,15,12),arrayOf(3,16,9),arrayOf(3,17,5),arrayOf(3,18,5),arrayOf(3,19,10),
arrayOf(3,20,6),arrayOf(3,21,4),arrayOf(3,22,4),arrayOf(3,23,1),arrayOf(4,0,1),arrayOf(4,1,3),arrayOf(4,2,0),arrayOf(4,3,0),arrayOf(4,4,0),
arrayOf(4,5,1),arrayOf(4,6,0),arrayOf(4,7,0),arrayOf(4,8,0),arrayOf(4,9,2),arrayOf(4,10,4),arrayOf(4,11,4),arrayOf(4,12,2),arrayOf(4,13,4),
arrayOf(4,14,4),arrayOf(4,15,14),arrayOf(4,16,12),arrayOf(4,17,1),arrayOf(4,18,8),arrayOf(4,19,5),arrayOf(4,20,3),arrayOf(4,21,7),arrayOf(4,22,3),
arrayOf(4,23,0),arrayOf(5,0,2),arrayOf(5,1,1),arrayOf(5,2,0),arrayOf(5,3,3),arrayOf(5,4,0),arrayOf(5,5,0),arrayOf(5,6,0),arrayOf(5,7,0),arrayOf(5,8,2),
arrayOf(5,9,0),arrayOf(5,10,4),arrayOf(5,11,1),arrayOf(5,12,5),arrayOf(5,13,10),arrayOf(5,14,5),arrayOf(5,15,7),arrayOf(5,16,11),arrayOf(5,17,6),
arrayOf(5,18,0),arrayOf(5,19,5),arrayOf(5,20,3),arrayOf(5,21,4),arrayOf(5,22,2),arrayOf(5,23,0),arrayOf(6,0,1),arrayOf(6,1,0),arrayOf(6,2,0),
arrayOf(6,3,0),arrayOf(6,4,0),arrayOf(6,5,0),arrayOf(6,6,0),arrayOf(6,7,0),arrayOf(6,8,0),arrayOf(6,9,0),arrayOf(6,10,1),arrayOf(6,11,0),arrayOf(6,12,2),
arrayOf(6,13,1),arrayOf(6,14,3),arrayOf(6,15,4),arrayOf(6,16,0),arrayOf(6,17,0),arrayOf(6,18,0),arrayOf(6,19,0),arrayOf(6,20,1),arrayOf(6,21,2),
arrayOf(6,22,2),arrayOf(6,23,6)
))
.color("#0088FF")
.negativeColor("#FF0000")
.threshold(4)//default:0
))
}
internal fun polygonMixedScatter(): AAChartModel {
return AAChartModel()
.series(arrayOf(
AASeriesElement()
.name("目标")
.type(AAChartType.Polygon)
.data(arrayOf(
arrayOf(153, 42), arrayOf(149, 46), arrayOf(149, 55), arrayOf(152, 60), arrayOf(159, 70), arrayOf(170, 77), arrayOf(180, 70),
arrayOf(180, 60), arrayOf(173, 52), arrayOf(166, 45)
)),
AASeriesElement()
.name("实际值")
.type(AAChartType.Scatter)
.data(arrayOf(
arrayOf(161.2, 51.6), arrayOf(167.5, 59.0), arrayOf(159.5, 49.2), arrayOf(157.0, 63.0), arrayOf(155.8, 53.6),
arrayOf(170.0, 59.0), arrayOf(159.1, 47.6), arrayOf(166.0, 69.8), arrayOf(176.2, 66.8), arrayOf(160.2, 75.2),
arrayOf(172.5, 55.2), arrayOf(170.9, 54.2), arrayOf(172.9, 62.5), arrayOf(153.4, 42.0), arrayOf(160.0, 50.0),
arrayOf(147.2, 49.8), arrayOf(168.2, 49.2), arrayOf(175.0, 73.2), arrayOf(157.0, 47.8), arrayOf(167.6, 68.8),
arrayOf(159.5, 50.6), arrayOf(175.0, 82.5), arrayOf(166.8, 57.2), arrayOf(176.5, 87.8), arrayOf(170.2, 72.8),
arrayOf(174.0, 54.5), arrayOf(173.0, 59.8), arrayOf(179.9, 67.3), arrayOf(170.5, 67.8), arrayOf(160.0, 47.0),
arrayOf(154.4, 46.2), arrayOf(162.0, 55.0), arrayOf(176.5, 83.0), arrayOf(160.0, 54.4), arrayOf(152.0, 45.8),
arrayOf(162.1, 53.6), arrayOf(170.0, 73.2), arrayOf(160.2, 52.1), arrayOf(161.3, 67.9), arrayOf(166.4, 56.6),
arrayOf(168.9, 62.3), arrayOf(163.8, 58.5), arrayOf(167.6, 54.5), arrayOf(160.0, 50.2), arrayOf(161.3, 60.3),
arrayOf(167.6, 58.3), arrayOf(165.1, 56.2), arrayOf(160.0, 50.2), arrayOf(170.0, 72.9), arrayOf(157.5, 59.8),
arrayOf(167.6, 61.0), arrayOf(160.7, 69.1), arrayOf(163.2, 55.9), arrayOf(152.4, 46.5), arrayOf(157.5, 54.3),
arrayOf(168.3, 54.8), arrayOf(180.3, 60.7), arrayOf(165.5, 60.0), arrayOf(165.0, 62.0), arrayOf(164.5, 60.3),
arrayOf(156.0, 52.7), arrayOf(160.0, 74.3), arrayOf(163.0, 62.0), arrayOf(165.7, 73.1), arrayOf(161.0, 80.0),
arrayOf(162.0, 54.7), arrayOf(166.0, 53.2), arrayOf(174.0, 75.7), arrayOf(172.7, 61.1), arrayOf(167.6, 55.7),
arrayOf(151.1, 48.7), arrayOf(164.5, 52.3), arrayOf(163.5, 50.0), arrayOf(152.0, 59.3), arrayOf(169.0, 62.5),
arrayOf(164.0, 55.7), arrayOf(161.2, 54.8), arrayOf(155.0, 45.9), arrayOf(170.0, 70.6), arrayOf(176.2, 67.2),
arrayOf(170.0, 69.4), arrayOf(162.5, 58.2), arrayOf(170.3, 64.8), arrayOf(164.1, 71.6), arrayOf(169.5, 52.8),
arrayOf(163.2, 59.8), arrayOf(154.5, 49.0), arrayOf(159.8, 50.0), arrayOf(173.2, 69.2), arrayOf(170.0, 55.9),
arrayOf(161.4, 63.4), arrayOf(169.0, 58.2), arrayOf(166.2, 58.6), arrayOf(159.4, 45.7), arrayOf(162.5, 52.2),
arrayOf(159.0, 48.6), arrayOf(162.8, 57.8), arrayOf(159.0, 55.6), arrayOf(179.8, 66.8), arrayOf(162.9, 59.4),
arrayOf(161.0, 53.6), arrayOf(151.1, 73.2), arrayOf(168.2, 53.4), arrayOf(168.9, 69.0), arrayOf(173.2, 58.4),
arrayOf(171.8, 56.2), arrayOf(178.0, 70.6), arrayOf(164.3, 59.8), arrayOf(163.0, 72.0), arrayOf(168.5, 65.2),
arrayOf(166.8, 56.6), arrayOf(172.7, 105 ), arrayOf(163.5, 51.8), arrayOf(169.4, 63.4), arrayOf(167.8, 59.0),
arrayOf(159.5, 47.6), arrayOf(167.6, 63.0), arrayOf(161.2, 55.2), arrayOf(160.0, 45.0), arrayOf(163.2, 54.0),
arrayOf(162.2, 50.2), arrayOf(161.3, 60.2), arrayOf(149.5, 44.8), arrayOf(157.5, 58.8), arrayOf(163.2, 56.4),
arrayOf(172.7, 62.0), arrayOf(155.0, 49.2), arrayOf(156.5, 67.2), arrayOf(164.0, 53.8), arrayOf(160.9, 54.4),
arrayOf(162.8, 58.0), arrayOf(167.0, 59.8), arrayOf(160.0, 54.8), arrayOf(160.0, 43.2), arrayOf(168.9, 60.5),
arrayOf(158.2, 46.4), arrayOf(156.0, 64.4), arrayOf(160.0, 48.8), arrayOf(167.1, 62.2), arrayOf(158.0, 55.5),
arrayOf(167.6, 57.8), arrayOf(156.0, 54.6), arrayOf(162.1, 59.2), arrayOf(173.4, 52.7), arrayOf(159.8, 53.2),
arrayOf(170.5, 64.5), arrayOf(159.2, 51.8), arrayOf(157.5, 56.0), arrayOf(161.3, 63.6), arrayOf(162.6, 63.2),
arrayOf(160.0, 59.5), arrayOf(168.9, 56.8), arrayOf(165.1, 64.1), arrayOf(162.6, 50.0), arrayOf(165.1, 72.3),
arrayOf(166.4, 55.0), arrayOf(160.0, 55.9), arrayOf(152.4, 60.4), arrayOf(170.2, 69.1), arrayOf(162.6, 84.5),
arrayOf(170.2, 55.9), arrayOf(158.8, 55.5), arrayOf(172.7, 69.5), arrayOf(167.6, 76.4), arrayOf(162.6, 61.4),
arrayOf(167.6, 65.9), arrayOf(156.2, 58.6), arrayOf(175.2, 66.8), arrayOf(172.1, 56.6), arrayOf(162.6, 58.6),
arrayOf(160.0, 55.9), arrayOf(165.1, 59.1), arrayOf(182.9, 81.8), arrayOf(166.4, 70.7), arrayOf(165.1, 56.8),
arrayOf(177.8, 60.0), arrayOf(165.1, 58.2), arrayOf(175.3, 72.7), arrayOf(154.9, 54.1), arrayOf(158.8, 49.1),
arrayOf(172.7, 75.9), arrayOf(168.9, 55.0), arrayOf(161.3, 57.3), arrayOf(167.6, 55.0), arrayOf(165.1, 65.5),
arrayOf(175.3, 65.5), arrayOf(157.5, 48.6), arrayOf(163.8, 58.6), arrayOf(167.6, 63.6), arrayOf(165.1, 55.2),
arrayOf(165.1, 62.7), arrayOf(168.9, 56.6), arrayOf(162.6, 53.9), arrayOf(164.5, 63.2), arrayOf(176.5, 73.6),
arrayOf(168.9, 62.0), arrayOf(175.3, 63.6), arrayOf(159.4, 53.2), arrayOf(160.0, 53.4), arrayOf(170.2, 55.0),
arrayOf(162.6, 70.5), arrayOf(167.6, 54.5), arrayOf(162.6, 54.5), arrayOf(160.7, 55.9), arrayOf(160.0, 59.0),
arrayOf(157.5, 63.6), arrayOf(162.6, 54.5), arrayOf(152.4, 47.3), arrayOf(170.2, 67.7), arrayOf(165.1, 80.9),
arrayOf(172.7, 70.5), arrayOf(165.1, 60.9), arrayOf(170.2, 63.6), arrayOf(170.2, 54.5), arrayOf(170.2, 59.1),
arrayOf(161.3, 70.5), arrayOf(167.6, 52.7), arrayOf(167.6, 62.7), arrayOf(165.1, 86.3), arrayOf(162.6, 66.4),
arrayOf(152.4, 67.3), arrayOf(168.9, 63.0), arrayOf(170.2, 73.6), arrayOf(175.2, 62.3), arrayOf(175.2, 57.7),
arrayOf(160.0, 55.4), arrayOf(165.1, 104 ), arrayOf(174.0, 55.5), arrayOf(170.2, 77.3), arrayOf(160.0, 80.5),
arrayOf(167.6, 64.5), arrayOf(167.6, 72.3), arrayOf(167.6, 61.4), arrayOf(154.9, 58.2), arrayOf(162.6, 81.8),
arrayOf(175.3, 63.6), arrayOf(171.4, 53.4), arrayOf(157.5, 54.5), arrayOf(165.1, 53.6), arrayOf(160.0, 60.0),
arrayOf(174.0, 73.6), arrayOf(162.6, 61.4), arrayOf(174.0, 55.5), arrayOf(162.6, 63.6), arrayOf(161.3, 60.9),
arrayOf(156.2, 60.0), arrayOf(149.9, 46.8), arrayOf(169.5, 57.3), arrayOf(160.0, 64.1), arrayOf(175.3, 63.6),
arrayOf(169.5, 67.3), arrayOf(160.0, 75.5), arrayOf(172.7, 68.2), arrayOf(162.6, 61.4), arrayOf(157.5, 76.8),
arrayOf(176.5, 71.8), arrayOf(164.4, 55.5), arrayOf(160.7, 48.6), arrayOf(174.0, 66.4), arrayOf(163.8, 67.3)
))))
}
fun polarChartMixedChart(): AAChartModel {
return AAChartModel()
.chartType(AAChartType.Column)
.polar(true)
.series(arrayOf(
AASeriesElement()
.name("Column")
.type(AAChartType.Column)
.data(arrayOf(8, 7, 6, 5, 4, 3, 2, 1)),
AASeriesElement()
.name("Line")
.type(AAChartType.Line)
.data(arrayOf(1, 2, 3, 4, 5, 6, 7, 8)),
AASeriesElement()
.name("Area")
.type(AAChartType.Area)
.data(arrayOf(1, 8, 2, 7, 3, 6, 4, 5))
))
}
fun configurePieMixedLineMixedColumnChart(): AAChartModel {
val columnElement1 = AASeriesElement()
.name("Anna")
.type(AAChartType.Column)
.data(arrayOf(3, 2, 1, 3, 4))
val columnElement2 = AASeriesElement()
.name("Babara")
.type(AAChartType.Column)
.data(arrayOf(2, 3, 5, 7, 6))
val columnElement3 = AASeriesElement()
.name("Coco")
.type(AAChartType.Column)
.data(arrayOf(4, 3, 3, 9, 0))
val lineElement = AASeriesElement()
.name("average value")
.type(AAChartType.Line)
.data(arrayOf(3, 2.67, 3, 6.33, 3.33))
.marker(AAMarker()
.fillColor("#1E90FF")
.lineWidth(2.0)
.lineColor(AAColor.White
))
val pieElement = AAPie()
.type(AAChartType.Pie)
.center(arrayOf(100, 80))
.size(100)
.showInLegend(true)
.dataLabels(AADataLabels()
.enabled(false))
.data(arrayOf(
AADataElement()
.name("Ada")
.y(13.0)
.color(AAGradientColor.OceanBlue)
,
AADataElement()
.name("Bob")
.y(13.0)
.color(AAGradientColor.Sanguine)
,
AADataElement()
.name("Coco")
.y(13.0)
.color(AAGradientColor.PurpleLake)
))
return AAChartModel()
.stacking(AAChartStackingType.Normal)
.colorsTheme(arrayOf(
"#fe117c", "#ffc069", "#06caf4", "#7dffc0"
))
.dataLabelsEnabled(false)
.series(arrayOf(
columnElement1,
columnElement2,
columnElement3,
lineElement,
pieElement
))
}
//GitHub issue https://github.com/AAChartModel/AAChartKit/issues/921
fun configureNegativeColorMixedAreasplineChart(): AAChartModel {
val blueStopsArr: Array<Any> = arrayOf(
arrayOf(0.0, AARgba(30, 144, 255, 0.0f)),
arrayOf(0.5, AARgba(30, 144, 255, 0.0f)),
arrayOf(1.0, AARgba(30, 144, 255, 0.6f))
)
val gradientBlueColorDic = AAGradientColor.linearGradient(
AALinearGradientDirection.ToTop,
blueStopsArr
)
val redStopsArr: Array<Any> = arrayOf(
arrayOf(0.0, AARgba(255, 0, 0, 0.6f)),
arrayOf(0.5, AARgba(255, 0, 0, 0.0f)),
arrayOf(1.0, AARgba(255, 0, 0, 0.0f))
)
val gradientRedColorDic = AAGradientColor.linearGradient(
AALinearGradientDirection.ToTop,
redStopsArr
)
return AAChartModel()
.chartType(AAChartType.Area)
.legendEnabled(false)
.dataLabelsEnabled(false)
.markerRadius(5)
.markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
.yAxisGridLineWidth(0)
.series(arrayOf(
AASeriesElement()
.name("Column")
.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,
-7.0, -6.9, -2.5, -14.5, -18.2, -21.5, -5.2, -26.5, -23.3, -45.3, -13.9, -9.6
))
.lineWidth(5)
.color(AARgba(30, 144, 255, 1.0f))
.negativeColor(AARgba(255, 0, 0, 1.0f))
.fillColor(gradientBlueColorDic)
.negativeFillColor(gradientRedColorDic)
.threshold(0) //default:0
))
}
}
@@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/aaChartCoreThemeColor"
tools:context=".basiccontent.BasicChartActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="170dp"
android:background="@color/aaChartCoreThemeColor"
android:orientation="vertical">
<RadioGroup
android:id="@+id/stackingTypeRadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/noStackingRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="noStacking" />
<RadioButton
android:id="@+id/normalStackingRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="normalStacking" />
<RadioButton
android:id="@+id/percentStackingRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="percentStacking" />
</RadioGroup>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cornerStyleTypeRadioGroup"
android:orientation="horizontal">
<RadioButton
android:id="@+id/squareCornersRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="square\ncorners" />
<RadioButton
android:id="@+id/roundedCornersRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="rounded\ncorners" />
<RadioButton
android:id="@+id/wedgeCornersRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="wedge\ncorners" />
</RadioGroup>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="38dp"
android:id="@+id/markerSymbolTypeRadioGroup"
android:orientation="horizontal">
<RadioButton
android:id="@+id/circleSymbolRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:textSize="22dp"
android:text="⬤⬤" />
<RadioButton
android:id="@+id/squareSymbolRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:textSize="22dp"
android:text="■■" />
<RadioButton
android:id="@+id/diamondSymbolRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:textSize="22dp"
android:text="◆◆" />
<RadioButton
android:id="@+id/triangleSymbolRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:textSize="22dp"
android:text="▲▲" />
<RadioButton
android:id="@+id/triangleDownSymbolRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:textSize="22dp"
android:text="▼▼" />
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Switch
android:id="@+id/xReversedSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/yReversedSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/xInvertedSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/polarSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/dataShowSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/markerHideSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="xReversed"
android:textColor="@color/mediumGray" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="yReversed"
android:textColor="@color/mediumGray" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="xInverted"
android:textColor="@color/mediumGray" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="polarization"
android:textColor="@color/mediumGray" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="dataShow"
android:textColor="@color/mediumGray" />
<TextView
android:id="@+id/markerHideTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/lightGray"
android:text="markerHide" />
</LinearLayout>
</LinearLayout>
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/aaChartCoreThemeColor" />
</LinearLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".basiccontent.CustomStyleChartActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.JSFormatterFunctionActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.DoubleChartsLinkedWorkActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="1dp"
android:layout_marginEnd="1dp"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.DrawChartWithAAOptionsActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.EvaluateJSStringFunctionActivity">
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="137dp"
android:layout_marginLeft="137dp"
android:layout_marginTop="200dp"
android:text="TextView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.HideOrShowChartSeriesActivity">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="282dp"
android:text="暂无内容"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.JSFunctionForAAChartEventsActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".basiccontent.MainActivity">
<ExpandableListView
android:id="@+id/exlist_lol"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:childDivider="#D5D5D5"/>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".basiccontent.MixedChartActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.OnlyRefreshChartDataActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.ScrollableChartActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".additionalcontent.ScrollingUpdateDataActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".basiccontent.SpecialChartActivity">
<com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
android:id="@+id/AAChartView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="@+id/tv_group_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:gravity="center_vertical"
android:paddingLeft="30dp"
android:text="AP"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
/>
</LinearLayout>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="5dp"
android:background="#ffffff">
<TextView
android:id="@+id/tv_color_dot"
android:layout_width="48dp"
android:layout_height="match_parent"
android:textSize="28dp"
android:text="◉"
android:gravity="center_vertical|center"
></TextView>
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:focusable="false"
android:text="图表名称"
android:gravity="center_vertical|left"
android:textSize="18sp"
android:textColor="#123456"
/>
</LinearLayout>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="green">#41c574</color>
<color name="blue">#5992d2</color>
<color name="brown">#EAA033</color>
<color name="red">#D7063B</color>
<color name="gray">#F2F2F2</color>
<color name="lightGray">#F4F3F3</color>
<color name="lightBlack">#333333</color>
<color name="mediumGray">#666666</color>
<color name="aaChartCoreThemeColor">#4b2b7f</color>
</resources>
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">AAInfographics</string>
</resources>
@@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>