Skip to content

Commit

Permalink
update dist and lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaming743 committed Nov 26, 2019
1 parent 7bc73fe commit 1edab03
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 4 deletions.
40 changes: 38 additions & 2 deletions dist/charts.map.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/charts.min.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions lib/config/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,25 @@ var barConfig = {
*/
barStyle: {},

/**
* @description Independent color mode
* When set to true, independent color mode is enabled
* @type {Boolean}
* @default independentColor = false
*/
independentColor: false,

/**
* @description Independent colors
* Only effective when independent color mode is enabled
* Default value is the same as the color in the root configuration
* Two-dimensional color array can produce gradient colors
* @type {Array}
* @example independentColor = ['#fff', '#000']
* @example independentColor = [['#fff', '#000'], '#000']
*/
independentColors: [],

/**
* @description Bar chart render level
* Priority rendering high level
Expand Down
10 changes: 9 additions & 1 deletion lib/core/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,17 @@ function getNormalBarShape(barItem, i) {
function getBarStyle(barItem, i) {
var barStyle = barItem.barStyle,
gradient = barItem.gradient,
color = barItem.color;
color = barItem.color,
independentColor = barItem.independentColor,
independentColors = barItem.independentColors;
var fillColor = [barStyle.fill || color];
var gradientColor = (0, _util2.deepMerge)(fillColor, gradient.color);

if (independentColor) {
var idtColor = independentColors[i % independentColors.length];
gradientColor = idtColor instanceof Array ? idtColor : [idtColor];
}

if (gradientColor.length === 1) gradientColor.push(gradientColor[0]);
var gradientParams = getGradientParams(barItem, i);
return (0, _util2.deepMerge)({
Expand Down
9 changes: 9 additions & 0 deletions lib/core/mergeColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@ function mergeColor(chart) {
return di.color = color[i % colorNum];
});
});
var barWithIndependentColor = series.filter(function (_ref3) {
var type = _ref3.type,
independentColor = _ref3.independentColor;
return type === 'bar' && independentColor;
});
barWithIndependentColor.forEach(function (bar) {
if (bar.independentColors) return;
bar.independentColors = color;
});
}

0 comments on commit 1edab03

Please sign in to comment.