Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/chart/treemap/treemapVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function buildVisuals(
return visuals;
}

function calculateColor(visuals: TreemapVisual) {
export function calculateColor(visuals: TreemapVisual) {
let color = getValueVisualDefine(visuals, 'color') as ColorString;

if (color) {
Expand Down
4 changes: 4 additions & 0 deletions src/model/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import GlobalModel from './Global';
import { AnimationOptionMixin, ModelOption } from '../util/types';
import { Dictionary } from 'zrender/src/core/types';
import { mixin, clone, merge } from 'zrender/src/core/util';
import { calculateColor } from '../chart/treemap/treemapVisual';

// Since model.option can be not only `Dictionary` but also primary types,
// we do this conditional type to avoid getting type 'never';
Expand Down Expand Up @@ -123,6 +124,9 @@ class Model<Opt = ModelOption> { // TODO: TYPE use unknown instead of any?
const option = this.option;

let val = option == null ? option : option[key];
if (val && key === 'color' && ('colorAlpha' in option)){
val = ((calculateColor(option)) as unknown) as Opt[R];
}
if (val == null && !ignoreParent) {
const parentModel = this.parentModel;
if (parentModel) {
Expand Down
121 changes: 121 additions & 0 deletions test/treemap-itemStyle-colorAlpha.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.