简体   繁体   English

javascript infovis sunburst-如何空间节点

[英]javascript infovis sunburst - how to space nodes

I'm using this sunburst visualisation 我正在使用这种森伯斯特可视化

Sunburst example 朝阳的例子

and trying to find a way to increase the width (or border width) between the adjacent nodes (shown in the image below as the thin black line separating the nodes "Coordinates" from "Core" 并试图找到一种增加相邻节点之间宽度(或边界宽度)的方法(如下图所示,黑色细线将节点“坐标”与“核心”分开

在此处输入图片说明

The document on configuring the sunburst is here Sunburst docs but I can't see a way to access this property. 有关配置sunburst的文档位于Sunburst docs,但我看不到访问此属性的方法。

Here is an example of the node config: 这是节点配置的示例:

       Node: {
      overridable: true,
      type: 'multipie',
      align: "center",
      angularWidth: 20,
      lineWidth: 20,
      autoWidth: false
    },

I had to access the jit.js library and under the sunburst 'multipie' config, ie: 我必须访问jit.js库并在森伯斯特“ multipie”配置下进行访问,即:

'multipie': {
  'render': function(node, canvas) {
    var height = node.getData('height');
    var ldist = height? height : this.config.levelDistance;
    var span = node.getData('span') / 2, theta = node.pos.theta;
    var begin = theta - span, end = theta + span;
    var polarNode = node.pos.getp(true);
    var polar = new Polar(begin, polarNode.rho);
    var p1coord = polar.getc(true);
    polar.theta = end;
    var p2coord = polar.getc(true);
    polar.rho += ldist;
    var p3coord = polar.getc(true);
    polar.theta = begin;
    var p4coord = polar.getc(true);
    var ctx = canvas.getCtx();
    ctx.moveTo(0, 0);
    ctx.beginPath();
    ctx.arc(0, 0, polarNode.rho, begin, end, false);
    ctx.arc(0, 0, polarNode.rho + ldist, end, begin, true);
    ctx.moveTo(p1coord.x, p1coord.y);
    ctx.lineTo(p4coord.x, p4coord.y);
    ctx.moveTo(p2coord.x, p2coord.y);
    ctx.lineTo(p3coord.x, p3coord.y);
    ctx.fill();

I added the following: 我添加了以下内容:

ctx.strokeStyle = "rgba(247, 247, 247, 0.96)";
ctx.lineWidth   = 0.5;
ctx.save();
ctx.clip();
ctx.lineWidth *= 2;
ctx.fill();
ctx.stroke();
ctx.restore();

The width and color of the stroke is set by ctx.lineWidth and ctx.strokeStyle 笔触的宽度和颜色由ctx.lineWidthctx.strokeStyle设置

Can someone suggest a way of doing this without accessing the library? 有人可以建议一种无需访问库的方法吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM