Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/chart/helper/Symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { enterEmphasis, leaveEmphasis, enableHoverEmphasis } from '../../util/st
import {parsePercent} from '../../util/number';
import {getDefaultLabel} from './labelHelper';
import List from '../../data/List';
import { ColorString, BlurScope, AnimationOption } from '../../util/types';
import { ColorString, BlurScope, AnimationOption, ZRColor } from '../../util/types';
import SeriesModel from '../../model/Series';
import { PathProps } from 'zrender/src/graphic/Path';
import { SymbolDrawSeriesScope, SymbolDrawItemModelOption } from './SymbolDraw';
Expand All @@ -38,7 +38,7 @@ interface SymbolOpts {
disableAnimation?: boolean

useNameLabel?: boolean
symbolInnerColor?: string
symbolInnerColor?: ZRColor
}

class Symbol extends graphic.Group {
Expand Down
4 changes: 2 additions & 2 deletions src/chart/tree/TreeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {onIrrelevantElement} from '../../component/helper/cursorHelper';
import {parsePercent} from '../../util/number';
import ChartView from '../../view/Chart';
import TreeSeriesModel, { TreeSeriesOption, TreeSeriesNodeItemOption } from './TreeSeries';
import Path, { PathProps } from 'zrender/src/graphic/Path';
import Path, { PathProps, PathStyleProps } from 'zrender/src/graphic/Path';
import GlobalModel from '../../model/Global';
import ExtensionAPI from '../../core/ExtensionAPI';
import { TreeNode } from '../../data/Tree';
Expand Down Expand Up @@ -376,7 +376,7 @@ function updateNode(
const isInit = !symbolEl;
const node = data.tree.getNodeByDataIndex(dataIndex);
const itemModel = node.getModel<TreeSeriesNodeItemOption>();
const visualColor = node.getVisual('style').fill;
const visualColor = (node.getVisual('style') as PathStyleProps).fill;
const symbolInnerColor = node.isExpand === false && node.children.length !== 0
? visualColor : '#fff';

Expand Down
15 changes: 8 additions & 7 deletions src/chart/treemap/TreemapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ function renderNode(
}
else {
bg.invisible = false;
const style = thisNode.getVisual('style');
const style = thisNode.getVisual('style') as PathStyleProps;
const visualBorderColor = style.stroke;
const normalStyle = getItemStyleNormal(itemStyleNormalModel);
normalStyle.fill = visualBorderColor;
Expand All @@ -877,7 +877,8 @@ function renderNode(
const upperLabelWidth = thisWidth - 2 * borderWidth;

prepareText(
bg, visualBorderColor, upperLabelWidth, upperHeight, style.opacity,
// PENDING: convert ZRColor to ColorString for text.
bg, visualBorderColor as ColorString, style.opacity,
{x: borderWidth, y: 0, width: upperLabelWidth, height: upperHeight}
);
}
Expand Down Expand Up @@ -923,7 +924,7 @@ function renderNode(
}
else {
content.invisible = false;
const nodeStyle = thisNode.getVisual('style');
const nodeStyle = thisNode.getVisual('style') as PathStyleProps;
const visualColor = nodeStyle.fill;
const normalStyle = getItemStyleNormal(itemStyleNormalModel);
normalStyle.fill = visualColor;
Expand All @@ -932,7 +933,8 @@ function renderNode(
const blurStyle = getStateItemStyle(itemStyleBlurModel);
const selectStyle = getStateItemStyle(itemStyleSelectModel);

prepareText(content, visualColor, contentWidth, nodeStyle.opacity, contentHeight);
// PENDING: convert ZRColor to ColorString for text.
prepareText(content, visualColor as ColorString, nodeStyle.opacity, null);

content.setStyle(normalStyle);
content.ensureState('emphasis').style = emphasisStyle;
Expand All @@ -954,9 +956,8 @@ function renderNode(
rectEl: graphic.Rect,
visualColor: ColorString,
visualOpacity: number,
width: number,
height: number,
upperLabelRect?: RectLike
// Can be null/undefined
upperLabelRect: RectLike
) {
const normalLabelModel = nodeModel.getModel(
upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL
Expand Down
3 changes: 2 additions & 1 deletion src/data/Tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ export class TreeNode {

/**
* Get item visual
* FIXME: make return type better
*/
getVisual(key: string): any {
getVisual(key: string): unknown {
return this.hostTree.data.getItemVisual(this.dataIndex, key as any);
}

Expand Down
4 changes: 2 additions & 2 deletions src/util/symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ZRColor } from './types';

export type ECSymbol = graphic.Path & {
__isEmptyBrush?: boolean
setColor: (color: ZRColor, innerColor?: string) => void
setColor: (color: ZRColor, innerColor?: ZRColor) => void
getColor: () => ZRColor
};
type SymbolCtor = { new(): ECSymbol };
Expand Down Expand Up @@ -306,7 +306,7 @@ const SymbolClz = graphic.Path.extend({
});

// Provide setColor helper method to avoid determine if set the fill or stroke outside
function symbolPathSetColor(this: ECSymbol, color: ZRColor, innerColor?: string) {
function symbolPathSetColor(this: ECSymbol, color: ZRColor, innerColor?: ZRColor) {
if (this.type !== 'image') {
const symbolStyle = this.style;
if (this.__isEmptyBrush) {
Expand Down