highcharts 如何在Highcarts动画图中添加渐变效果?

voj3qocg  于 2023-08-05  发布在  Highcharts
关注(0)|答案(1)|浏览(132)

我有一个highcharts图表和figma文件看起来像下面的图片。Highcharts图表是sparkline chart。我如何将透明度和线性渐变效果添加到图表中?


的数据

deikduxw

deikduxw1#

迷你图使用许多area类型的图表,area系列的梯度可以通过series.fillColor选项添加,如下所示:

示例代码:

series: [{
    data: [1, 2, 3, 4, 5],
    fillColor: {
      linearGradient: {
        x1: 0,
        y1: 0,
        x2: 0,
        y2: 1
      },
      stops: [
        [0, Highcharts.getOptions().colors[0]],
        [1, Highcharts.color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
      ]
    }
  }]

字符串

演示:https://jsfiddle.net/BlackLabel/ak1yrL0w/https://jsfiddle.net/BlackLabel/sr0xnw1d/
API引用:https://api.highcharts.com/highcharts/series.area.fillColor

相关问题