如何将图像置于仪表中心

时间:2015-10-28 12:50:50

标签: javascript highcharts

我正在尝试将图像放入量表的中心(绘制'X'的位置),似乎无法找到放置代码的位置:/

enter image description here

2 个答案:

答案 0 :(得分:2)

这很有效,我将背景颜色和绘图颜色更改为透明

   chart: {
        backgroundColor: 'transparent',
        borderWidth: 0,
        plotBackgroundColor: 'transparent',
        plotShadow: false,
        plotBorderWidth: 0
     },

我动态地创建了div:

       <div ng-repeat="number in stats.numbers track by $index" id="s{{$index+1}}" class="number col-sm-3"></div>

和css

.number{
   background-image: url("../images/x.png");
   background-repeat: no-repeat;
   background-position: center; 
}

答案 1 :(得分:1)

下面是一个关于如何使用html / css(而不是通过highcharts)的例子。它基于来自highcharts网站的甜甜圈示例:

<强> http://jsfiddle.net/hdnfxz03/

HMTL(图表和图像)

<div id="wrapper">
    <div id="container"></div>
    <img src="http://peanutbutterjellytime.net/img/peanut-butter-jelly-time.gif">
</div>

CSS(将图像置于图表中心)

#wrapper {
    position:relative
    width: 600px; 
    height: 400px
}
#wrapper > img {
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    margin: auto;
    position: absolute;
}
相关问题