javascript - 如何去除 HighCharts 饼图中的白色边框?

标签 javascript jquery html highcharts

我正在使用 High-charts 来显示饼图,谁能告诉我如何去除半径周围的白色边框。我的代码也在下面给出了图表的屏幕截图。

我对 Highcharts 没有太多经验,如果有人知道这一点,请帮助我。文档也很难阅读和理解

$(function () {
  
  $('#cashflow_graph').highcharts({
        chart: {
            type: 'pie',
			backgroundColor:'red',
        },
        title: {
            text: false
        },
        yAxis: {
            title: {
                text: false
            }
        },
        plotOptions: {
            pie: {
                dataLabels: {
                        enabled: false
                    },
                shadow: false,
                center: ['50%', '50%']
            },
			series: {
				states: {
					hover: {
						enabled: false,
						halo: {
							size: 0
						}
					}
				}
			},
			
        },
		 credits: {
            enabled: false
        },
        tooltip: {
			enabled: false,
            valueSuffix: '%'
        },
        series: [{
            name: 'Cash Flow',
            data: [
                {
                    name: 'Incoming',
                    y: 40,
                   
					color: '#87b22e'
                },
				{
                    name: 'Outgoing',
                    y: 30,
                    
					 color: 'black'
                },
				{
                    name: '',
                    y: 30,
					 color: 'white'
                }
                
            ],
            size: '80%',
            innerSize: '80%',
            dataLabels: {
				enabled: false,
                formatter: function () {
              
					return false;
                }
            }
        }]
    });
  
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts-more.src.js"></script>


<div id="cashflow_graph" style="height: 300px; width:100%;"></div>

enter image description here

最佳答案

您需要将 plotOptions.pie.borderWidth 属性设置为 0:

$(function() {
  $('#cashflow_graph').highcharts({
    chart: {
      type: 'pie',
      backgroundColor: 'red',
    },
    title: {
      text: false
    },
    yAxis: {
      title: {
        text: false
      }
    },
    plotOptions: {
      pie: {
        dataLabels: {
          enabled: false
        },
        shadow: false,
        center: ['50%', '50%'],
        borderWidth: 0 // < set this option
      },
      series: {
        states: {
          hover: {
            enabled: false,
            halo: {
              size: 0
            }
          }
        }
      },

    },
    credits: {
      enabled: false
    },
    tooltip: {
      enabled: false,
      valueSuffix: '%'
    },
    series: [{
      name: 'Cash Flow',
      data: [{
          name: 'Incoming',
          y: 40,

          color: '#87b22e'
        }, {
          name: 'Outgoing',
          y: 30,

          color: 'black'
        }, {
          name: '',
          y: 30,
          color: 'white'
        }

      ],
      size: '80%',
      innerSize: '80%',
      dataLabels: {
        enabled: false,
        formatter: function() {
          return false;
        }
      }
    }]
  });

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts-more.src.js"></script>

<div id="cashflow_graph" style="height: 300px; width:100%;"></div>

关于javascript - 如何去除 HighCharts 饼图中的白色边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30077367/

相关文章:

javascript - 如何使用 d3 根据颜色范围的值对 SVG 图像进行着色?

jquery - 使用 Jquery 的一页导航

javascript - 从跨度到跨度遍历按钮

jquery - 如何查找 ID 与 json 键匹配的表 tr 并填充其他列

jquery - Div 不会右对齐

python - 如何使用 Python+Jinja2 在 html 表单中使用隐藏输入

Javascript 日期 : what is the best way to deal with Daylight Savings Time?

javascript - 为当前域上的每个链接添加/保留查询字符串(如果存在)

javascript - 每隔几秒更改一个元素并与动画同步

javascript - React.js 如何顺序调用axios?