Skip to content

Commit 7617043

Browse files
author
zhaxnb
committed
Merge remote-tracking branch 'origin/master'
2 parents 0bd8931 + 3e6edde commit 7617043

File tree

16 files changed

+373
-31
lines changed

16 files changed

+373
-31
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/**
2+
* @typedef {import('@octokit/rest').Octokit} Octokit
3+
* @typedef {import('@actions/github')['context']} Context
4+
*/
5+
6+
module.exports = async function updateNoticeYear(
7+
/** @type {{ octokit: Octokit, context: Context }} */
8+
{ octokit, context }
9+
) {
10+
const now = new Date()
11+
// Change to UTC+8
12+
now.setHours(now.getHours() + 8)
13+
const newYear = now.getFullYear()
14+
console.log('Prepare to update notice year to', newYear)
15+
16+
const noticeContent = `Apache ECharts
17+
Copyright 2017-${newYear} The Apache Software Foundation
18+
19+
This product includes software developed at
20+
The Apache Software Foundation (https://www.apache.org/).`
21+
22+
const repoCtx = context.repo
23+
24+
const repoInfo = (await octokit.rest.repos.get(repoCtx)).data
25+
const defaultBranchName = repoInfo.default_branch
26+
const remoteNoticeFile = (await octokit.rest.repos.getContent({
27+
...repoCtx,
28+
path: 'NOTICE',
29+
ref: defaultBranchName
30+
})).data
31+
const remoteNoticeContent = base64ToUtf8(remoteNoticeFile.content)
32+
if (remoteNoticeContent === noticeContent) {
33+
console.log('NOTICE year is already updated.')
34+
return
35+
}
36+
37+
console.log('Ready to update the NOTICE file:\n' + noticeContent)
38+
39+
const defaultBranch = (await octokit.rest.repos.getBranch({
40+
...repoCtx,
41+
branch: defaultBranchName
42+
})).data
43+
44+
const newBranchName = `bot/update-notice-year/${newYear}`
45+
await octokit.rest.git.createRef({
46+
...repoCtx,
47+
ref: `refs/heads/${newBranchName}`,
48+
sha: defaultBranch.commit.sha
49+
})
50+
console.log('Created a new branch:', newBranchName)
51+
52+
await octokit.rest.repos.createOrUpdateFileContents({
53+
...repoCtx,
54+
path: 'NOTICE',
55+
message: `chore: update NOTICE year to ${newYear}`,
56+
content: utf8ToBase64(noticeContent),
57+
sha: remoteNoticeFile.sha,
58+
branch: newBranchName
59+
})
60+
61+
console.log('Updated the NOTICE file on the new branch')
62+
63+
const pr = (await octokit.rest.pulls.create({
64+
...repoCtx,
65+
head: newBranchName,
66+
base: defaultBranchName,
67+
maintainer_can_modify: true,
68+
title: `chore: update NOTICE year to ${newYear}`,
69+
body: `## Brief Information
70+
71+
This pull request is in the type of:
72+
73+
- [ ] bug fixing
74+
- [ ] new feature
75+
- [x] others
76+
77+
### What does this PR do?
78+
79+
Update notice year to ${newYear}. 💖
80+
81+
Happy new year! 祝大家新年快乐!🎇`
82+
})).data
83+
84+
console.log(`Opened PR #${pr.number} for updating the NOTICE file`)
85+
}
86+
87+
function utf8ToBase64(data) {
88+
return Buffer.from(data, 'utf-8').toString('base64')
89+
}
90+
91+
function base64ToUtf8(data) {
92+
return Buffer.from(data, 'base64').toString('utf-8')
93+
}

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
run: |
2626
echo "FETCH_DEPTH=$(($PR_COMMIT_COUNT + 1))" >> $GITHUB_ENV
2727
28-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
2929
with:
3030
fetch-depth: ${{ env.FETCH_DEPTH }}
3131

3232
- name: Use Node.js ${{ matrix.node-version }}
33-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
3434
with:
3535
node-version: ${{ matrix.node-version }}
3636

@@ -67,10 +67,10 @@ jobs:
6767
node-version: [18.x]
6868

6969
steps:
70-
- uses: actions/checkout@v3
70+
- uses: actions/checkout@v4
7171

7272
- name: Use Node.js ${{ matrix.node-version }}
73-
uses: actions/setup-node@v3
73+
uses: actions/setup-node@v4
7474
with:
7575
node-version: ${{ matrix.node-version }}
7676

.github/workflows/nightly-next.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
node-version: [18.x]
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
with:
2323
ref: next
2424

