Skip to content

Commit 905c516

Browse files
authored
Merge pull request #4 from ant-mini-program/htAlign
feat: add `htAlign` config to xAxis.
2 parents 030669c + 8471353 commit 905c516

File tree

9 files changed

+32
-12
lines changed

9 files changed

+32
-12
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ x坐标列表,等同全部数据的宽度。
5252
x坐标轴的配置。
5353

5454
* tickCount: int 显示的坐标个数。
55+
* htAlign: boolean 是否首尾缩进对齐。
5556
* 更多设置详见F2。
5657

5758
#### `yAxis`: Object
@@ -104,6 +105,7 @@ x坐标列表,等同全部数据的宽度。
104105
x坐标轴的配置。
105106

106107
* tickCount: int 显示的坐标个数。
108+
* htAlign: boolean 是否首尾缩进对齐。
107109
* 更多设置详见F2。
108110

109111
#### `yAxis`: Object
@@ -161,6 +163,7 @@ x坐标列表,等同全部数据的宽度。
161163
x坐标轴的配置。
162164

163165
* tickCount: int 显示的坐标个数。
166+
* htAlign: boolean 是否首尾缩进对齐。
164167
* 更多设置详见F2。
165168

166169
#### `yAxis`: Object
@@ -381,6 +384,7 @@ y坐标轴的配置。
381384
x坐标轴的配置。
382385

383386
* tickCount: int 显示的坐标个数。
387+
* htAlign: boolean 是否首尾缩进对齐。
384388
* 更多设置详见F2。
385389

386390
#### `yAxis`: Object
@@ -431,6 +435,7 @@ y坐标轴的配置,同`xAxis`。
431435
x坐标轴的配置。
432436

433437
* tickCount: int 显示的坐标个数。
438+
* htAlign: boolean 是否首尾缩进对齐。
434439
* 更多设置详见F2。
435440

436441
#### `yAxis`: Object
@@ -459,6 +464,7 @@ y坐标轴的配置,同`xAxis`。
459464
x坐标轴的配置。
460465

461466
* tickCount: int 显示的坐标个数。
467+
* htAlign: boolean 是否首尾缩进对齐。
462468
* 更多设置详见F2。
463469

464470
#### `yAxis`: Object

components/area/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ Component({
8080
chart.source(data);
8181

8282
if(xAxis) {
83-
xAxis.label = util.label;
83+
if(xAxis.htAlign) {
84+
xAxis.label = util.label;
85+
}
8486
chart.scale('key', util.scale(xAxis));
8587
chart.axis('key', util.axis(xAxis));
8688
}

components/bubble/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ Component({
101101

102102
//配置坐标轴的伸长比
103103
if (xAxis) {
104-
xAxis.label = util.label;
104+
if(xAxis.htAlign) {
105+
xAxis.label = util.label;
106+
}
105107
chart.scale('key', util.scale(xAxis));
106108
}
107109
if (yAxis) {

components/column/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ Component({
8484
chart.coord(coord);
8585
}
8686
if(xAxis) {
87-
if(!coord || !coord.transposed) {
88-
xAxis.label = util.label;
89-
}
90-
else {
91-
yAxis.label = util.label;
87+
if(xAxis.htAlign) {
88+
if(!coord || !coord.transposed) {
89+
xAxis.label = util.label;
90+
}
91+
else {
92+
yAxis.label = util.label;
93+
}
9294
}
9395
chart.scale('key', util.scale(xAxis));
9496
chart.axis('key', util.axis(xAxis));

components/k/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ Component({
6565
chart.source(data);
6666

6767
if(xAxis) {
68-
xAxis.label = util.label;
68+
if(xAxis.htAlign) {
69+
xAxis.label = util.label;
70+
}
6971
chart.scale('time', util.scale(xAxis));
7072
chart.axis('time', util.axis(xAxis));
7173
}

components/line/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ Component({
8080
chart.source(data);
8181

8282
if(xAxis) {
83-
xAxis.label = util.label;
83+
if(xAxis.htAlign) {
84+
xAxis.label = util.label;
85+
}
8486
chart.scale('key', util.scale(xAxis));
8587
chart.axis('key', util.axis(xAxis));
8688
}

components/scatter/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ Component({
6868
chart.source(data);
6969

7070
if (xAxis) {
71-
xAxis.label = util.label;
71+
if(xAxis.htAlign) {
72+
xAxis.label = util.label;
73+
}
7274
chart.scale('key', util.scale(xAxis));
7375
chart.axis('key', util.axis(xAxis));
7476
}

components/timeshare/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ Component({
132132
areaChart.source(data);
133133

134134
if(xAxis) {
135-
xAxis.label = util.label;
135+
if(xAxis.htAlign) {
136+
xAxis.label = util.label;
137+
}
136138
areaChart.scale('key', util.scale(xAxis));
137139
areaChart.axis('key', util.axis(xAxis));
138140
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mini-chart",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "小程序图表库",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)