Skip to content

Instantly share code, notes, and snippets.

@mcmoe
Created October 18, 2018 14:11
Show Gist options
  • Save mcmoe/ef61c899096a6bb1ceb1daa7f633d4ed to your computer and use it in GitHub Desktop.
Save mcmoe/ef61c899096a6bb1ceb1daa7f633d4ed to your computer and use it in GitHub Desktop.
How to create a Linear Gradient color in echarts 4
// ...
const color = this._colors[i % this._colors.length];
const colorNext = echarts.color.lift(color, 0.3);
return {
type: 'linear',
x: 0,
y: 1,
x2: 0,
y2: 0,
colorStops: [{
offset: 0, color: color // color at 0% position
}, {
offset: 1, color: colorNext // color at 100% position
}],
globalCoord: false // false by default
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment