diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdd4eec08f..23981bcde3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - name: Fetch commit count @@ -58,7 +58,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/nightly-next.yml b/.github/workflows/nightly-next.yml index b8c7978846..2cd843edcb 100644 --- a/.github/workflows/nightly-next.yml +++ b/.github/workflows/nightly-next.yml @@ -15,24 +15,27 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: next - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: registry-url: https://registry.npmjs.org/ - name: Setup and publish nightly run: | + node build/nightly/prepare.js --next + npm i zrender@npm:zrender-nightly@next npm ci + npm ls zrender + node build/nightly/post.js npm run release npm run test npm run test:dts - node build/prepareNightly.js --next npm publish --tag next env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5f4a302383..ddbcd98412 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,21 +15,24 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: registry-url: https://registry.npmjs.org/ - name: Setup and publish nightly run: | + node build/nightly/prepare.js + npm i zrender@npm:zrender-nightly npm ci + npm ls zrender + node build/nightly/post.js npm run release npm run test npm run test:dts - node build/prepareNightly.js npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/source-release.yml b/.github/workflows/source-release.yml index c98ba72345..87b85d5ccb 100644 --- a/.github/workflows/source-release.yml +++ b/.github/workflows/source-release.yml @@ -11,13 +11,13 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -26,7 +26,7 @@ jobs: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Cache node modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -34,7 +34,7 @@ jobs: path: ~/.npm key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - - name: Prepare releaes materials + - name: Prepare release materials run: | npm i node build/source-release/prepareReleaseMaterials.js \ @@ -44,7 +44,7 @@ jobs: --out tmp/materials - name: Archive materials - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: apache-echarts-${{env.RELEASE_VERSION}}-release-materials path: | @@ -56,13 +56,13 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -72,7 +72,7 @@ jobs: # Get RELEASE_NOTE.txt and pack it into zip. - name: Download materials - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: apache-echarts-${{env.RELEASE_VERSION}}-release-materials @@ -80,7 +80,7 @@ jobs: # Archive before run others to avoid packing unknown files. - name: Archive source release - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: apache-echarts-${{env.RELEASE_VERSION}}-src path: | @@ -109,11 +109,11 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -122,7 +122,7 @@ jobs: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Download source release - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: apache-echarts-${{env.RELEASE_VERSION}}-src path: tmp/echarts diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index bcdea0e49b..5cf94e3b0c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -14,7 +14,7 @@ jobs: if: ${{ github.repository_owner == 'apache' }} steps: - name: Close Stale Issues - uses: actions/stale@v5 + uses: actions/stale@v6 with: days-before-stale: 730 days-before-close: 7 diff --git a/build/nightly/post.js b/build/nightly/post.js new file mode 100644 index 0000000000..a06bf338a6 --- /dev/null +++ b/build/nightly/post.js @@ -0,0 +1,30 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +const fs = require('fs'); + +const root = __dirname + '/../../'; +const echartsPkg = JSON.parse(fs.readFileSync(root + 'package.json'), 'utf-8'); +const zrenderPkg = JSON.parse(fs.readFileSync(root + 'node_modules/zrender/package.json', 'utf-8')); + +const echartsCorePath = root + 'src/core/echarts.ts'; +const echartsCoreFile = fs.readFileSync(echartsCorePath, 'utf-8') + .replace(/export const version = '\S+'/, `export const version = '${echartsPkg.version}'`) + .replace(/(export const dependencies = {\s+zrender: ')\S+('\s+})/, `$1${zrenderPkg.version}$2`); +fs.writeFileSync(echartsCorePath, echartsCoreFile, 'utf-8'); diff --git a/build/prepareNightly.js b/build/nightly/prepare.js similarity index 95% rename from build/prepareNightly.js rename to build/nightly/prepare.js index 0dccab4efb..edec4a966d 100644 --- a/build/prepareNightly.js +++ b/build/nightly/prepare.js @@ -19,7 +19,7 @@ const fs = require('fs'); -const packageJsonPath = __dirname + '/../package.json'; +const packageJsonPath = __dirname + '/../../package.json'; const nightlyPackageName = 'echarts-nightly'; const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); @@ -57,8 +57,7 @@ packageJson.version = updateVersion(packageJson.version); fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8'); - -const readmePath = __dirname + '/../README.md'; +const readmePath = __dirname + '/../../README.md'; const readmeAttention = `

⚠️ ATTENTION PLEASE

This is nightly build of Apache ECharts. Please DON't use it in your production environment.

