Skip to content

Commit c32700e

Browse files
committed
Add AAAxisTitle model for axis title options
Introduces AAAxisTitle class and AAChartAxisTitleAlignValueType enum to represent axis title configuration options for charts, including alignment, margin, offset, rotation, style, text, and HTML rendering support.
1 parent ea9b101 commit c32700e

File tree

1 file changed

+76
-0
lines changed
  • charts/src/main/java/com/github/aachartmodel/aainfographics/aaoptionsmodel

1 file changed

+76
-0
lines changed
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+
}

0 commit comments

Comments
 (0)