C3.js气泡图选择

时间:2016-02-04 15:13:58

标签: javascript d3.js c3.js

我使用修改后的点创建了气泡图:

var chart = c3.generate({
point: {
   r: 80,
   focus: {
        expand: {
             enabled: false
         }
    },
},
data: {
     columns: [
      ["data", 1.4, 2.5, 1.5],
    ],
type: 'scatter'
},
});

但是当我想选择泡沫时,我需要指出泡沫的中心。如何强制选择整个泡沫呢?

1 个答案:

答案 0 :(得分:4)

point图表的未记录功能允许您设置点灵敏度(应与半径值相同:



var chart = c3.generate({
  point: {
    r: 100,
    sensitivity: 100, // This is the key here.
    focus: {
      expand: {
        enabled: false
      }
    },
  },
  data: {
    columns: [
      ["data", 1.4, 2.5, 1.5],
    ],
    type: 'scatter'
  }
});

<link href="https://cdn.rawgit.com/c3js/c3/0.4.11/c3.css" rel="stylesheet" />
<script src="https://cdn.rawgit.com/c3js/c3/0.4.11/c3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>

<div id="chart"></div>
&#13;
&#13;
&#13;

TBTH灵敏度值默认情况下可能与半径相同。 I've created an issue就是这样。