微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

有没有一种方法可以在单击 c3.js 时更新图形?

如何解决有没有一种方法可以在单击 c3.js 时更新图形?

我使用 c3 .js 绘制折线图时间序列,我想在单击按钮时添加一个按钮,我们显示基于 cumul 而不是 val 的图形... 或在 val 和 cumul 之间添加一个切换按钮以显示基于 val 或 cumul 的图表

date: ["....","...."]
val : ["..","...",...]
cumul : ["...",...]

var c3_chart = c3.generate({                                              
    bindto:div_id,title: {                                                              
        show: false,text: '',position: 'top-center',},size: {                                                               
        height: parent_height,padding: {                                                            
        top: 10,right: 50,bottom: 10,left: 50,data: {                                                               
        x: 'times',xFormat: date_format,// how the date is parsed                   
        columns: [                                                        
            date,val                                                           
        ],types: {                                                          
            data: 'area-spline'                                           
        },colors: {data: "#58b6a7" },//"rgb(88,182,167)"},type: 'line',onclick: function (d) {                                           
            var formatTime2 = d3.timeFormat('%Y-%m-%d');                  
            var begin=d.x;                                                
            var temp = new Date(d.x);                                     
            var end=temp.setDate(temp.getDate() + 1);                     
            onclick_function(formatTime2(begin),formatTime2(end));        
        },

我想在我们点击按钮时添加一个按钮,我们显示基于 cumul 而不是 val 的图表...

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。