折线图显示不正确

时间:2018-08-02 15:13:21

标签: html css vue.js

    <template>
      <div>
        <svg viewBox="0 0 500 100" class="line-chart">
          <polyline
            fill="none"
            stroke="#0074d9"
            stroke-width="6"
            :points="points"
          />
        </svg>
      </div>
    </template>

    <script>
    export default {
      name: 'line-chart',
      data () {
        return {
          dataLine: [100, 60, 80, 80, 30, 40],
        }
      },
      computed: {
        points () {
          let points = ''
          let pointsArr = []
          this.data.forEach((d, i) => {
            pointsArr.push(`${i * 20} ${d}`)
          })
          points = pointsArr.join(' ')
          return points
        }
      }
    }
    </script>

    <style>

   .line-chart {
  background: #fff;
  width: 610px;
  height: 130px;
  padding: 20px 20px 20px 0;
  margin-top: 3px;
}

    </style>

This is how the graph is at the moment

我想知道如何使该图的线显示在整个div /容器中?正如您在上传的图片中看到的那样,它显示得非常小。 预先谢谢你

0 个答案:

没有答案