首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >笔画-达沙雷不能与角6结合。

笔画-达沙雷不能与角6结合。
EN

Stack Overflow用户
提问于 2018-12-24 09:06:05
回答 2查看 2.8K关注 0票数 2

我用了这个角度为6的图表,我在这个图表上遇到了一些冲突,我试图绑定数据,但是我做不到,它不能正常工作,

这个stroke-dasharray="5, 100"给我取代了这个stroke-dasharray="{{this.master.locationVsStatusMap.size}}, 100"

stackblitz

有人知道怎么做正确吗?

提前感谢!

代码语言:javascript
复制
.single-chart {
  width: 33%;
  justify-content: space-around ;
}

.circular-chart {
  display: block;
  margin: 10px auto;
  max-width: 70%;
  max-height: 150px;
}

.circle-bg {
  fill: none;
  stroke: #3c9ee5;
  stroke-width: 3.8;
}

.circle {
  fill: none;
  stroke-width: 3.8;border-right: 1px solid white; border-left: 1px solid white;
  stroke-linecap:square;
  animation: progress 1s ease-out forwards;
}

@keyframes progress {
  0% {
    stroke-dasharray: 0 100;
  }
}

.circular-chart.orange .circle {
  stroke: #ff9f00;border-right: 1px solid white; border-left: 1px solid white;
}

.circular-chart.green .circle {
  stroke: #4CC790;
}

.circular-chart.blue .circle {
  stroke: #3c9ee5;
}

.percentage {
  fill: #666;
  font-family: sans-serif;
  font-size: 0.3em;
  text-anchor: middle;
}
.flex-wrapper {
  display: flex;
  flex-flow: row nowrap;
}
代码语言:javascript
复制
<div class="flex-wrapper">
<div class="single-chart">
  <svg viewBox="0 0 36 36" class="circular-chart orange">
    <path class="circle-bg"
          d="M18 2.0845
          a 15.9155 15.9155 0 0 1 0 31.831
          a 15.9155 15.9155 0 0 1 0 -31.831"
    />
    <path class="circle"
          stroke-dasharray="5, 100"
          d="M18 2.0845
          a 15.9155 15.9155 0 0 1 0 31.831
          a 15.9155 15.9155 0 0 1 0 -31.831"
    />
      <text x="18" y="20.35" class="percentage">50%</text>
  </svg>
</div>
</div>

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-12-24 09:47:10

尝试属性绑定

代码语言:javascript
复制
attr.stroke-dasharray="{{this.master.locationVsStatusMap.size}}, 100"

分叉示例:https://stackblitz.com/edit/angular-wqjlc5

参考这个:https://teropa.info/blog/2016/12/12/graphics-in-angular-2.html

票数 14
EN

Stack Overflow用户

发布于 2020-08-18 12:55:30

使用样式的绑定- https://coryrylan.com/blog/angular-progress-component-with-svg

代码语言:javascript
复制
style.stroke-dasharray="{{varible}}, 100"
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53911327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档