为了账号安全,请及时绑定邮箱和手机立即绑定

直方图类型 highcharts 访问系列

直方图类型 highcharts 访问系列

蝴蝶不菲 2023-03-24 15:41:22
我有一个直方图类型的高图,我需要在图表事件更新函数中访问series[0].data以更改点颜色。我可以在谷歌开发工具中看到series[0].data包含我所有点的数组,但实际上在 JS 代码中得到一个空数组。点更新后颜色不变。示例:jsfiddle
查看完整描述

1 回答

?
RISEBY

TA贡献1856条经验 获得超5个赞

没有这样的事件chart.events.update。改用渲染 - API: https: //api.highcharts.com/highcharts/chart.events.render

演示: https: //jsfiddle.net/BlackLabel/csdnh6e3/

chart: {    

    events: {

      render: function() {

        console.log('data :', this.series[0].data);

        this.series[0].data.forEach(data => data.update({ 

            color: '#0f5'

        }, false)); // after the update() color of points does not change

      }

    }

  },


查看完整回答
反对 回复 2023-03-24
  • 1 回答
  • 0 关注
  • 87 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号