带有类别的堆栈图表向左浮动

时间:2016-10-05 02:26:13

标签: html css charts markup

我正在玩CSS div作为图表,我正在尝试制作一个堆积图表,其中div等于div的宽度的100%,而bar的左边部分是一种颜色,另一部分是酒吧是另一个。现在我有:

Range formulaCell = worksheet.Range("A1");
Range referencedRange = formulaCell.DirectPrecedents;

foreach(Range area in referencedRange.Areas)
    foreach(Range cell in area.Cells)
        Debug.Print((cell.Row - formulaCell.Row).ToString);    // -3, -3, -3, -1, 0, 1, 0
.chart div {
  font: 25px sans-serif;
  background-color: #2c3e50;
  text-align: right;
  padding: 3px;
  margin: 1px;
  color: white;
}

以下是https://jsfiddle.net/j63grq88/

2 个答案:

答案 0 :(得分:0)

尝试将display: inline-block;添加到两个div

答案 1 :(得分:0)

尝试这个:



.chart{
  overflow-x:hidden;
}
.chart div {
  font: 25px sans-serif;
  background-color: #2c3e50;
  text-align: right;
  padding: 3px;
  margin: 1px;
  color: white;
  position: relative;
}
.chart div:after{
  content: '';
   position: absolute;
   top:0;
   left:0;
  width: 300%;
  height: 100%;
  background: red;
  z-index: -1;
}

<div class="chart">
  <div style="width: 49.81%;">1, $4,980,777</div>
  <div style="width: 41.10%;">2, $4,109,778</div>
</div>
&#13;
&#13;
&#13;