Commit 96087349 authored by 崔佳豪's avatar 崔佳豪

fix(BasicChart): 开启系列色

parent 7a46e1dd
import _ from 'lodash'; import _ from 'lodash';
import { DEF_COLORS, DEF_GRAD_COLORS, colorOfSeries, toGRADColorForLine } from './color'; import {
DEF_COLORS,
DEF_GRAD_COLORS,
colorOfSeries,
toGRADColorForLine,
buildDefaultColors,
} from './color';
import { isArray } from './types'; import { isArray } from './types';
import { isAxisChart, isLineType } from './chart'; import { isAxisChart, isLineType } from './chart';
import { buildDefaultTooltip } from './tooltip'; import { buildDefaultTooltip } from './tooltip';
...@@ -222,7 +228,7 @@ export const buildDefaultSeries = (option) => { ...@@ -222,7 +228,7 @@ export const buildDefaultSeries = (option) => {
export const buildDefaultOption = (option) => { export const buildDefaultOption = (option) => {
const exports = {}; const exports = {};
// exports.color = DEF_COLORS; exports.color = buildDefaultColors();
exports.title = buildDefaultTitle(option); exports.title = buildDefaultTitle(option);
(option.dataZoom == undefined || option.dataZoom === null) && (option.dataZoom == undefined || option.dataZoom === null) &&
(exports.dataZoom = defaultDataZoom); (exports.dataZoom = defaultDataZoom);
......
...@@ -2,6 +2,7 @@ import _ from 'lodash'; ...@@ -2,6 +2,7 @@ import _ from 'lodash';
/** 图表全局配置 非echarts配置,自定义的一些全局配置 */ /** 图表全局配置 非echarts配置,自定义的一些全局配置 */
export const globalConfig = {}; export const globalConfig = {};
let unsetPrimaryColor = true;
/** /**
* 注册全局配置的方法 项目中注册一次即可,在项目入口或者初始化完成之后进行注册 或者有切换全局配置需求时,重新注册覆盖 * 注册全局配置的方法 项目中注册一次即可,在项目入口或者初始化完成之后进行注册 或者有切换全局配置需求时,重新注册覆盖
...@@ -15,6 +16,8 @@ export const injectGlobalConfig = (config) => { ...@@ -15,6 +16,8 @@ export const injectGlobalConfig = (config) => {
if (Object.prototype.toString.call(config) !== '[object Object]') if (Object.prototype.toString.call(config) !== '[object Object]')
throw new TypeError('illegal params, config must be an object!'); throw new TypeError('illegal params, config must be an object!');
if (globalConfig.hasOwnProperty('primaryColor')) unsetPrimaryColor = false;
globalConfig = _.merge(globalConfig, config); globalConfig = _.merge(globalConfig, config);
}; };
...@@ -25,6 +28,8 @@ export const injectGlobalConfig = (config) => { ...@@ -25,6 +28,8 @@ export const injectGlobalConfig = (config) => {
*/ */
export const runtimeValidate = () => { export const runtimeValidate = () => {
// primaryColor 主题色 // primaryColor 主题色
globalConfig.primaryColor || if (!globalConfig.primaryColor || unsetPrimaryColor) {
(globalConfig.primaryColor = window.globalConfig?.variableTheme?.primaryColor ?? '#1685FF'); globalConfig.primaryColor = window.globalConfig?.variableTheme?.primaryColor ?? '#1685FF';
unsetPrimaryColor = true;
}
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment