Skip to content

Commit d4d69de

Browse files
authored
Merge pull request #20252 from apache/master
Merge master into next
2 parents fdf2e4d + 7955a46 commit d4d69de

30 files changed

+1040
-87
lines changed

.github/workflows/pr-preview.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ jobs:
4646
workflow: ${{ github.event.workflow.id }}
4747
run_id: ${{ github.event.workflow_run.id }}
4848
name: pr_preview
49+
path: pr-dist
4950
if_no_artifact_found: fail
5051

5152
- name: Output PR metadata
5253
id: pr-metadata
54+
working-directory: pr-dist
5355
run: |
5456
echo "NUMBER=$(cat pr_number)" >> $GITHUB_OUTPUT
5557
echo "COMMIT_SHA=$(cat pr_commit_sha)" >> $GITHUB_OUTPUT
@@ -59,6 +61,7 @@ jobs:
5961
env:
6062
PR_NUMBER: ${{ steps.pr-metadata.outputs.NUMBER }}
6163
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
64+
working-directory: pr-dist
6265
run: |
6366
export SURGE_DOMAIN=https://echarts-pr-$PR_NUMBER.surge.sh
6467
npx surge --project ./package --domain $SURGE_DOMAIN --token $SURGE_TOKEN

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"typescript.tsdk": "./node_modules/typescript/lib"
3-
}
2+
"typescript.tsdk": "./node_modules/typescript/lib",
3+
"typescript.enablePromptUseWorkspaceTsdk": true
4+
}

src/chart/candlestick/CandlestickSeries.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class CandlestickSeriesModel extends SeriesModel<CandlestickSeriesOption> {
124124
},
125125

