Skip to content

Commit 961b4ac

Browse files
authored
Merge pull request #257 from AAChartModel/dev
Dev
2 parents 05c9064 + 48b679c commit 961b4ac

29 files changed

+871
-42
lines changed

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
buildscript {
22
repositories {
3+
maven { url = uri("https://maven.aliyun.com/repository/google") }
4+
maven { url = uri("https://maven.aliyun.com/repository/central") }
35
google()
46
mavenCentral()
57
}
@@ -19,6 +21,8 @@ plugins {
1921

2022
allprojects {
2123
repositories {
24+
maven { url = uri("https://maven.aliyun.com/repository/google") }
25+
maven { url = uri("https://maven.aliyun.com/repository/central") }
2226
google()
2327
mavenCentral()
2428
maven(url = "https://jitpack.io")

buildSrc/src/main/java/Constants.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Versions {
1515

1616
const val bintray_version = "1.8.5"
1717
const val kotlin_stdlib_version = "1.4.10"
18-
const val gson_version = "2.10.1"
18+
const val gson_version = "2.11.0"
1919
}
2020

2121
object Libs {

charts/src/main/assets/AAEasing.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AAAxis.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ enum class AAChartAxisType(val value: String) {
1212
var allowDecimals: Boolean? = null
1313
var alternateGridColor: Any? = null
1414
var crosshair: AACrosshair? = null //准星线样式设置
15-
var title: AATitle? = null
15+
var title: AAAxisTitle? = null
1616
var type: String? = null
1717
var dateTimeLabelFormats: AADateTimeLabelFormats? = null
1818
var plotBands: Array<AAPlotBandsElement>? = null
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.github.aachartmodel.aainfographics.aaoptionsmodel
2+
3+
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartAlignType
4+
5+
// https://api.highcharts.com/highcharts/xAxis.title.align
6+
// https://api.highcharts.com/highcharts/yAxis.title.align
7+
enum class AAChartAxisTitleAlignValueType(val value: String) {
8+
High("high"),
9+
Low("low"),
10+
Middle("middle")
11+
}
12+
13+
// https://api.highcharts.com/highcharts/xAxis.title
14+
// https://api.highcharts.com/highcharts/yAxis.title
15+
class AAAxisTitle {
16+
var align: String? = null
17+
var margin: String? = null
18+
var offset: Number? = null
19+
var rotation: Number? = null
20+
var style: AAStyle? = null
21+
var text: String? = null
22+
var textAlign: String? = null
23+
var useHTML: Boolean? = null // 是否使用 HTML 渲染标题
24+
var x: Number? = null // 标题相对于水平对齐的偏移量,取值范围为:图表左边距到图表右边距,可以是负值,单位px。 默认是:0.
25+
var y: Number? = null // 标题相对于垂直对齐的偏移量,取值范围:图表的上边距(chart.spacingTop )到图表的下边距(chart.spacingBottom),可以是负值,单位是px。默认值和字体大小有关。
26+
27+
fun align(prop: AAChartAxisTitleAlignValueType?): AAAxisTitle {
28+
align = prop?.value
29+
return this
30+
}
31+
32+
fun margin(prop: String?): AAAxisTitle {
33+
margin = prop
34+
return this
35+
}
36+
37+
fun offset(prop: Number?): AAAxisTitle {
38+
offset = prop
39+
return this
40+
}
41+
42+
fun rotation(prop: Number?): AAAxisTitle {
43+
rotation = prop
44+
return this
45+
}
46+
47+
fun style(prop: AAStyle?): AAAxisTitle {
48+
style = prop
49+
return this
50+
}
51+
52+
fun text(prop: String?): AAAxisTitle {
53+
text = prop
54+
return this
55+
}
56+
57+
fun textAlign(prop: AAChartAlignType?): AAAxisTitle {
58+
textAlign = prop?.value
59+
return this
60+
}
61+
62+
fun useHTML(prop: Boolean?): AAAxisTitle {
63+
useHTML = prop
64+
return this
65+
}
66+
67+
fun x(prop: Number?): AAAxisTitle {
68+
x = prop
69+
return this
70+
}
71+
72+
fun y(prop: Number?): AAAxisTitle {
73+
y = prop
74+
return this
75+
}
76+
}

charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AASubtitle.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import com.github.aachartmodel.aainfographics.aachartcreator.AAChartVerticalAlig
1313

1414

1515
class AASubtitle {
16-
private var text: String? = null
17-
private var style: AAStyle? = null
18-
private var align: String? = null
19-
private var verticalAlign: String? = null
20-
private var x: Number? = null
21-
private var y: Number? = null
22-
private var userHTML: Boolean? = null
16+
var text: String? = null
17+
var style: AAStyle? = null
18+
var align: String? = null
19+
var verticalAlign: String? = null
20+
var x: Number? = null
21+
var y: Number? = null
22+
var userHTML: Boolean? = null
2323

2424
fun text(prop: String?): AASubtitle {
2525
text = prop

charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AATitle.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import com.github.aachartmodel.aainfographics.aachartcreator.AAChartAlignType
1212
import com.github.aachartmodel.aainfographics.aachartcreator.AAChartVerticalAlignType
1313

1414
class AATitle {
15-
private var text: String? = null
16-
private var style: AAStyle? = null
17-
private var align: String? = null
18-
private var verticalAlign: String? = null
19-
private var x: Number? = null
20-
private var y: Number? = null
21-
private var userHTML: Boolean? = null
15+
var text: String? = null
16+
var style: AAStyle? = null
17+
var align: String? = null
18+
var verticalAlign: String? = null
19+
var x: Number? = null
20+
var y: Number? = null
21+
var useHTML: Boolean? = null
2222

2323
fun text(prop: String?): AATitle {
2424
text = prop
@@ -50,8 +50,8 @@ class AATitle {
5050
return this
5151
}
5252

53-
fun userHTML(prop: Boolean?): AATitle {
54-
userHTML = prop
53+
fun useHTML(prop: Boolean?): AATitle {
54+
useHTML = prop
5555
return this
5656
}
5757
}

charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AAXAxis.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,31 @@ open class AAXAxis: AAAxis() {
2525
return this
2626
}
2727

28-
fun title(prop: AATitle): AAXAxis {
28+
fun title(prop: AAAxisTitle): AAXAxis {
2929
title = prop
3030
return this
3131
}
3232

33+
// 为了保持向后兼容性,添加对 AATitle 的支持
34+
// 同时添加方法废弃警告⚠️, 提示用户使用新的 AAAxisTitle 类型
35+
@Deprecated("Use `fun title(prop: AAAxisTitle): AAXAxis` instead. AATitle is deprecated for axis titles.")
36+
fun title(prop: AATitle?): AAXAxis {
37+
if (prop != null) {
38+
// 将 AATitle 转换为 AAAxisTitle
39+
val axisTitle = AAAxisTitle()
40+
.text(prop.text)
41+
.style(prop.style)
42+
.x(prop.x)
43+
.y(prop.y)
44+
.useHTML(prop.useHTML)
45+
46+
title = axisTitle
47+
} else {
48+
title = null
49+
}
50+
return this
51+
}
52+
3353
fun type(prop: AAChartAxisType): AAXAxis {
3454
type = prop.value
3555
return this

charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel/AAYAxis.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,31 @@ open class AAYAxis: AAAxis() {
3131
return this
3232
}
3333

34-
fun title(prop: AATitle): AAYAxis {
34+
fun title(prop: AAAxisTitle): AAYAxis {
3535
title = prop
3636
return this
3737
}
3838

39+
// 为了保持向后兼容性,添加对 AATitle 的支持
40+
// 同时添加方法废弃警告⚠️, 提示用户使用新的 AAAxisTitle 类型
41+
@Deprecated("Use `fun title(prop: AAAxisTitle): AAYAxis` instead. AATitle is deprecated for axis titles.")
42+
fun title(prop: AATitle?): AAYAxis {
43+
if (prop != null) {
44+
// 将 AATitle 转换为 AAAxisTitle
45+
val axisTitle = AAAxisTitle()
46+
.text(prop.text)
47+
.style(prop.style)
48+
.x(prop.x)
49+
.y(prop.y)
50+
.useHTML(prop.useHTML)
51+
52+
title = axisTitle
53+
} else {
54+
title = null
55+
}
56+
return this
57+
}
58+
3959
fun type(prop: AAChartAxisType): AAYAxis {
4060
type = prop.value
4161
return this
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.6-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
5-
zipStorePath=wrapper/dists
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)