Skip to content

Commit 03befc5

Browse files
committed
Refactor axis title conversion in AAYAxis
Simplified the conversion from AATitle to AAAxisTitle in AAYAxis by directly mapping properties, improving code clarity and maintainability.
1 parent b26e322 commit 03befc5

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ open class AAXAxis: AAAxis() {
3030
return this
3131
}
3232

33-
3433
// 为了保持向后兼容性,添加对 AATitle 的支持
3534
// 同时添加方法废弃警告⚠️, 提示用户使用新的 AAAxisTitle 类型
3635
@Deprecated("Use `fun title(prop: AAAxisTitle): AAXAxis` instead. AATitle is deprecated for axis titles.")

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,19 @@ open class AAYAxis: AAAxis() {
3636
return this
3737
}
3838

39+
3940
// 为了保持向后兼容性,添加对 AATitle 的支持
4041
// 同时添加方法废弃警告⚠️, 提示用户使用新的 AAAxisTitle 类型
4142
@Deprecated("Use `fun title(prop: AAAxisTitle): AAYAxis` instead. AATitle is deprecated for axis titles.")
4243
fun title(prop: AATitle?): AAYAxis {
4344
if (prop != null) {
44-
// 将AATitle转换为AAAxisTitle
45+
// 将 AATitle 转换为 AAAxisTitle
4546
val axisTitle = AAAxisTitle()
4647
.text(prop.text)
4748
.style(prop.style)
48-
49-
// 如果AATitle有x和y属性, 也将它们设置到AAAxisTitle中
50-
prop.x?.let { x ->
51-
axisTitle.x(x)
52-
}
53-
prop.y?.let { y ->
54-
axisTitle.y(y)
55-
}
49+
.x(prop.x)
50+
.y(prop.y)
51+
.useHTML(prop.useHTML)
5652

5753
title = axisTitle
5854
} else {

0 commit comments

Comments
 (0)