代码之家  ›  专栏  ›  技术社区  ›  Baktaawar David Maust

更改太阳爆发可视化的箭头框的大小

  •  0
  • Baktaawar David Maust  · 技术社区  · 6 年前

    我正在使用kerryrodden的fork开源d3和html脚本来实现sunburst可视化。

    https://github.com/mojoaxel/d3-sunburst

    它适用于我的数据,但我的标签较长,因此它在左上角的图例箭头中重叠。

    这是它目前的样子:

    enter image description here

    如果您看到左上角的文本与框重叠。我想拉长方框或减小文本字体大小。

    这是这个代码的css文件。

    #sunburst-breadcrumbs {
      width: 600px;
      height: 70px;
    }
    
    #sunburst-legend {
      padding: 10px 0 0 3px;
    }
    
    #sunburst-breadcrumbs text,
    #sunburst-legend text {
      font-weight: 600;
      fill: #fff;
    }
    
    #sunburst-chart {
      left: 50%;
      position: absolute;
      margin-left: -375px;
    }
    
    #sunburst-chart path {
      stroke: #fff;
    }
    
    #sunburst-description {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 200px;
      text-align: center;
      font-size: 2.5em;
      margin-left: -100px;
      margin-top: -1.25em;
      line-height: 2.5em;
    }
    

    谢谢

    编辑2:

    中间的文本句子丢失,即使路径较多,矩形也仅缩减为4。

    enter image description here

    0 回复  |  直到 6 年前
        1
  •  1
  •   ee2Dev    6 年前

    在这个版本的太阳暴中,

    您可以在此处增加矩形的宽度(英寸太阳风暴.js):

        // Breadcrumb dimensions: width, height, spacing, width of tip/tail.
        breadcrumbs: {
            w: 75,
            h: 30,
            s: 3,
            t: 10
        },
    

      ...
      #sunburst-breadcrumbs text{
        font-size: 3px;
      }
    

    在最初的阳光下 Kerry Roddan

    // Breadcrumb dimensions: width, height, spacing, width of tip/tail.
    var b = {
      w: 175, h: 30, s: 3, t: 10
    };
    

    要减小字体大小,请添加以下css部分:

    <style>
      #sequence text{
        font-size: 10px;
      }
    </style>
    

    增加多边形宽度并减小字体大小: https://bl.ocks.org/ee2dev/4153ee8eafb5a27d32588b12877a0ea7