@@ -70,4 +69,4 @@ ${readmeAttention} ${readmeContent} `, 'utf-8'); -} \ No newline at end of file +} diff --git a/src/animation/customGraphicTransition.ts b/src/animation/customGraphicTransition.ts index 73c12401aa..a2bf490c51 100644 --- a/src/animation/customGraphicTransition.ts +++ b/src/animation/customGraphicTransition.ts @@ -427,12 +427,12 @@ function duringCall( return; } // If el is remove from zr by reason like legend, during still need to called, - // becuase el will be added back to zr and the prop value should not be incorrect. + // because el will be added back to zr and the prop value should not be incorrect. const latestUserDuring = transitionInnerStore(el).userDuring; const scopeUserDuring = scope.userDuring; // Ensured a during is only called once in each animation frame. - // If a during is called multiple times in one frame, maybe some users' calulation logic + // If a during is called multiple times in one frame, maybe some users' calculation logic // might be wrong (not sure whether this usage exists). // The case of a during might be called twice can be: by default there is a animator for // 'x', 'y' when init. Before the init animation finished, call `setOption` to start @@ -629,4 +629,4 @@ if (__DEV__) { + 'Only `' + keys(TRANSFORM_PROPS_MAP).join('`, `') + '` are permitted.'); } }; -} \ No newline at end of file +} diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts index dabd7ee3ec..c82d3d78f8 100644 --- a/src/animation/universalTransition.ts +++ b/src/animation/universalTransition.ts @@ -43,16 +43,18 @@ import Displayable from 'zrender/src/graphic/Displayable'; const DATA_COUNT_THRESHOLD = 1e4; -interface GlobalStore { oldSeries: SeriesModel[], oldData: SeriesData[] }; +interface GlobalStore { oldSeries: SeriesModel[], oldDataGroupIds: string[], oldData: SeriesData[] }; const getUniversalTransitionGlobalStore = makeInner(); interface DiffItem { + dataGroupId: string data: SeriesData dim: DimensionLoose divide: UniversalTransitionOption['divideShape'] dataIndex: number } interface TransitionSeries { + dataGroupId: string data: SeriesData divide: UniversalTransitionOption['divideShape'] dim?: DimensionLoose @@ -83,6 +85,7 @@ function flattenDataDiffItems(list: TransitionSeries[]) { const groupDim = getGroupIdDimension(data); for (let dataIndex = 0; dataIndex < indices.length; dataIndex++) { items.push({ + dataGroupId: seriesInfo.dataGroupId, data, dim: seriesInfo.dim || groupDim, divide: seriesInfo.divide, @@ -207,7 +210,7 @@ function transitionBetween( // Use group id as transition key by default. // So we can achieve multiple to multiple animation like drilldown / up naturally. // If group id not exits. Use id instead. If so, only one to one transition will be applied. - const dataGroupId = data.hostModel && (data.hostModel as SeriesModel).get('dataGroupId') as string; + const dataGroupId = diffItem.dataGroupId; // If specified key dimension(itemGroupId by default). Use this same dimension from other data. // PENDING: If only use key dimension of newData. @@ -470,26 +473,35 @@ function findTransitionSeriesBatches( ) { const updateBatches = createHashMap(); - const oldDataMap = createHashMap(); + const oldDataMap = createHashMap<{ + dataGroupId: string, + data: SeriesData + }>(); // Map that only store key in array seriesKey. // Which is used to query the old data when transition from one to multiple series. const oldDataMapForSplit = createHashMap<{ key: string, + dataGroupId: string, data: SeriesData }>(); each(globalStore.oldSeries, (series, idx) => { + const oldDataGroupId = globalStore.oldDataGroupIds[idx] as string; const oldData = globalStore.oldData[idx]; const transitionKey = getSeriesTransitionKey(series); const transitionKeyStr = convertArraySeriesKeyToString(transitionKey); - oldDataMap.set(transitionKeyStr, oldData); + oldDataMap.set(transitionKeyStr, { + dataGroupId: oldDataGroupId, + data: oldData + }); if (isArray(transitionKey)) { // Same key can't in different array seriesKey. each(transitionKey, key => { oldDataMapForSplit.set(key, { - data: oldData, - key: transitionKeyStr + key: transitionKeyStr, + dataGroupId: oldDataGroupId, + data: oldData }); }); } @@ -502,6 +514,7 @@ function findTransitionSeriesBatches( } each(params.updatedSeries, series => { if (series.isUniversalTransitionEnabled() && series.isAnimationEnabled()) { + const newDataGroupId = series.get('dataGroupId') as string; const newData = series.getData(); const transitionKey = getSeriesTransitionKey(series); const transitionKeyStr = convertArraySeriesKeyToString(transitionKey); @@ -515,16 +528,18 @@ function findTransitionSeriesBatches( // TODO check if data is same? updateBatches.set(transitionKeyStr, { oldSeries: [{ - divide: getDivideShapeFromData(oldData), - data: oldData + dataGroupId: oldData.dataGroupId, + divide: getDivideShapeFromData(oldData.data), + data: oldData.data }], newSeries: [{ + dataGroupId: newDataGroupId, divide: getDivideShapeFromData(newData), data: newData }] }); } - else { + else { // Transition from multiple series. if (isArray(transitionKey)) { if (__DEV__) { @@ -533,10 +548,11 @@ function findTransitionSeriesBatches( const oldSeries: TransitionSeries[] = []; each(transitionKey, key => { const oldData = oldDataMap.get(key); - if (oldData) { + if (oldData.data) { oldSeries.push({ - divide: getDivideShapeFromData(oldData), - data: oldData + dataGroupId: oldData.dataGroupId, + divide: getDivideShapeFromData(oldData.data), + data: oldData.data }); } }); @@ -544,6 +560,7 @@ function findTransitionSeriesBatches( updateBatches.set(transitionKeyStr, { oldSeries, newSeries: [{ + dataGroupId: newDataGroupId, data: newData, divide: getDivideShapeFromData(newData) }] @@ -558,6 +575,7 @@ function findTransitionSeriesBatches( if (!batch) { batch = { oldSeries: [{ + dataGroupId: oldData.dataGroupId, data: oldData.data, divide: getDivideShapeFromData(oldData.data) }], @@ -566,6 +584,7 @@ function findTransitionSeriesBatches( updateBatches.set(oldData.key, batch); } batch.newSeries.push({ + dataGroupId: newDataGroupId, data: newData, divide: getDivideShapeFromData(newData) }); @@ -600,6 +619,7 @@ function transitionSeriesFromOpt( const idx = querySeries(globalStore.oldSeries, finder); if (idx >= 0) { from.push({ + dataGroupId: globalStore.oldDataGroupIds[idx], data: globalStore.oldData[idx], // TODO can specify divideShape in transition. divide: getDivideShapeFromData(globalStore.oldData[idx]), @@ -612,6 +632,7 @@ function transitionSeriesFromOpt( if (idx >= 0) { const data = params.updatedSeries[idx].getData(); to.push({ + dataGroupId: globalStore.oldDataGroupIds[idx], data, divide: getDivideShapeFromData(data), dim: finder.dimension @@ -671,6 +692,7 @@ export function installUniversalTransition(registers: EChartsExtensionInstallReg // Save all series of current update. Not only the updated one. const allSeries = ecModel.getSeries(); const savedSeries: SeriesModel[] = globalStore.oldSeries = []; + const savedDataGroupIds: string[] = globalStore.oldDataGroupIds = []; const savedData: SeriesData[] = globalStore.oldData = []; for (let i = 0; i < allSeries.length; i++) { const data = allSeries[i].getData(); @@ -678,8 +700,9 @@ export function installUniversalTransition(registers: EChartsExtensionInstallReg // Avoid large data costing too much extra memory if (data.count() < DATA_COUNT_THRESHOLD) { savedSeries.push(allSeries[i]); + savedDataGroupIds.push(allSeries[i].get('dataGroupId') as string); savedData.push(data); } } }); -} \ No newline at end of file +} diff --git a/src/chart/candlestick/CandlestickSeries.ts b/src/chart/candlestick/CandlestickSeries.ts index 6f104e5bfb..019e1c55f4 100644 --- a/src/chart/candlestick/CandlestickSeries.ts +++ b/src/chart/candlestick/CandlestickSeries.ts @@ -43,6 +43,7 @@ type CandlestickDataValue = OptionDataValue[]; interface CandlestickItemStyleOption extends ItemStyleOption { color0?: ZRColor borderColor0?: ColorString + borderColorDoji?: ZRColor } export interface CandlestickStateOption { itemStyle?: CandlestickItemStyleOption @@ -116,6 +117,7 @@ class CandlestickSeriesModel extends SeriesModel { color0: '#47b262', // negative borderColor: '#eb5454', borderColor0: '#47b262', + borderColorDoji: null, // when close === open // borderColor: '#d24040', // borderColor0: '#398f4f', borderWidth: 1 diff --git a/src/chart/candlestick/CandlestickView.ts b/src/chart/candlestick/CandlestickView.ts index ed4f6660c6..3d05e81c70 100644 --- a/src/chart/candlestick/CandlestickView.ts +++ b/src/chart/candlestick/CandlestickView.ts @@ -368,9 +368,16 @@ function createLarge( ignoreCoarsePointer: true }); group.add(elN); + const elDoji = new LargeBoxPath({ + shape: {points: largePoints}, + __sign: 0, + ignoreCoarsePointer: true + }); + group.add(elDoji); setLargeStyle(1, elP, seriesModel, data); setLargeStyle(-1, elN, seriesModel, data); + setLargeStyle(0, elDoji, seriesModel, data); if (incremental) { elP.incremental = true; @@ -384,8 +391,12 @@ function createLarge( function setLargeStyle(sign: number, el: LargeBoxPath, seriesModel: CandlestickSeriesModel, data: SeriesData) { // TODO put in visual? - const borderColor = seriesModel.get(['itemStyle', sign > 0 ? 'borderColor' : 'borderColor0']) + let borderColor = seriesModel.get(['itemStyle', sign > 0 ? 'borderColor' : 'borderColor0']) + // Use color for border color by default. || seriesModel.get(['itemStyle', sign > 0 ? 'color' : 'color0']); + if (sign === 0) { + borderColor = seriesModel.get(['itemStyle', 'borderColorDoji']); + } // Color must be excluded. // Because symbol provide setColor individually to set fill and stroke diff --git a/src/chart/candlestick/candlestickLayout.ts b/src/chart/candlestick/candlestickLayout.ts index 2a9afd9975..f655b381f0 100644 --- a/src/chart/candlestick/candlestickLayout.ts +++ b/src/chart/candlestick/candlestickLayout.ts @@ -22,7 +22,7 @@ import createRenderPlanner from '../helper/createRenderPlanner'; import {parsePercent} from '../../util/number'; import {map, retrieve2} from 'zrender/src/core/util'; import { DimensionIndex, StageHandler, StageHandlerProgressParams } from '../../util/types'; -import CandlestickSeriesModel from './CandlestickSeries'; +import CandlestickSeriesModel, { CandlestickDataItemOption } from './CandlestickSeries'; import SeriesData from '../../data/SeriesData'; import { RectLike } from 'zrender/src/core/BoundingRect'; import DataStore from '../../data/DataStore'; @@ -106,8 +106,10 @@ const candlestickLayout: StageHandler = { subPixelOptimizePoint(ocLowPoint) ); + const itemModel = data.getItemModel(dataIndex); + const hasDojiColor = !!itemModel.get(['itemStyle', 'borderColorDoji']); data.setItemLayout(dataIndex, { - sign: getSign(store, dataIndex, openVal, closeVal, closeDimI), + sign: getSign(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor), initBaseline: openVal > closeVal ? ocHighPoint[vDimIdx] : ocLowPoint[vDimIdx], // open point. ends: ends, @@ -170,6 +172,7 @@ const candlestickLayout: StageHandler = { const tmpOut: number[] = []; let dataIndex; const store = data.getStore(); + const hasDojiColor = !!seriesModel.get(['itemStyle', 'borderColorDoji']); while ((dataIndex = params.next()) != null) { const axisDimVal = store.get(cDimI, dataIndex) as number; @@ -184,7 +187,7 @@ const candlestickLayout: StageHandler = { continue; } - points[offset++] = getSign(store, dataIndex, openVal, closeVal, closeDimI); + points[offset++] = getSign(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor); tmpIn[cDimIdx] = axisDimVal; @@ -202,10 +205,18 @@ const candlestickLayout: StageHandler = { } }; +/** + * Get the sign of a single data. + * + * @returns 0 for doji with hasDojiColor: true, + * 1 for positive, + * -1 for negative. + */ function getSign( - store: DataStore, dataIndex: number, openVal: number, closeVal: number, closeDimI: DimensionIndex -): -1 | 1 { - let sign: -1 | 1; + store: DataStore, dataIndex: number, openVal: number, closeVal: number, closeDimI: DimensionIndex, + hasDojiColor: boolean +): -1 | 1 | 0 { + let sign: -1 | 1 | 0; if (openVal > closeVal) { sign = -1; } @@ -213,11 +224,15 @@ function getSign( sign = 1; } else { - sign = dataIndex > 0 - // If close === open, compare with close of last record - ? (store.get(closeDimI, dataIndex - 1) <= closeVal ? 1 : -1) - // No record of previous, set to be positive - : 1; + sign = hasDojiColor + // When doji color is set, use it instead of color/color0. + ? 0 + : (dataIndex > 0 + // If close === open, compare with close of last record + ? (store.get(closeDimI, dataIndex - 1) <= closeVal ? 1 : -1) + // No record of previous, set to be positive + : 1 + ); } return sign; diff --git a/src/chart/candlestick/candlestickVisual.ts b/src/chart/candlestick/candlestickVisual.ts index 963d3dd56e..8882d63333 100644 --- a/src/chart/candlestick/candlestickVisual.ts +++ b/src/chart/candlestick/candlestickVisual.ts @@ -25,6 +25,7 @@ import { extend } from 'zrender/src/core/util'; const positiveBorderColorQuery = ['itemStyle', 'borderColor'] as const; const negativeBorderColorQuery = ['itemStyle', 'borderColor0'] as const; +const dojiBorderColorQuery = ['itemStyle', 'borderColorDoji'] as const; const positiveColorQuery = ['itemStyle', 'color'] as const; const negativeColorQuery = ['itemStyle', 'color0'] as const; @@ -47,7 +48,10 @@ const candlestickVisual: StageHandler = { function getBorderColor(sign: number, model: Model>) { return model.get( - sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery + sign === 0 ? dojiBorderColorQuery + : sign > 0 + ? positiveBorderColorQuery + : negativeBorderColorQuery ); } diff --git a/src/chart/lines/LinesSeries.ts b/src/chart/lines/LinesSeries.ts index f97b6a0b97..7b8ff2878c 100644 --- a/src/chart/lines/LinesSeries.ts +++ b/src/chart/lines/LinesSeries.ts @@ -306,7 +306,7 @@ class LinesSeriesModel extends SeriesModel { if (__DEV__) { const CoordSys = CoordinateSystem.get(option.coordinateSystem); if (!CoordSys) { - throw new Error('Unkown coordinate system ' + option.coordinateSystem); + throw new Error('Unknown coordinate system ' + option.coordinateSystem); } } diff --git a/src/chart/pie/PieSeries.ts b/src/chart/pie/PieSeries.ts index fc22425605..aa6db80e28 100644 --- a/src/chart/pie/PieSeries.ts +++ b/src/chart/pie/PieSeries.ts @@ -38,7 +38,7 @@ import { SeriesLabelOption, DefaultEmphasisFocus } from '../../util/types'; -import SeriesData from '../../data/SeriesData'; +import type SeriesData from '../../data/SeriesData'; interface PieItemStyleOption extends ItemStyleOption { // can be 10 @@ -129,12 +129,14 @@ export interface PieSeriesOption extends data?: (OptionDataValueNumeric | OptionDataValueNumeric[] | PieDataItemOption)[] } +const innerData = modelUtil.makeInner<{ + seats?: number[] +}, SeriesData>(); + class PieSeriesModel extends SeriesModel { static type = 'series.pie' as const; - seats: number[]; - /** * @overwrite */ @@ -161,25 +163,30 @@ class PieSeriesModel extends SeriesModel { * @overwrite */ getInitialData(this: PieSeriesModel): SeriesData { - const data = createSeriesDataSimply(this, { + return createSeriesDataSimply(this, { coordDimensions: ['value'], encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this) }); - const valueList:number[] = []; - data.each(data.mapDimension('value'), function (value: number) { - valueList.push(value); - }); - - this.seats = getPercentSeats(valueList, data.hostModel.get('percentPrecision')); - return data; } /** * @overwrite */ getDataParams(dataIndex: number): PieCallbackDataParams { + const data = this.getData(); + // update seats when data is changed + const dataInner = innerData(data); + let seats = dataInner.seats; + if (!seats) { + const valueList: number[] = []; + data.each(data.mapDimension('value'), function (value: number) { + valueList.push(value); + }); + seats = dataInner.seats = getPercentSeats(valueList, data.hostModel.get('percentPrecision')); + } const params = super.getDataParams(dataIndex) as PieCallbackDataParams; - params.percent = this.seats[dataIndex]; + // seats may be empty when sum is 0 + params.percent = seats[dataIndex] || 0; params.$vars.push('percent'); return params; } @@ -254,8 +261,8 @@ class PieSeriesModel extends SeriesModel { bleedMargin: 10, // Distance between text and label line. distanceToLabelLine: 5 - // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 - // 默认使用全局文本样式,详见TEXTSTYLE + // formatter: 标签文本格式器,同 tooltip.formatter,不支持异步回调 + // 默认使用全局文本样式,详见 textStyle // distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数 }, // Enabled when label.normal.position is 'outer' diff --git a/src/chart/sankey/SankeySeries.ts b/src/chart/sankey/SankeySeries.ts index 2ef1e77795..bc07d45004 100644 --- a/src/chart/sankey/SankeySeries.ts +++ b/src/chart/sankey/SankeySeries.ts @@ -85,6 +85,7 @@ export interface SankeyEdgeItemOption extends StatesOptionMixin, GraphEdgeItemObject { focusNodeAdjacency?: FocusNodeAdjacency + edgeLabel?: SeriesLabelOption } export interface SankeyLevelOption extends SankeyNodeStateOption, SankeyEdgeStateOption { @@ -137,6 +138,10 @@ export interface SankeySeriesOption links?: SankeyEdgeItemOption[] levels?: SankeyLevelOption[] + + edgeLabel?: SeriesLabelOption & { + position?: 'inside' + } } class SankeySeriesModel extends SeriesModel { @@ -298,6 +303,11 @@ class SankeySeriesModel extends SeriesModel { fontSize: 12 }, + edgeLabel: { + show: false, + fontSize: 12 + }, + levels: [], nodeAlign: 'justify', diff --git a/src/chart/sankey/SankeyView.ts b/src/chart/sankey/SankeyView.ts index 5a9110f760..5432908d48 100644 --- a/src/chart/sankey/SankeyView.ts +++ b/src/chart/sankey/SankeyView.ts @@ -220,6 +220,16 @@ class SankeyView extends ChartView { } } + setLabelStyle( + curve, getLabelStatesModels(edgeModel, 'edgeLabel'), + { + labelFetcher: seriesModel, + labelDataIndex: edge.dataIndex, + defaultText: `${edgeModel.get('value')}` + } + ); + curve.setTextConfig({ position: 'inside' }); + const emphasisModel = edgeModel.getModel('emphasis'); setStatesStylesFromModel(curve, edgeModel, 'lineStyle', (model) => model.getItemStyle()); diff --git a/src/chart/sankey/sankeyVisual.ts b/src/chart/sankey/sankeyVisual.ts index 9425a615a9..a0f4add053 100644 --- a/src/chart/sankey/sankeyVisual.ts +++ b/src/chart/sankey/sankeyVisual.ts @@ -20,12 +20,13 @@ import * as zrUtil from 'zrender/src/core/util'; import VisualMapping from '../../visual/VisualMapping'; import GlobalModel from '../../model/Global'; -import SankeySeriesModel, { SankeyNodeItemOption } from './SankeySeries'; +import SankeySeriesModel, { SankeyEdgeItemOption, SankeyNodeItemOption } from './SankeySeries'; export default function sankeyVisual(ecModel: GlobalModel) { ecModel.eachSeriesByType('sankey', function (seriesModel: SankeySeriesModel) { const graph = seriesModel.getGraph(); const nodes = graph.nodes; + const edges = graph.edges; if (nodes.length) { let minValue = Infinity; let maxValue = -Infinity; @@ -59,5 +60,11 @@ export default function sankeyVisual(ecModel: GlobalModel) { } }); } + if (edges.length) { + zrUtil.each(edges, function (edge) { + const edgeStyle = edge.getModel().get('lineStyle'); + edge.setVisual('style', edgeStyle); + }); + } }); } \ No newline at end of file diff --git a/src/component/dataZoom/roams.ts b/src/component/dataZoom/roams.ts index c4f281d53d..d33e1e287a 100644 --- a/src/component/dataZoom/roams.ts +++ b/src/component/dataZoom/roams.ts @@ -233,7 +233,7 @@ export function installDataZoomRoamProcessor(registers: EChartsExtensionInstallR || (apiInner.coordSysRecordMap = createHashMap()); coordSysRecordMap.each(function (coordSysRecord) { - // `coordSysRecordMap` always exists (becuase it hold the `roam controller`, which should + // `coordSysRecordMap` always exists (because it holds the `roam controller`, which should // better not re-create each time), but clear `dataZoomInfoMap` each round of the workflow. coordSysRecord.dataZoomInfoMap = null; }); @@ -294,4 +294,4 @@ export function installDataZoomRoamProcessor(registers: EChartsExtensionInstallR }); }); -} \ No newline at end of file +} diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts index 5296014546..89827f9570 100644 --- a/src/component/helper/MapDraw.ts +++ b/src/component/helper/MapDraw.ts @@ -617,7 +617,7 @@ class MapDraw { * `ignore` might have been modified by `LabelManager`, and `LabelManager#addLabelsOfSeries` * will subsequently cache `defaultAttr` like `ignore`. If do not do this reset, the modified * props will have no chance to be restored. - * Note: this reset should be after `clearStates` in `renderSeries` becuase `useStates` in + * Note: This reset should be after `clearStates` in `renderSeries` because `useStates` in * `renderSeries` will cache the modified `ignore` to `el._normalState`. * TODO: * Use clone/immutable in `LabelManager`? @@ -672,7 +672,7 @@ function applyOptionStyleForRegion( } > ): void { - // All of the path are using `itemStyle`, becuase + // All of the path are using `itemStyle`, because // (1) Some SVG also use fill on polyline (The different between // polyline and polygon is "open" or "close" but not fill or not). // (2) For the common props like opacity, if some use itemStyle diff --git a/src/coord/View.ts b/src/coord/View.ts index bb4c1affb8..23e6a8ad75 100644 --- a/src/coord/View.ts +++ b/src/coord/View.ts @@ -232,9 +232,9 @@ class View extends Transformable implements CoordinateSystemMaster, CoordinateSy const rawTransformable = this._rawTransformable; const roamTransformable = this._roamTransformable; - // Becuase roamTransformabel has `originX/originY` modified, + // Because roamTransformabel has `originX/originY` modified, // but the caller of `getTransformInfo` can not handle `originX/originY`, - // so need to recalcualte them. + // so need to recalculate them. const dummyTransformable = new Transformable(); dummyTransformable.transform = roamTransformable.transform; dummyTransformable.decomposeTransform(); diff --git a/src/coord/axisHelper.ts b/src/coord/axisHelper.ts index 3c5d685eeb..770caeb2af 100644 --- a/src/coord/axisHelper.ts +++ b/src/coord/axisHelper.ts @@ -364,7 +364,7 @@ export function getOptionCategoryInterval(model: Model([ 'rect', 'circle', 'line', 'ellipse', 'polygon', 'polyline', 'path', - // are also enabled becuase some SVG might paint text itself, + // are also enabled because some SVG might paint text itself, // but still need to trigger events or tooltip. 'text', 'tspan', // is also enabled because this case: if multiple tags share one name diff --git a/src/coord/geo/Region.ts b/src/coord/geo/Region.ts index c29377ef1a..095efcd4b8 100644 --- a/src/coord/geo/Region.ts +++ b/src/coord/geo/Region.ts @@ -295,7 +295,7 @@ export class GeoSVGRegion extends Region { readonly type = 'geoSVG'; // Can only be used to calculate, but not be modified. - // Becuase this el may not belongs to this view, + // Because this el may not belong to this view, // but been displaying on some other view. private _elOnlyForCalculate: Element; diff --git a/src/core/CoordinateSystem.ts b/src/core/CoordinateSystem.ts index 1e58d66478..b1f59222c3 100644 --- a/src/core/CoordinateSystem.ts +++ b/src/core/CoordinateSystem.ts @@ -31,8 +31,8 @@ class CoordinateSystemManager { create(ecModel: GlobalModel, api: ExtensionAPI): void { let coordinateSystems: CoordinateSystemMaster[] = []; - zrUtil.each(coordinateSystemCreators, function (creater, type) { - const list = creater.create(ecModel, api); + zrUtil.each(coordinateSystemCreators, function (creator, type) { + const list = creator.create(ecModel, api); coordinateSystems = coordinateSystems.concat(list || []); }); diff --git a/src/core/Scheduler.ts b/src/core/Scheduler.ts index 4d67411a4c..745631111d 100644 --- a/src/core/Scheduler.ts +++ b/src/core/Scheduler.ts @@ -350,12 +350,12 @@ class Scheduler { } const performArgs: PerformArgs = scheduler.getPerformArgs(task, opt.block); // FIXME - // if intending to decalare `performRawSeries` in handlers, only + // if intending to declare `performRawSeries` in handlers, only // stream-independent (specifically, data item independent) operations can be - // performed. Because is a series is filtered, most of the tasks will not + // performed. Because if a series is filtered, most of the tasks will not // be performed. A stream-dependent operation probably cause wrong biz logic. // Perhaps we should not provide a separate callback for this case instead - // of providing the config `performRawSeries`. The stream-dependent operaions + // of providing the config `performRawSeries`. The stream-dependent operations // and stream-independent operations should better not be mixed. performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model); @@ -499,8 +499,8 @@ class Scheduler { // we set the pipeline block. let errMsg = ''; if (__DEV__) { - errMsg = '"createOnAllSeries" do not supported for "overallReset", ' - + 'becuase it will block all streams.'; + errMsg = '"createOnAllSeries" is not supported for "overallReset", ' + + 'because it will block all streams.'; } assert(!stageHandler.createOnAllSeries, errMsg); if (seriesType) { @@ -509,10 +509,10 @@ class Scheduler { else if (getTargetSeries) { getTargetSeries(ecModel, api).each(createStub); } - // Otherwise, (usually it is legancy case), the overall task will only be - // executed when upstream dirty. Otherwise the progressive rendering of all + // Otherwise, (usually it is legacy case), the overall task will only be + // executed when upstream is dirty. Otherwise the progressive rendering of all // pipelines will be disabled unexpectedly. But it still needs stubs to receive - // dirty info from upsteam. + // dirty info from upstream. else { overallProgress = false; each(ecModel.getSeries(), createStub); diff --git a/src/core/echarts.ts b/src/core/echarts.ts index 65ac63f857..3724b48af5 100644 --- a/src/core/echarts.ts +++ b/src/core/echarts.ts @@ -152,7 +152,7 @@ const PRIORITY_PROCESSOR_SERIES_FILTER = 800; // So data stack stage should be in front of data processing stage. const PRIORITY_PROCESSOR_DATASTACK = 900; // "Data filter" will block the stream, so it should be -// put at the begining of data processing. +// put at the beginning of data processing. const PRIORITY_PROCESSOR_FILTER = 1000; const PRIORITY_PROCESSOR_DEFAULT = 2000; const PRIORITY_PROCESSOR_STATISTIC = 5000; @@ -328,8 +328,8 @@ type EChartsInitOpts = { useCoarsePointer?: boolean, pointerSize?: number, ssr?: boolean, - width?: number, - height?: number + width?: number | string, + height?: number | string }; class ECharts extends Eventful { @@ -541,8 +541,8 @@ class ECharts extends Eventful { // Do not update coordinate system here. Because that coord system update in // each frame is not a good user experience. So we follow the rule that - // the extent of the coordinate system is determin in the first frame (the - // frame is executed immedietely after task reset. + // the extent of the coordinate system is determined in the first frame (the + // frame is executed immediately after task reset. // this._coordSysMgr.update(ecModel, api); // console.log('--- ec frame visual ---', remainTime); @@ -1382,9 +1382,9 @@ class ECharts extends Eventful { this._zr.flush(); } else if (flush !== false && env.browser.weChat) { - // In WeChat embeded browser, `requestAnimationFrame` and `setInterval` + // In WeChat embedded browser, `requestAnimationFrame` and `setInterval` // hang when sliding page (on touch event), which cause that zr does not - // refresh util user interaction finished, which is not expected. + // refresh until user interaction finished, which is not expected. // But `dispatchAction` may be called too frequently when pan on touch // screen, which impacts performance if do not throttle them. this._throttledZrFlush(); @@ -1474,7 +1474,7 @@ class ECharts extends Eventful { : ecModel.eachSeries(doPrepare); function doPrepare(model: ComponentModel): void { - // By defaut view will be reused if possible for the case that `setOption` with "notMerge" + // By default view will be reused if possible for the case that `setOption` with "notMerge" // mode and need to enable transition animation. (Usually, when they have the same id, or // especially no id but have the same type & name & index. See the `model.id` generation // rule in `makeIdAndName` and `viewId` generation rule here). @@ -1677,20 +1677,20 @@ class ECharts extends Eventful { // Undo (restoration of total ecModel) can be carried out in 'action' or outside API call. // Create new coordinate system each update - // In LineView may save the old coordinate system and use it to get the orignal point + // In LineView may save the old coordinate system and use it to get the original point. coordSysMgr.create(ecModel, api); scheduler.performDataProcessorTasks(ecModel, payload); // Current stream render is not supported in data process. So we can update // stream modes after data processing, where the filtered data is used to - // deteming whether use progressive rendering. + // determine whether to use progressive rendering. updateStreamModes(this, ecModel); // We update stream modes before coordinate system updated, then the modes info // can be fetched when coord sys updating (consider the barGrid extent fix). But // the drawback is the full coord info can not be fetched. Fortunately this full - // coord is not requied in stream mode updater currently. + // coord is not required in stream mode updater currently. coordSysMgr.update(ecModel, api); clearColorPalette(ecModel); @@ -2019,8 +2019,8 @@ class ECharts extends Eventful { ecIns.trigger('rendered', params); - // The `finished` event should not be triggered repeatly, - // so it should only be triggered when rendering indeed happend + // The `finished` event should not be triggered repeatedly, + // so it should only be triggered when rendering indeed happens // in zrender. (Consider the case that dipatchAction is keep // triggering when mouse move). if ( @@ -2221,7 +2221,7 @@ class ECharts extends Eventful { chartView.group.silent = !!seriesModel.get('silent'); // Should not call markRedraw on group, because it will disable zrender - // increamental render (alway render from the __startIndex each frame) + // incremental render (always render from the __startIndex each frame) // chartView.group.markRedraw(); updateBlend(seriesModel, chartView); @@ -2335,7 +2335,7 @@ class ECharts extends Eventful { chartView.eachRendered((el: Displayable) => { // FIXME marker and other components if (!el.isGroup) { - // DONT mark the element dirty. In case element is incremental and don't wan't to rerender. + // DON'T mark the element dirty. In case element is incremental and don't want to rerender. el.style.blend = blendMode; } }); @@ -2447,7 +2447,7 @@ class ECharts extends Eventful { savePathStates(el); } - // Only updated on changed element. In case element is incremental and don't wan't to rerender. + // Only updated on changed element. In case element is incremental and don't want to rerender. // TODO, a more proper way? if (el.__dirty) { const prevStates = el.prevStates; @@ -2471,7 +2471,7 @@ class ECharts extends Eventful { } } - // The use higlighted and selected flag to toggle states. + // Use highlighted and selected flag to toggle states. if (el.__dirty) { applyElementStates(el); } @@ -2734,7 +2734,7 @@ export function disConnect(groupId: string): void { } /** - * Alias and backword compat + * Alias and backward compatibility */ export const disconnect = disConnect; @@ -3016,7 +3016,7 @@ export const registerTransform = registerExternalTransform; -// Buitlin global visual +// Builtin global visual registerVisual(PRIORITY_VISUAL_GLOBAL, seriesStyleTask); registerVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataStyleTask); registerVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataColorPaletteTask); diff --git a/src/core/impl.ts b/src/core/impl.ts index 4fecd09cc8..ffc8f21893 100644 --- a/src/core/impl.ts +++ b/src/core/impl.ts @@ -21,7 +21,7 @@ import { error } from '../util/log'; // Implementation of exported APIs. For example registerMap, getMap. -// The implentations will be registered when installing the component. +// The implementations will be registered when installing the component. // Avoid these code being bundled to the core module. const implsStore: Record = {}; @@ -43,4 +43,4 @@ export function getImpl(name: string) { } } return implsStore[name]; -} \ No newline at end of file +} diff --git a/src/core/task.ts b/src/core/task.ts index 4d55846ea1..6a25c1c127 100644 --- a/src/core/task.ts +++ b/src/core/task.ts @@ -331,11 +331,11 @@ export class Task { } setOutputEnd(end: number): void { - // This only happend in dataTask, dataZoom, map, currently. + // This only happens in dataTask, dataZoom, map, currently. // where dataZoom do not set end each time, but only set - // when reset. So we should record the setted end, in case + // when reset. So we should record the set end, in case // that the stub of dataZoom perform again and earse the - // setted end by upstream. + // set end by upstream. this._outputDueEnd = this._settedOutputEnd = end; } diff --git a/src/data/DataStore.ts b/src/data/DataStore.ts index bb9dcf179c..6ee076ea35 100644 --- a/src/data/DataStore.ts +++ b/src/data/DataStore.ts @@ -91,7 +91,7 @@ export interface DataStoreDimensionDefine { * For example, in `[{bb: 124, aa: 543}, ...]`, "aa" and "bb" is "object property". * * Deliberately name it as "property" rather than "name" to prevent it from been used in - * SOURCE_FORMAT_ARRAY_ROWS, becuase if it comes from series, it probably + * SOURCE_FORMAT_ARRAY_ROWS, because if it comes from series, it probably * can not be shared by different series. */ property?: string; diff --git a/src/data/SeriesData.ts b/src/data/SeriesData.ts index 83421ccb53..9267177778 100644 --- a/src/data/SeriesData.ts +++ b/src/data/SeriesData.ts @@ -53,7 +53,7 @@ const map = zrUtil.map; const CtorInt32Array = typeof Int32Array === 'undefined' ? Array : Int32Array; // Use prefix to avoid index to be the same as otherIdList[idx], -// which will cause weird udpate animation. +// which will cause weird update animation. const ID_PREFIX = 'e\0\0'; const INDEX_NOT_FOUND = -1; @@ -159,12 +159,12 @@ class SeriesData< * Name of dimensions list of SeriesData. * * @caution Carefully use the index of this array. - * Becuase when DataStore is an extra high dimension(>30) dataset. We will only pick + * Because when DataStore is an extra high dimension(>30) dataset. We will only pick * the used dimensions from DataStore to avoid performance issue. */ readonly dimensions: SeriesDimensionName[]; - // Infomation of each data dimension, like data type. + // Information of each data dimension, like data type. private _dimInfos: Record; private _dimOmitted = false; @@ -192,7 +192,7 @@ class SeriesData< /** * @readonly - * Host tree if List is used to store tree ndoes. + * Host tree if List is used to store tree nodes. */ tree?: Tree; @@ -208,7 +208,7 @@ class SeriesData< // Global visual properties after visual coding private _visual: Dictionary = {}; - // Globel layout properties. + // Global layout properties. private _layout: Dictionary = {}; // Item visual properties after visual coding @@ -217,7 +217,7 @@ class SeriesData< // Item layout properties after layout private _itemLayouts: any[] = []; - // Graphic elemnents + // Graphic elements private _graphicEls: Element[] = []; // key: dim, value: extent @@ -357,7 +357,7 @@ class SeriesData< * Because only those dimensions will have auto-generated dimension names if not * have a user-specified name, and other dimensions will get a return of null/undefined. * - * @notice Becuause of this reason, should better use `getDimensionIndex` instead, for examples: + * @notice Because of this reason, should better use `getDimensionIndex` instead, for examples: * ```js * const val = data.getStore().get(data.getDimensionIndex(dim), dataIdx); * ``` @@ -375,7 +375,7 @@ class SeriesData< return this.dimensions[dimIdx]; } - // Retrieve from series dimension definition becuase it probably contains + // Retrieve from series dimension definition because it probably contains // generated dimension name (like 'x', 'y'). const dimName = this._dimIdxToName.get(dimIdx); if (dimName != null) { @@ -419,7 +419,7 @@ class SeriesData< * + If there is the same concrete dim name defined in `series.dimensions` or `dataset.dimensions`, * it means that concrete name. * + If not, it will be converted to a number, which means the index of the dimension. - * (why? because of the backward compatbility. We have been tolerating number-like string in + * (why? because of the backward compatibility. We have been tolerating number-like string in * dimension setting, although now it seems that it is not a good idea.) * For example, `visualMap[i].dimension: "1"` is the same meaning as `visualMap[i].dimension: 1`, * if no dimension name is defined as `"1"`. @@ -427,7 +427,7 @@ class SeriesData< * For example, it can be be default name `"x"`, `"y"`, `"z"`, `"lng"`, `"lat"`, `"angle"`, `"radius"`, * or customized in `dimensions` property of option like `"age"`. * - * @return recogonized `DimensionIndex`. Otherwise return null/undefined (means that dim is `DimensionName`). + * @return recognized `DimensionIndex`. Otherwise return null/undefined (means that dim is `DimensionName`). */ private _recognizeDimIndex(dim: DimensionLoose): DimensionIndex { if (zrUtil.isNumber(dim) @@ -447,7 +447,7 @@ class SeriesData< const dimIdx = this.getDimensionIndex(dim); if (__DEV__) { if (dimIdx == null) { - throw new Error('Unkown dimension ' + dim); + throw new Error('Unknown dimension ' + dim); } } return dimIdx; @@ -580,7 +580,7 @@ class SeriesData< * [NaN, 43, 1], * ['-', 'asdf', 0] * ] - * Each item is exaclty cooresponding to a dimension. + * Each item is exactly corresponding to a dimension. */ appendValues(values: any[][], names?: string[]): void { const {start, end} = this._store.appendValues(values, names.length); @@ -690,7 +690,7 @@ class SeriesData< /** * Calculate extent on a filtered data might be time consuming. - * Approximate extent is only used for: calculte extent of filtered data outside. + * Approximate extent is only used for: calculate extent of filtered data outside. */ setApproximateExtent(extent: [number, number], dim: SeriesDimensionLoose): void { dim = this.getDimension(dim); @@ -723,7 +723,7 @@ class SeriesData< } /** - * @return Never be null/undefined. `number` will be converted to string. Becuase: + * @return Never be null/undefined. `number` will be converted to string. Because: * In most cases, name is used in display, where returning a string is more convenient. * In other cases, name is used in query (see `indexOfName`), where we can keep the * rule that name `2` equals to name `'2'`. @@ -750,7 +750,7 @@ class SeriesData< } /** - * @return Never null/undefined. `number` will be converted to string. Becuase: + * @return Never null/undefined. `number` will be converted to string. Because: * In all cases having encountered at present, id is used in making diff comparison, which * are usually based on hash map. We can keep the rule that the internal id are always string * (treat `2` is the same as `'2'`) to make the related logic simple. @@ -816,7 +816,7 @@ class SeriesData< } /** - * If value is NaN. Inlcuding '-' + * If value is NaN. Including '-' * Only check the coord dimensions. */ hasValue(idx: number): boolean { @@ -833,7 +833,7 @@ class SeriesData< } /** - * Retreive the index with given name + * Retrieve the index with given name */ indexOfName(name: string): number { for (let i = 0, len = this._store.count(); i < len; i++) { @@ -874,7 +874,7 @@ class SeriesData< } /** - * Retreive the index of nearest value + * Retrieve the index of nearest value * @param dim * @param value * @param [maxDistance=Infinity] @@ -1069,8 +1069,8 @@ class SeriesData< ); // If do shallow clone here, if there are too many stacked series, - // it still cost lots of memory, becuase `_store.dimensions` are not shared. - // We should consider there probably be shallow clone happen in each sereis + // it still cost lots of memory, because `_store.dimensions` are not shared. + // We should consider there probably be shallow clone happen in each series // in consequent filter/map. this._store.modify( dimIndices, @@ -1124,7 +1124,7 @@ class SeriesData< */ // TODO: Type of data item getItemModel(idx: number): Model > { const hostModel = this.hostModel; @@ -1433,7 +1433,7 @@ class SeriesData< }; /** - * Data in excludeDimensions is copied, otherwise transfered. + * Data in excludeDimensions is copied, otherwise transferred. */ cloneListForMapAndSample = function (original: SeriesData): SeriesData { const list = new SeriesData( diff --git a/src/data/helper/SeriesDataSchema.ts b/src/data/helper/SeriesDataSchema.ts index 67e9f1fc9a..975f92ba23 100644 --- a/src/data/helper/SeriesDataSchema.ts +++ b/src/data/helper/SeriesDataSchema.ts @@ -157,8 +157,8 @@ export class SeriesDataSchema { // If retrieving data by index, // use to determine whether data can be shared. - // (Becuase in this case there might be no dimension name defined in dataset, but indices always exists). - // (indices are always 0, 1, 2, ..., so we can ignore them to shorten the hash). + // (Because in this case there might be no dimension name defined in dataset, but indices always exists). + // (Indices are always 0, 1, 2, ..., so we can ignore them to shorten the hash). // Otherwise if retrieving data by property name (like `data: [{aa: 123, bb: 765}, ...]`), // use in hash. if (willRetrieveDataByName diff --git a/src/data/helper/transform.ts b/src/data/helper/transform.ts index cfb2b188be..1e51f45724 100644 --- a/src/data/helper/transform.ts +++ b/src/data/helper/transform.ts @@ -143,7 +143,7 @@ export class ExternalSource { /** * Only support by dimension index. * No need to support by dimension name in transform function, - * becuase transform function is not case-specific, no need to use name literally. + * because transform function is not case-specific, no need to use name literally. */ retrieveValue(dataIndex: number, dimIndex: DimensionIndex): OptionDataValue { return; @@ -180,8 +180,8 @@ function createExternalSource(internalSource: Source, externalTransform: Externa // [MEMO] // Create a new dimensions structure for exposing. // Do not expose all dimension info to users directly. - // Becuase the dimension is probably auto detected from data and not might reliable. - // Should not lead the transformers to think that is relialbe and return it. + // Because the dimension is probably auto detected from data and not might reliable. + // Should not lead the transformers to think that is reliable and return it. // See [DIMENSION_INHERIT_RULE] in `sourceManager.ts`. const dimensions = [] as ExternalDimensionDefinition[]; const dimsByName = {} as Dictionary; @@ -505,7 +505,7 @@ function applySingleDataTransform( && !result.dimensions ) { const startIndex = firstUpSource.startIndex; - // We copy the header of upstream to the result becuase: + // We copy the header of upstream to the result, because: // (1) The returned data always does not contain header line and can not be used // as dimension-detection. In this case we can not use "detected dimensions" of // upstream directly, because it might be detected based on different `seriesLayoutBy`. diff --git a/src/export/api.ts b/src/export/api.ts index 6575f7995b..3c6e9d4b21 100644 --- a/src/export/api.ts +++ b/src/export/api.ts @@ -55,7 +55,7 @@ export * as util from './api/util'; export {default as env} from 'zrender/src/core/env'; -// --------------------- Export for Exension Usage --------------------- +// --------------------- Export for Extension Usage --------------------- // export {SeriesData}; export {SeriesData as List}; // TODO: Compatitable with exists echarts-gl code export {default as Model} from '../model/Model'; @@ -77,7 +77,7 @@ export {brushSingle as innerDrawElementOnCanvas} from 'zrender/src/canvas/graphi // Should use `ComponentModel.extend` or `class XXXX extend ComponentModel` to create class. // Then use `registerComponentModel` in `install` parameter when `use` this extension. For example: // class Bar3DModel extends ComponentModel {} -// export function install(registers) { regsiters.registerComponentModel(Bar3DModel); } +// export function install(registers) { registers.registerComponentModel(Bar3DModel); } // echarts.use(install); export function extendComponentModel(proto: object): ComponentModel { const Model = (ComponentModel as ComponentModelConstructor).extend(proto) as any; diff --git a/src/export/api/helper.ts b/src/export/api/helper.ts index 3d63a7b140..92a4ddf66a 100644 --- a/src/export/api/helper.ts +++ b/src/export/api/helper.ts @@ -40,7 +40,7 @@ import { createTextStyle as innerCreateTextStyle } from '../../label/labelStyle' import { DisplayState, TextCommonOption } from '../../util/types'; /** - * Create a muti dimension List structure from seriesModel. + * Create a multi dimension List structure from seriesModel. */ export function createList(seriesModel: SeriesModel) { return createSeriesData(null, seriesModel); @@ -86,9 +86,9 @@ export function createScale(dataExtent: number[], option: object | AxisBaseModel // FIXME // Currently AxisModelCommonMixin has nothing to do with the // the requirements of `axisHelper.createScaleByModel`. For - // example the method `getCategories` and `getOrdinalMeta` - // are required for `'category'` axis, and ecModel are required - // for `'time'` axis. But occationally echarts-gl happened + // example the methods `getCategories` and `getOrdinalMeta` + // are required for `'category'` axis, and ecModel is required + // for `'time'` axis. But occasionally echarts-gl happened // to only use `'value'` axis. // zrUtil.mixin(axisModel, AxisModelCommonMixin); } @@ -103,7 +103,7 @@ export function createScale(dataExtent: number[], option: object | AxisBaseModel /** * Mixin common methods to axis model, * - * Inlcude methods + * Include methods * `getFormattedLabels() => Array.` * `getCategories() => Array.` * `getMin(origin: boolean) => number` @@ -127,4 +127,4 @@ export function createTextStyle( ) { opts = opts || {}; return innerCreateTextStyle(textStyleModel, null, null, opts.state !== 'normal'); -} \ No newline at end of file +} diff --git a/src/export/charts.ts b/src/export/charts.ts index 1faf7c1b39..4356de9147 100644 --- a/src/export/charts.ts +++ b/src/export/charts.ts @@ -49,7 +49,7 @@ export {install as SunburstChart} from '../chart/sunburst/install'; export {install as CustomChart} from '../chart/custom/install'; -// // NOTE: Don't use XXXSeriesOption from 'option.ts' becuase they have been injected markPoint, markLine etc. +// // NOTE: Don't use XXXSeriesOption from 'option.ts' because they have been injected markPoint, markLine etc. // export {LineSeriesOption} from '../chart/line/LineSeries'; // export {BarSeriesOption} from '../chart/bar/BarSeries'; // export {ScatterSeriesOption} from '../chart/scatter/ScatterSeries'; @@ -96,4 +96,4 @@ export { ThemeRiverSeriesOption, SunburstSeriesOption, CustomSeriesOption -} from './option'; \ No newline at end of file +} from './option'; diff --git a/src/layout/barGrid.ts b/src/layout/barGrid.ts index 9ca8442e9a..519f3eee5a 100644 --- a/src/layout/barGrid.ts +++ b/src/layout/barGrid.ts @@ -363,7 +363,7 @@ function doCalBarWidthAndOffset(seriesInfoList: LayoutSeriesInfo[]) { } else { // `barMinWidth/barMaxWidth` has higher priority than `barWidth`, as - // CSS does. Becuase barWidth can be a percent value, where + // CSS does. Because barWidth can be a percent value, where // `barMaxWidth` can be used to restrict the final width. let finalWidth = column.width; if (maxWidth) { diff --git a/src/model/Component.ts b/src/model/Component.ts index e7728f0f1b..889159ff4d 100644 --- a/src/model/Component.ts +++ b/src/model/Component.ts @@ -50,7 +50,7 @@ const inner = makeInner<{ class ComponentModel extends Model { - // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`, + // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`, // the class members must not be initialized in constructor or declaration place. // Otherwise there is bad case: // class A {xxx = 1;} @@ -72,10 +72,10 @@ class ComponentModel extends Mode /** * Because simplified concept is probably better, series.name (or component.name) - * has been having too many resposibilities: + * has been having too many responsibilities: * (1) Generating id (which requires name in option should not be modified). * (2) As an index to mapping series when merging option or calling API (a name - * can refer to more then one components, which is convinient is some case). + * can refer to more than one component, which is convenient is some cases). * (3) Display. * @readOnly But injected */ @@ -281,7 +281,7 @@ class ComponentModel extends Mode getReferringComponents(mainType: ComponentMainType, opt: QueryReferringOpt): { // Always be array rather than null/undefined, which is convenient to use. models: ComponentModel[]; - // Whether target compoent specified + // Whether target component is specified specified: boolean; } { const indexKey = (mainType + 'Index') as keyof Opt; diff --git a/src/model/Global.ts b/src/model/Global.ts index cadc98b20d..b845d7263d 100644 --- a/src/model/Global.ts +++ b/src/model/Global.ts @@ -164,7 +164,7 @@ class GlobalModel extends Model { private _componentsMap: HashMap; /** - * `_componentsMap` might have "hole" becuase of remove. + * `_componentsMap` might have "hole" because of remove. * So save components count for a certain mainType here. */ private _componentsCount: HashMap; @@ -275,7 +275,7 @@ class GlobalModel extends Model { // By design, if `setOption(option2)` at the second time, and `option2` is a `ECUnitOption`, // it should better not have the same props with `MediaUnit['option']`. - // Becuase either `option2` or `MediaUnit['option']` will be always merged to "current option" + // Because either `option2` or `MediaUnit['option']` will be always merged to "current option" // rather than original "baseOption". If they both override a prop, the result might be // unexpected when media state changed after `setOption` called. // If we really need to modify a props in each `MediaUnit['option']`, use the full version @@ -427,7 +427,7 @@ import { ${seriesImportName} } from 'echarts/charts'; echarts.use([${seriesImportName}]);`); } else { - error(`Unkown series ${subType}`); + error(`Unknown series ${subType}`); } } } @@ -787,7 +787,7 @@ echarts.use([${seriesImportName}]);`); /** * After filtering, series may be different - * frome raw series. + * from raw series. */ eachSeries( cb: (this: T, series: SeriesModel, rawSeriesIndex: number) => void, @@ -817,7 +817,7 @@ echarts.use([${seriesImportName}]);`); /** * After filtering, series may be different. - * frome raw series. + * from raw series. */ eachSeriesByType( subType: ComponentSubType, @@ -921,8 +921,8 @@ echarts.use([${seriesImportName}]);`); }; initBase = function (ecModel: GlobalModel, baseOption: ECUnitOption & AriaOptionMixin): void { - // Using OPTION_INNER_KEY to mark that this option can not be used outside, - // i.e. `chart.setOption(chart.getModel().option);` is forbiden. + // Using OPTION_INNER_KEY to mark that this option cannot be used outside, + // i.e. `chart.setOption(chart.getModel().option);` is forbidden. ecModel.option = {} as ECUnitOption; ecModel.option[OPTION_INNER_KEY] = OPTION_INNER_VALUE; diff --git a/src/model/Model.ts b/src/model/Model.ts index 54babe69f0..542123ce31 100644 --- a/src/model/Model.ts +++ b/src/model/Model.ts @@ -47,7 +47,7 @@ interface Model extends LineStyleMixin, ItemStyleMixin, TextStyleMixin, AreaStyleMixin {} class Model { // TODO: TYPE use unknown instead of any? - // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`, + // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`, // the class members must not be initialized in constructor or declaration place. // Otherwise there is bad case: // class A {xxx = 1;} diff --git a/src/model/OptionManager.ts b/src/model/OptionManager.ts index 21af55f54b..ef795ba58e 100644 --- a/src/model/OptionManager.ts +++ b/src/model/OptionManager.ts @@ -127,7 +127,7 @@ class OptionManager { // the mapping can not be 100% consistent with ecModel, which probably brings // potential bug! - // The first merge is delayed, becuase in most cases, users do not call `setOption` twice. + // The first merge is delayed, because in most cases, users do not call `setOption` twice. // let fakeCmptsMap = this._fakeCmptsMap; // if (!fakeCmptsMap) { // fakeCmptsMap = this._fakeCmptsMap = createHashMap(); @@ -140,7 +140,7 @@ class OptionManager { // For simplicity, timeline options and media options do not support merge, // that is, if you `setOption` twice and both has timeline options, the latter - // timeline opitons will not be merged to the formers, but just substitude them. + // timeline options will not be merged to the former, but just substitute them. if (newParsedOption.timelineOptions.length) { optionBackup.timelineOptions = newParsedOption.timelineOptions; } @@ -392,10 +392,10 @@ function applyMediaQuery(query: MediaQuery, ecWidth: number, ecHeight: number): const realMap = { width: ecWidth, height: ecHeight, - aspectratio: ecWidth / ecHeight // lowser case for convenientce. + aspectratio: ecWidth / ecHeight // lower case for convenience. }; - let applicatable = true; + let applicable = true; each(query, function (value: number, attr) { const matched = attr.match(QUERY_REG); @@ -408,11 +408,11 @@ function applyMediaQuery(query: MediaQuery, ecWidth: number, ecHeight: number): const realAttr = matched[2].toLowerCase(); if (!compare(realMap[realAttr as keyof typeof realMap], value, operator)) { - applicatable = false; + applicable = false; } }); - return applicatable; + return applicable; } function compare(real: number, expect: number, operator: string): boolean { @@ -449,9 +449,9 @@ function indicesEquals(indices1: number[], indices2: number[]): boolean { * this might be the only simple way to implement that feature. * * MEMO: We've considered some other approaches: - * 1. Each model handle its self restoration but not uniform treatment. + * 1. Each model handles its self restoration but not uniform treatment. * (Too complex in logic and error-prone) - * 2. Use a shadow ecModel. (Performace expensive) + * 2. Use a shadow ecModel. (Performance expensive) * * FIXME: A possible solution: * Add a extra level of model for each component model. The inheritance chain would be: diff --git a/src/model/Series.ts b/src/model/Series.ts index f4e9923dd9..5a9dd62607 100644 --- a/src/model/Series.ts +++ b/src/model/Series.ts @@ -73,7 +73,7 @@ export const SERIES_UNIVERSAL_TRANSITION_PROP = '__universalTransitionEnabled'; interface SeriesModel { /** - * Convinient for override in extended class. + * Convenient for override in extended class. * Implement it if needed. */ preventIncremental(): boolean; @@ -126,7 +126,7 @@ interface SeriesModel { class SeriesModel extends ComponentModel { - // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`, + // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`, // the class members must not be initialized in constructor or declaration place. // Otherwise there is bad case: // class A {xxx = 1;} @@ -319,7 +319,7 @@ class SeriesModel extends ComponentMode /** * Init a data structure from data related option in series - * Must be overriden. + * Must be overridden. */ getInitialData(option: Opt, ecModel: GlobalModel): SeriesData { return; @@ -426,7 +426,7 @@ class SeriesModel extends ComponentMode /** * Get base axis if has coordinate system and has axis. * By default use coordSys.getBaseAxis(); - * Can be overrided for some chart. + * Can be overridden for some chart. * @return {type} description */ getBaseAxis(): Axis { @@ -615,7 +615,7 @@ class SeriesModel extends ComponentMode const selectedMap = option.selectedMap; for (let i = 0; i < len; i++) { const dataIndex = innerDataIndices[i]; - // TODO diffrent types of data share same object. + // TODO different types of data share same object. const nameOrId = getSelectionKey(data, dataIndex); selectedMap[nameOrId] = true; this._selectedDataIndicesMap[nameOrId] = data.getRawIndex(dataIndex); diff --git a/src/model/internalComponentCreator.ts b/src/model/internalComponentCreator.ts index ad8dfe5cc7..df53e66f2d 100644 --- a/src/model/internalComponentCreator.ts +++ b/src/model/internalComponentCreator.ts @@ -28,9 +28,9 @@ import { isComponentIdInternal } from '../util/model'; // It is added since echarts 3. // (3) Why keep supporting "internal component" in global model rather than // make each type components manage their models themselves? -// Because a protential feature that reproduce a chart from a diffferent chart instance -// might be useful in some BI analysis scenario, where the entire state need to be -// retrieved from the current chart instance. So we'd bettern manage the all of the +// Because a potential feature that reproduces a chart from a different chart instance +// might be useful in some BI analysis scenario, where the entire state needs to be +// retrieved from the current chart instance. So we'd better manage all of the // state universally. // (4) Internal component always merged in "replaceMerge" approach, that is, if the existing // internal components does not matched by a new option with the same id, it will be diff --git a/src/model/mixin/dataFormat.ts b/src/model/mixin/dataFormat.ts index 76a8fff1c1..2c39816235 100644 --- a/src/model/mixin/dataFormat.ts +++ b/src/model/mixin/dataFormat.ts @@ -211,8 +211,8 @@ type TooltipFormatResult = // compat it? // type TooltipFormatResultLegacyObject = { // // `html` means the markup language text, either in 'html' or 'richText'. -// // The name `html` is not appropriate becuase in 'richText' it is not a HTML -// // string. But still support it for backward compat. +// // The name `html` is not appropriate because in 'richText' it is not a HTML +// // string. But still support it for backward compatibility. // html: string; // markers: Dictionary; // }; diff --git a/src/scale/Interval.ts b/src/scale/Interval.ts index 866051dcf2..3fc00cf142 100644 --- a/src/scale/Interval.ts +++ b/src/scale/Interval.ts @@ -79,8 +79,8 @@ class IntervalScale = Dictionary> e setInterval(interval: number): void { this._interval = interval; - // Dropped auto calculated niceExtent and use user setted extent - // We assume user wan't to set both interval, min, max to get a better result + // Dropped auto calculated niceExtent and use user-set extent. + // We assume user wants to set both interval, min, max to get a better result. this._niceExtent = this._extent.slice() as [number, number]; this._intervalPrecision = helper.getIntervalPrecision(interval); diff --git a/src/scale/Time.ts b/src/scale/Time.ts index 5b097953e3..2458490b2e 100644 --- a/src/scale/Time.ts +++ b/src/scale/Time.ts @@ -18,7 +18,7 @@ */ /* -* A third-party license is embeded for some of the code in this file: +* A third-party license is embedded for some of the code in this file: * The "scaleLevels" was originally copied from "d3.js" with some * modifications made for this project. * (See more details in the comment on the definition of "scaleLevels" below.) @@ -31,9 +31,9 @@ // [About UTC and local time zone]: // In most cases, `number.parseDate` will treat input data string as local time // (except time zone is specified in time string). And `format.formateTime` returns -// local time by default. option.useUTC is false by default. This design have -// concidered these common case: -// (1) Time that is persistent in server is in UTC, but it is needed to be diplayed +// local time by default. option.useUTC is false by default. This design has +// considered these common cases: +// (1) Time that is persistent in server is in UTC, but it is needed to be displayed // in local time by default. // (2) By default, the input data string (e.g., '2011-01-02') should be displayed // as its original time, without any time difference. @@ -371,7 +371,7 @@ function isUnitValueSame( function getDateInterval(approxInterval: number, daysInMonth: number) { approxInterval /= ONE_DAY; return approxInterval > 16 ? 16 - // Math.floor(daysInMonth / 2) + 1 // In this case we only want one tick betwen two month. + // Math.floor(daysInMonth / 2) + 1 // In this case we only want one tick between two months. : approxInterval > 7.5 ? 7 // TODO week 7 or day 8? : approxInterval > 3.5 ? 4 : approxInterval > 1.5 ? 2 : 1; diff --git a/src/util/types.ts b/src/util/types.ts index 36e970da6d..4dedd94285 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -411,7 +411,7 @@ export interface OrdinalScaleTick extends ScaleTick { * const coord = dataToCoord(ordinalScale.getRawOrdinalNumber(tick.value)). * ``` * Why place the tick value here rather than the raw ordinal value (like LogScale did)? - * Becuase ordinal scale sort is the different case from LogScale, where + * Because ordinal scale sort is the different case from LogScale, where * axis tick, splitArea should better not to be sorted, especially in * anid(animation id) when `boundaryGap: true`. * Only axis label are sorted. diff --git a/src/view/Chart.ts b/src/view/Chart.ts index bb4639915d..734dece866 100644 --- a/src/view/Chart.ts +++ b/src/view/Chart.ts @@ -97,7 +97,7 @@ interface ChartView { } class ChartView { - // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`, + // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`, // the class members must not be initialized in constructor or declaration place. // Otherwise there is bad case: // class A {xxx = 1;} diff --git a/src/view/Component.ts b/src/view/Component.ts index ed7fa8ef37..9b1309fb57 100644 --- a/src/view/Component.ts +++ b/src/view/Component.ts @@ -62,7 +62,7 @@ interface ComponentView { class ComponentView { - // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`, + // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`, // the class members must not be initialized in constructor or declaration place. // Otherwise there is bad case: // class A {xxx = 1;} diff --git a/src/visual/VisualMapping.ts b/src/visual/VisualMapping.ts index f964e3fb0a..7610bd235a 100644 --- a/src/visual/VisualMapping.ts +++ b/src/visual/VisualMapping.ts @@ -44,7 +44,7 @@ type NormalizedValue = number; type MappingMethod = 'linear' | 'piecewise' | 'category' | 'fixed'; -// May include liftZ. wich is not provided to developers. +// May include liftZ. which is not provided to developers. interface Normalizer { (this: VisualMapping, value?: RawValue): NormalizedValue @@ -361,7 +361,7 @@ class VisualMapping { } /** - * Convinent method. + * Convenient method. * Visual can be Object or Array or primary type. */ static eachVisual( diff --git a/src/visual/aria.ts b/src/visual/aria.ts index 4c1b823f55..7237c36cdd 100644 --- a/src/visual/aria.ts +++ b/src/visual/aria.ts @@ -64,7 +64,7 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) { const useDecal = decalModel.get('show'); if (useDecal) { // Each type of series use one scope. - // Pie and funnel are using diferrent scopes + // Pie and funnel are using different scopes. const paletteScopeGroupByType = zrUtil.createHashMap(); ecModel.eachSeries((seriesModel: SeriesModel) => { if (seriesModel.isColorBySeries()) { diff --git a/src/visual/helper.ts b/src/visual/helper.ts index 5c60f6f99d..1ea371d9ff 100644 --- a/src/visual/helper.ts +++ b/src/visual/helper.ts @@ -18,7 +18,7 @@ */ /** - * A mapping of visual provided to deverloper and visual stored in the List module. + * A mapping of visual provided to developer and visual stored in the List module. * To developer: * 'color', 'opacity', 'symbol', 'symbolSize'... * In the List module storage: @@ -85,4 +85,4 @@ export function setItemVisualFromData(data: SeriesData, dataIndex: number, key: console.warn(`Unknown visual type ${key}`); } } -} \ No newline at end of file +} diff --git a/src/visual/style.ts b/src/visual/style.ts index 0a1888f99c..b0937229bc 100644 --- a/src/visual/style.ts +++ b/src/visual/style.ts @@ -43,7 +43,7 @@ function getStyleMapper(seriesModel: SeriesModel, stylePath: string) { const styleMapper = seriesModel.visualStyleMapper || defaultStyleMappers[stylePath as 'itemStyle' | 'lineStyle']; if (!styleMapper) { - console.warn(`Unkown style type '${stylePath}'.`); + console.warn(`Unknown style type '${stylePath}'.`); return defaultStyleMappers.itemStyle; } return styleMapper; @@ -55,7 +55,7 @@ function getDefaultColorKey(seriesModel: SeriesModel, stylePath: string): 'strok || defaultColorKey[stylePath as 'itemStyle' | 'lineStyle']; if (!colorKey) { - console.warn(`Unkown style type '${stylePath}'.`); + console.warn(`Unknown style type '${stylePath}'.`); return 'fill'; } diff --git a/test/candlestick-doji.html b/test/candlestick-doji.html index d118c37a3f..05b9d0c425 100644 --- a/test/candlestick-doji.html +++ b/test/candlestick-doji.html @@ -1,4 +1,4 @@ - + + + + + + -
-
+ + + +
+
+
+ + + + + + - require([ - 'echarts', - 'data/security-sh-2013.json.js' - ], function (echarts, rawData) { - chart = echarts.init(document.getElementById('main'), null, { - }); - option = { - title: { - text: "十字星颜色测试,期望值:红、红、红、绿、红、红、红、绿" - }, + + + + + + + + - \ No newline at end of file + diff --git a/test/pie-percent.html b/test/pie-percent.html index 06372ba5ac..274a95face 100644 --- a/test/pie-percent.html +++ b/test/pie-percent.html @@ -38,8 +38,8 @@
- - +
+
@@ -85,6 +85,128 @@ }); + + + diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json index c08e7ae77e..a72207f78b 100644 --- a/test/runTest/actions/__meta__.json +++ b/test/runTest/actions/__meta__.json @@ -153,6 +153,7 @@ "pie-cornerRadius": 1, "pie-label": 2, "pie-label-extreme": 2, + "pie-percent": 2, "polar-rounded": 3, "polarLine": 1, "polarScatter": 1, diff --git a/test/runTest/actions/pie-percent.json b/test/runTest/actions/pie-percent.json new file mode 100644 index 0000000000..3ab9358840 --- /dev/null +++ b/test/runTest/actions/pie-percent.json @@ -0,0 +1 @@ +[{"name":"Action 1","ops":[{"type":"mousemove","time":417,"x":193,"y":190},{"type":"mousemove","time":617,"x":238,"y":212},{"type":"mousedown","time":840,"x":238,"y":212},{"type":"mouseup","time":991,"x":238,"y":212},{"time":992,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":1701,"x":241,"y":212},{"type":"mousemove","time":1906,"x":320,"y":214},{"type":"mousemove","time":2117,"x":289,"y":217},{"type":"mousedown","time":2330,"x":289,"y":217},{"type":"mouseup","time":2461,"x":289,"y":217},{"time":2462,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":3233,"x":288,"y":217},{"type":"mousemove","time":3433,"x":350,"y":211},{"type":"mousedown","time":3596,"x":354,"y":210},{"type":"mousemove","time":3639,"x":354,"y":210},{"type":"mouseup","time":3699,"x":354,"y":210},{"time":3700,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":3867,"x":356,"y":210},{"type":"mousemove","time":4073,"x":436,"y":211},{"type":"mousemove","time":4289,"x":437,"y":211},{"type":"mousedown","time":4310,"x":437,"y":211},{"type":"mouseup","time":4432,"x":437,"y":211},{"time":4433,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":4516,"x":447,"y":213},{"type":"mousemove","time":4716,"x":483,"y":217},{"type":"mousedown","time":4923,"x":498,"y":217},{"type":"mousemove","time":4928,"x":498,"y":217},{"type":"mouseup","time":5027,"x":498,"y":217},{"time":5028,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":5135,"x":517,"y":218},{"type":"mousemove","time":5341,"x":549,"y":214},{"type":"mousemove","time":5557,"x":560,"y":211},{"type":"mousedown","time":5690,"x":562,"y":210},{"type":"mousemove","time":5791,"x":563,"y":209},{"type":"mouseup","time":5807,"x":563,"y":209},{"time":5808,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":6000,"x":542,"y":209},{"type":"mousemove","time":6205,"x":364,"y":209},{"type":"mousemove","time":6417,"x":248,"y":212},{"type":"mousedown","time":6573,"x":216,"y":214},{"type":"mousemove","time":6623,"x":216,"y":214},{"type":"mouseup","time":6690,"x":215,"y":214},{"time":6691,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":6835,"x":214,"y":215},{"type":"mousemove","time":7043,"x":283,"y":215},{"type":"mousemove","time":7257,"x":308,"y":212},{"type":"mousedown","time":7281,"x":308,"y":212},{"type":"mouseup","time":7377,"x":308,"y":212},{"time":7378,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":7466,"x":326,"y":213},{"type":"mousemove","time":7666,"x":362,"y":211},{"type":"mousedown","time":7874,"x":369,"y":211},{"type":"mousemove","time":7890,"x":369,"y":211},{"type":"mouseup","time":7976,"x":369,"y":211},{"time":7977,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":7999,"x":370,"y":211},{"type":"mousemove","time":8199,"x":394,"y":210},{"type":"mousemove","time":8399,"x":376,"y":214},{"type":"mousemove","time":8599,"x":255,"y":217},{"type":"mousedown","time":8725,"x":249,"y":217},{"type":"mousemove","time":8808,"x":249,"y":217},{"type":"mouseup","time":8825,"x":249,"y":217},{"time":8826,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":8949,"x":255,"y":216},{"type":"mousemove","time":9149,"x":410,"y":209},{"type":"mousedown","time":9292,"x":424,"y":208},{"type":"mousemove","time":9358,"x":424,"y":208},{"type":"mouseup","time":9407,"x":424,"y":208},{"time":9408,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":9566,"x":475,"y":210},{"type":"mousemove","time":9766,"x":503,"y":210},{"type":"mousemove","time":9973,"x":510,"y":206},{"type":"mousedown","time":10139,"x":508,"y":211},{"type":"mousemove","time":10222,"x":508,"y":211},{"type":"mouseup","time":10247,"x":508,"y":211},{"time":10248,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":10549,"x":508,"y":212},{"type":"mousemove","time":10749,"x":549,"y":210},{"type":"mousedown","time":10914,"x":558,"y":210},{"type":"mousemove","time":10957,"x":558,"y":210},{"type":"mouseup","time":11032,"x":558,"y":210},{"time":11033,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":11134,"x":555,"y":211},{"type":"mousemove","time":11341,"x":490,"y":219},{"type":"mousemove","time":11545,"x":348,"y":215},{"type":"mousedown","time":11741,"x":308,"y":211},{"type":"mousemove","time":11748,"x":308,"y":211},{"type":"mouseup","time":11861,"x":308,"y":211},{"time":11862,"delay":400,"type":"screenshot-auto"},{"type":"mousedown","time":12424,"x":308,"y":211},{"type":"mousemove","time":12465,"x":308,"y":211},{"type":"mouseup","time":12562,"x":308,"y":211},{"time":12563,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":13499,"x":306,"y":211},{"type":"mousemove","time":13708,"x":240,"y":216},{"type":"mousedown","time":13912,"x":238,"y":216},{"type":"mousemove","time":13940,"x":238,"y":216},{"type":"mouseup","time":14022,"x":238,"y":216},{"time":14023,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":15266,"x":237,"y":216}],"scrollY":333.33331298828125,"scrollX":0,"timestamp":1665204547560},{"name":"Action 2","ops":[{"type":"mousemove","time":410,"x":204,"y":188},{"type":"mousemove","time":610,"x":222,"y":208},{"type":"mousedown","time":801,"x":223,"y":209},{"type":"mousemove","time":817,"x":223,"y":209},{"type":"mousemove","time":828,"x":224,"y":210},{"type":"mouseup","time":942,"x":224,"y":210},{"time":943,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":1035,"x":224,"y":210},{"type":"mousemove","time":1360,"x":226,"y":210},{"type":"mousemove","time":1567,"x":305,"y":210},{"type":"mousemove","time":1783,"x":316,"y":210},{"type":"mousedown","time":1866,"x":316,"y":210},{"type":"mouseup","time":2015,"x":316,"y":210},{"time":2016,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":2743,"x":318,"y":210},{"type":"mousemove","time":2943,"x":350,"y":209},{"type":"mousemove","time":3149,"x":365,"y":209},{"type":"mousedown","time":3184,"x":365,"y":209},{"type":"mouseup","time":3382,"x":365,"y":209},{"time":3383,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":3593,"x":366,"y":209},{"type":"mousemove","time":3799,"x":421,"y":210},{"type":"mousemove","time":4017,"x":428,"y":210},{"type":"mousedown","time":4350,"x":428,"y":210},{"type":"mouseup","time":4515,"x":428,"y":210},{"time":4516,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":4710,"x":432,"y":211},{"type":"mousemove","time":4910,"x":479,"y":210},{"type":"mousemove","time":5117,"x":488,"y":210},{"type":"mousedown","time":5464,"x":488,"y":210},{"type":"mouseup","time":5616,"x":488,"y":210},{"time":5617,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":5710,"x":489,"y":210},{"type":"mousemove","time":5918,"x":523,"y":219},{"type":"mousemove","time":6134,"x":556,"y":216},{"type":"mousemove","time":6393,"x":558,"y":214},{"type":"mousedown","time":6604,"x":558,"y":214},{"type":"mouseup","time":6749,"x":558,"y":214},{"time":6750,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":6909,"x":561,"y":213},{"type":"mousemove","time":7109,"x":623,"y":229},{"type":"mousemove","time":7316,"x":646,"y":223},{"type":"mousedown","time":7420,"x":646,"y":223},{"type":"mouseup","time":7550,"x":646,"y":223},{"time":7551,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":8093,"x":647,"y":222},{"type":"mousemove","time":8300,"x":647,"y":221}],"scrollY":792,"scrollX":0,"timestamp":1665204486524}] \ No newline at end of file diff --git a/test/sankey-depth.html b/test/sankey-depth.html index cf34ca6fd6..89a4d2d156 100644 --- a/test/sankey-depth.html +++ b/test/sankey-depth.html @@ -128,6 +128,11 @@ label: { position: 'left' }, + edgeLabel: { + show: true, + color: 'green', + fontSize: 20 + }, // Used to test when the data is null whether it is work well. // data: [], // links: [], diff --git a/test/universalTransition2.html b/test/universalTransition2.html index ef3a998a13..33023a0e47 100644 --- a/test/universalTransition2.html +++ b/test/universalTransition2.html @@ -62,9 +62,9 @@ data: ['Animals', 'Fruits', 'Cars'] }, yAxis: {}, - dataGroupId: '', animationDurationUpdate: ANIMATION_DURATION_UPDATE, series: { + dataGroupId: '', type: 'bar', id: 'main', data: [{