2525
- name: Use Node.js ${{ matrix.node-version }}
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2727
with:
2828
registry-url: https://registry.npmjs.org/
2929
node-version: ${{ matrix.node-version }}

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
node-version: [18.x]
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222

2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2525
with:
2626
registry-url: https://registry.npmjs.org/
2727
node-version: ${{ matrix.node-version }}

.github/workflows/source-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
node-version: [18.x]
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.node-version }}
2323

@@ -59,10 +59,10 @@ jobs:
5959
node-version: [18.x]
6060

6161
steps:
62-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v4
6363

6464
- name: Use Node.js ${{ matrix.node-version }}
65-
uses: actions/setup-node@v3
65+
uses: actions/setup-node@v4
6666
with:
6767
node-version: ${{ matrix.node-version }}
6868

@@ -114,7 +114,7 @@ jobs:
114114

115115
steps:
116116
- name: Use Node.js ${{ matrix.node-version }}
117-
uses: actions/setup-node@v3
117+
uses: actions/setup-node@v4
118118
with:
119119
node-version: ${{ matrix.node-version }}
120120

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Update NOTICE year
2+
3+
on:
4+
schedule:
5+
# 1/1 00:00 UTC+8
6+
- cron: '0 16 31 12 *'
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-notice-year:
11+
if: ${{ github.repository_owner == 'apache' }}
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
sparse-checkout: |
18+
.github/workflows/.scripts
19+
20+
- uses: actions/github-script@v7
21+
with:
22+
script: |
23+
const updateNoticeYear = require('.github/workflows/.scripts/update-notice-year.js')
24+
await updateNoticeYear({ octokit: github, context })

NOTICE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Apache ECharts
2-
Copyright 2017-2023 The Apache Software Foundation
2+
Copyright 2017-2024 The Apache Software Foundation
33

