如何在Highcharts Venn图表中显示多个集合?

时间:2019-06-18 01:26:08

标签: highcharts venn-diagram

我想在单个图表中显示两组维恩图。所以我有以下代码用于A和B集:

Highcharts.chart('container', {
  series: [{
    type: 'venn',
    data: [{
        sets: ['A1'],
        value: 188956
    }, {
        sets: ['A2'],
        value: 211267
    }, {
        sets: ['A1', 'A2'],
        value: 23085,
        name: "overlap"
    }, {
        sets: ['B1'],
        value: 10880
    }, {
        sets: ['B2'],
        value: 10880
    }, {
        sets: ['B1', 'B2'],
        value: 6389,
        name: "overlap"
    }]
  }],
  title: {
    text: 'Sets A and B'
  }
});

一起显示所有内容的真正好处是,四个圆圈的大小彼此成比例。问题是它们的布局方式。我想在A的右侧显示集合B,并在它们之间留一些间距。我还希望将B像A一样水平放置。

这可行吗?

谢谢! 阿尔瓦罗

1 个答案:

答案 0 :(得分:0)

在一个图表中这是不可能的,但是您可以创建多个图表:

Highcharts.chart('container', {
    ...,
    series: [{
        type: 'venn',
        data: [...]
    }]
});

Highcharts.chart('container2', {
    ...,
    series: [{
        type: 'venn',
        data: [...]
    }]
});

实时演示: https://jsfiddle.net/BlackLabel/xy5dfq4s/

文档: https://www.highcharts.com/docs/chart-and-series-types/venn-series