126126
emphasis: {
127-
scale: true,
128127
itemStyle: {
129128
borderWidth: 2
130129
}

src/chart/candlestick/CandlestickView.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import * as zrUtil from 'zrender/src/core/util';
2121
import ChartView from '../../view/Chart';
2222
import * as graphic from '../../util/graphic';
23-
import { setStatesStylesFromModel } from '../../util/states';
23+
import { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states';
2424
import Path, { PathProps } from 'zrender/src/graphic/Path';
2525
import {createClipPath} from '../helper/createClipPathFromCoordSys';
2626
import CandlestickSeriesModel, { CandlestickDataItemOption } from './CandlestickSeries';
@@ -33,6 +33,7 @@ import { CoordinateSystemClipArea } from '../../coord/CoordinateSystem';
3333
import Model from '../../model/Model';
3434
import { saveOldStyle } from '../../animation/basicTransition';
3535
import Element from 'zrender/src/Element';
36+
import { getBorderColor, getColor } from './candlestickVisual';
3637

3738
const SKIP_PROPS = ['color', 'borderColor'] as const;
3839

@@ -294,6 +295,19 @@ function setBoxCommon(el: NormalBoxPath, data: SeriesData, dataIndex: number, is
294295
el.__simpleBox = isSimpleBox;
295296

296297
setStatesStylesFromModel(el, itemModel);
298+
299+
const sign = data.getItemLayout(dataIndex).sign;
300+
zrUtil.each(el.states, (state, stateName) => {
301+
const stateModel = itemModel.getModel(stateName as any);
302+
const color = getColor(sign, stateModel);
303+
const borderColor = getBorderColor(sign, stateModel) || color;
304+
const stateStyle = state.style || (state.style = {});
305+
color && (stateStyle.fill = color);
306+
borderColor && (stateStyle.stroke = borderColor);
307+
});
308+
309+
const emphasisModel = itemModel.getModel('emphasis');
310+
toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
297311
}
298312

299313
function transInit(points: number[][], itemLayout: CandlestickItemLayout) {
@@ -391,12 +405,9 @@ function createLarge(
391405

392406
function setLargeStyle(sign: number, el: LargeBoxPath, seriesModel: CandlestickSeriesModel, data: SeriesData) {
393407
// TODO put in visual?
394-
let borderColor = seriesModel.get(['itemStyle', sign > 0 ? 'borderColor' : 'borderColor0'])
408+
const borderColor = getBorderColor(sign, seriesModel)
395409
// Use color for border color by default.
396-
|| seriesModel.get(['itemStyle', sign > 0 ? 'color' : 'color0']);
397-
if (sign === 0) {
398-
borderColor = seriesModel.get(['itemStyle', 'borderColorDoji']);
399-
}
410+
|| getColor(sign, seriesModel);
400411

401412
// Color must be excluded.
402413
// Because symbol provide setColor individually to set fill and stroke

src/chart/candlestick/candlestickVisual.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ const dojiBorderColorQuery = ['itemStyle', 'borderColorDoji'] as const;
2929
const positiveColorQuery = ['itemStyle', 'color'] as const;
3030
const negativeColorQuery = ['itemStyle', 'color0'] as const;
3131

32+
export function getColor(sign: number, model: Model<Pick<CandlestickDataItemOption, 'itemStyle'>>) {
33+
return model.get(
34+
sign > 0 ? positiveColorQuery : negativeColorQuery
35+
);
36+
}
37+
38+
export function getBorderColor(sign: number, model: Model<Pick<CandlestickDataItemOption, 'itemStyle'>>) {
39+
return model.get(
40+
sign === 0 ? dojiBorderColorQuery
41+
: sign > 0
42+
? positiveBorderColorQuery
43+
: negativeBorderColorQuery
44+
);
45+
}
46+
3247
const candlestickVisual: StageHandler = {
3348

3449
seriesType: 'candlestick',
@@ -39,22 +54,6 @@ const candlestickVisual: StageHandler = {
3954
performRawSeries: true,
4055

4156
reset: function (seriesModel: CandlestickSeriesModel, ecModel) {
42-
43-
function getColor(sign: number, model: Model<Pick<CandlestickDataItemOption, 'itemStyle'>>) {
44-
return model.get(
45-
sign > 0 ? positiveColorQuery : negativeColorQuery
46-
);
47-
}
48-
49-
function getBorderColor(sign: number, model: Model<Pick<CandlestickDataItemOption, 'itemStyle'>>) {
50-
return model.get(
51-
sign === 0 ? dojiBorderColorQuery
52-
: sign > 0
53-
? positiveBorderColorQuery
54-
: negativeBorderColorQuery
55-
);
56-
}
57-
5857
// Only visible series has each data be visual encoded
5958
if (ecModel.isSeriesFiltered(seriesModel)) {
6059
return;

src/chart/line/LineView.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ class LineView extends ChartView {
624624

625625
this._symbolDraw = symbolDraw;
626626
this._lineGroup = lineGroup;
627+
628+
this._changePolyState = zrUtil.bind(this._changePolyState, this);
627629
}
628630

629631
render(seriesModel: LineSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
@@ -885,9 +887,7 @@ class LineView extends ChartView {
885887
toggleHoverEmphasis(polygon, focus, blurScope, emphasisDisabled);
886888
}
887889

888-
const changePolyState = (toState: DisplayState) => {
889-
this._changePolyState(toState);
890-
};
890+
const changePolyState = this._changePolyState;
891891

892892
data.eachItemGraphicEl(function (el) {
893893
// Switch polyline / polygon state if element changed its state.

src/chart/pie/labelLayout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function adjustSingleSide(
8989
const rA = r + item.len;
9090
const rA2 = rA * rA;
9191
// Use ellipse implicit function to calculate x
92-
const dx = Math.sqrt((1 - Math.abs(dy * dy / rB2)) * rA2);
92+
const dx = Math.sqrt(Math.abs((1 - dy * dy / rB2) * rA2));
9393
const newX = cx + (dx + item.len2) * dir;
9494
const deltaX = newX - item.label.x;
9595
const newTargetWidth = item.targetTextWidth - deltaX * dir;

src/chart/treemap/TreemapSeries.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ export interface TreemapSeriesNodeItemOption extends TreemapSeriesVisualOption,
144144

145145
color?: ColorString[] | 'none'
146146

147-
decal?: DecalObject[] | 'none'
147+
decal?: DecalObject[] | 'none',
148+
149+
cursor?: string
148150
}
149151

150152
export interface TreemapSeriesOption

src/chart/treemap/TreemapView.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,9 @@ function renderNode(
877877
// Only for enabling highlight/downplay.
878878
data.setItemGraphicEl(thisNode.dataIndex, group);
879879

880+
const cursorStyle = nodeModel.getShallow('cursor');
881+
cursorStyle && content.attr('cursor', cursorStyle);
882+
880883
enableHoverFocus(group, focusOrIndices, blurScope);
881884
}
882885

src/component/axis/CartesianAxisView.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
123123
const splitLineModel = axisModel.getModel('splitLine');
124124
const lineStyleModel = splitLineModel.getModel('lineStyle');
125125
let lineColors = lineStyleModel.get('color');
126+
const showMinLine = splitLineModel.get('showMinLine') !== false;
127+
const showMaxLine = splitLineModel.get('showMaxLine') !== false;
126128

127129
lineColors = zrUtil.isArray(lineColors) ? lineColors : [lineColors];
128130

@@ -142,6 +144,12 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
142144
for (let i = 0; i < ticksCoords.length; i++) {
143145
const tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
144146

147+
if ((i === 0 && !showMinLine) || (i === ticksCoords.length - 1 && !showMaxLine)) {
148+
continue;
149+
}
150+
151+
const tickValue = ticksCoords[i].tickValue;
152+
145153
if (isHorizontal) {
146154
p1[0] = tickCoord;
147155
p1[1] = gridRect.y;
@@ -156,9 +164,8 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
156164
}
157165

158166
const colorIndex = (lineCount++) % lineColors.length;
159-
const tickValue = ticksCoords[i].tickValue;
160167
const line = new graphic.Line({
161-
anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
168+
anid: tickValue != null ? 'line_' + tickValue : null,
162169
autoBatch: true,
163170
shape: {
164171
x1: p1[0],

0 commit comments

Comments
 (0)