docs: 调整官网 demo

This commit is contained in:
2912401452 2022-04-02 16:34:43 +08:00
parent 65b70c19dd
commit 9604590b31
4 changed files with 6 additions and 7 deletions

View File

@ -35,7 +35,6 @@ scene.on('loaded', () => {
.color('w', [ '#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99' ])
.style({
textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
textOffset: [ 40, 0 ], // 文本相对锚点的偏移量 [水平, 垂直]
padding: [ 0, 0 ], // 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
stroke: '#ffffff', // 描边颜色
fontFamily,

View File

@ -205,7 +205,7 @@ scene.on('loaded', () => {
.color('iconColor')
.style({
textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
textOffset: [ 38, 10 ], // 文本相对锚点的偏移量 [水平, 垂直]
textOffset: [ -10, 10 ], // 文本相对锚点的偏移量 [水平, 垂直]
fontFamily,
iconfont: true,
textAllowOverlap: true

View File

@ -71,18 +71,18 @@ scene.on('loaded', () => {
})
.source(data)
.shape('icon', 'text')
.size(30)
.size(25)
.color('count', t => {
const c = Number(t.replace('℃', ''));
return colors[Math.floor(((c - 18) / 16) * 10)];
})
.style({
textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
textOffset: [ 30, 5 ],
textOffset: [ -25, 15 ],
padding: [ 2, 2 ],
fontFamily,
iconfont: true
// textAllowOverlap: true
iconfont: true,
textAllowOverlap: true
});
scene.addLayer(pointLayer);

View File

@ -62,7 +62,7 @@ scene.on('loaded', () => {
.color('count', n => (n > 0 ? '#0f0' : '#f00'))
.style({
textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
textOffset: [ 30, 5 ],
textOffset: [ -10, 5 ],
padding: [ 2, 2 ],
fontFamily,
iconfont: true