44
This product includes software developed at
5-
The Apache Software Foundation (https://www.apache.org/).
5+
The Apache Software Foundation (https://www.apache.org/).

build/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ exports.createECharts = function (opt = {}) {
108108
opt,
109109
{
110110
name: 'echarts',
111-
// Ignore default exports, which is only for compitable code like:
111+
// Ignore default exports, which is only for compatible code like:
112112
// import echarts from 'echarts/lib/echarts';
113113
exports: 'named',
114114
format: format

build/pre-publish.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/**
2121
* [Create CommonJS files]:
22-
* Compatible with prevoius folder structure: `echarts/lib` exists in `node_modules`
22+
* Compatible with previous folder structure: `echarts/lib` exists in `node_modules`
2323
* (1) Build all files to CommonJS to `echarts/lib`.
2424
* (2) Remove __DEV__.
2525
* (3) Mount `echarts/src/export.js` to `echarts/lib/echarts.js`.
@@ -87,7 +87,7 @@ const compileWorkList = [
8787
module: 'ES2015',
8888
rootDir: ecDir,
8989
outDir: tmpDir,
90-
// Generate types when buidling esm
90+
// Generate types when building esm
9191
declaration: true,
9292
declarationDir: typesDir
9393
},
@@ -206,7 +206,7 @@ module.exports = async function () {
206206
};
207207

208208
async function runTsCompile(localTs, compilerOptions, srcPathList) {
209-
// Must do it. becuase the value in tsconfig.json might be different from the inner representation.
209+
// Must do it, because the value in tsconfig.json might be different from the inner representation.
210210
// For example: moduleResolution: "NODE" => moduleResolution: 2
211211
const {options, errors} = localTs.convertCompilerOptionsFromJson(compilerOptions, ecDir);
212212

src/component/axis/AxisBuilder.ts

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
* under the License.
1818
*/
1919

20-
import {retrieve, defaults, extend, each, isObject, map, isString, isNumber, isFunction} from 'zrender/src/core/util';
20+
import {
21+
retrieve, defaults, extend, each, isObject, map, isString, isNumber, isFunction, retrieve2
22+
} from 'zrender/src/core/util';
2123
import * as graphic from '../../util/graphic';
2224
import {getECData} from '../../util/innerStore';
2325
import {createTextStyle} from '../../label/labelStyle';
@@ -68,7 +70,7 @@ export interface AxisBuilderCfg {
6870
tickDirection?: number
6971
labelDirection?: number
7072
/**
71-
* Usefull when onZero.
73+
* Useful when onZero.
7274
*/
7375
labelOffset?: number
7476
/**
@@ -776,6 +778,29 @@ function buildAxisLabel(
776778

777779
const tickCoord = axis.dataToCoord(tickValue);
778780

781+
const align = itemLabelModel.getShallow('align', true)
782+
|| labelLayout.textAlign;
783+
const alignMin = retrieve2(
784+
itemLabelModel.getShallow('alignMinLabel', true),
785+
align
786+
);
787+
const alignMax = retrieve2(
788+
itemLabelModel.getShallow('alignMaxLabel', true),
789+
align
790+
);
791+
792+
const verticalAlign = itemLabelModel.getShallow('verticalAlign', true)
793+
|| itemLabelModel.getShallow('baseline', true)
794+
|| labelLayout.textVerticalAlign;
795+
const verticalAlignMin = retrieve2(
796+
itemLabelModel.getShallow('verticalAlignMinLabel', true),
797+
verticalAlign
798+
);
799+
const verticalAlignMax = retrieve2(
800+
itemLabelModel.getShallow('verticalAlignMaxLabel', true),
801+
verticalAlign
802+
);
803+
779804
const textEl = new graphic.Text({
780805
x: tickCoord,
781806
y: opt.labelOffset + opt.labelDirection * labelMargin,
@@ -784,11 +809,12 @@ function buildAxisLabel(
784809
z2: 10 + (labelItem.level || 0),
785810
style: createTextStyle(itemLabelModel, {
786811
text: formattedLabel,
787-
align: itemLabelModel.getShallow('align', true)
788-
|| labelLayout.textAlign,
789-
verticalAlign: itemLabelModel.getShallow('verticalAlign', true)
790-
|| itemLabelModel.getShallow('baseline', true)
791-
|| labelLayout.textVerticalAlign,
812+
align: index === 0
813+
? alignMin
814+
: index === labels.length - 1 ? alignMax : align,
815+
verticalAlign: index === 0
816+
? verticalAlignMin
817+
: index === labels.length - 1 ? verticalAlignMax : verticalAlign,
792818
fill: isFunction(textColor)
793819
? textColor(
794820
// (1) In category axis with data zoom, tick is not the original

src/coord/axisCommonTypes.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919

20+
import { TextAlign, TextVerticalAlign } from 'zrender/src/core/types';
2021
import {
2122
TextCommonOption, LineStyleOption, OrdinalRawValue, ZRColor,
2223
AreaStyleOption, ComponentOption, ColorString,
@@ -223,6 +224,14 @@ interface AxisLabelBaseOption extends Omit<TextCommonOption, 'color'> {
223224
showMinLabel?: boolean,
224225
// true | false | null/undefined (auto)
225226
showMaxLabel?: boolean,
227+
// 'left' | 'center' | 'right' | null/undefined (auto)
228+
alignMinLabel?: TextAlign,
229+
// 'left' | 'center' | 'right' | null/undefined (auto)
230+
alignMaxLabel?: TextAlign,
231+
// 'top' | 'middle' | 'bottom' | null/undefined (auto)
232+
verticalAlignMinLabel?: TextVerticalAlign,
233+
// 'top' | 'middle' | 'bottom' | null/undefined (auto)
234+
verticalAlignMaxLabel?: TextVerticalAlign,
226235
margin?: number,
227236
rich?: Dictionary<TextCommonOption>
228237
/**

src/core/echarts.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,14 @@ class ECharts extends Eventful<ECEventDefinition> {
429429

430430
zrender.registerSSRDataGetter(el => {
431431
const ecData = getECData(el);
432+
const dataIndex = ecData.dataIndex;
433+
if (dataIndex == null) {
434+
return;
435+
}
432436
const hashMap = createHashMap();
433437
hashMap.set('series_index', ecData.seriesIndex);
434-
hashMap.set('data_index', ecData.dataIndex);
435-
hashMap.set('ssr_type', ecData.ssrType);
438+
hashMap.set('data_index', dataIndex);
439+
ecData.ssrType && hashMap.set('ssr_type', ecData.ssrType);
436440
return hashMap;
437441
});
438442

src/data/helper/sourceHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export function querySeriesUpstreamDatasetModel(
314314
export function queryDatasetUpstreamDatasetModels(
315315
datasetModel: DatasetModel
316316
): DatasetModel[] {
317-
// Only these attributes declared, we by defualt reference to `datasetIndex: 0`.
317+
// Only these attributes declared, we by default reference to `datasetIndex: 0`.
318318
// Otherwise, no reference.
319319
if (!datasetModel.get('transform', true)
320320
&& !datasetModel.get('fromTransformResult', true)

src/util/innerStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const setCommonECData = (seriesIndex: number, dataType: SeriesDataType, d
7575
childECData.seriesIndex = seriesIndex;
7676
childECData.dataIndex = dataIdx;
7777
childECData.dataType = dataType;
78-
childECData.ssrType === 'chart';
78+
childECData.ssrType = 'chart';
7979
});
8080
}
8181
}

0 commit comments

Comments
 (0)