How can i change text of legend in c3 pie chart

前端 未结 2 1626
小鲜肉
小鲜肉 2021-02-14 10:04

How can I change the Text of legend of pie chart. I am using c3 charts in my php page. I have already read the documentation of c3 charts but no luck.

Currently i am usi

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-14 10:49

    @agpt Yes. The names property is a good way to go generally because the first property of the columns data array eg 'd1' above is used when doing things like having multiple types on charts. eg for a bar and line combination using types instead of type: 'pie':

    columns: [
       ['bar_1', 3, 8, 6],
       ['bar_2', 4, 0, 7],
       ['bar_3', 2, 3, 0] 
    ],
    
    types: {
      bar_1: 'bar',
      bar_2: 'line',
      bar_3: 'bar'
    },
    
    names : {
          bar_1: 'Initial',
          bar_2: '3 month',
          bar_3: '6 month'                
    }
    

    So, using the names property allows you to use more 'dynamic' property names and be consistent throughout the config.

提交回复
热议问题