<template lang='pug'>
div.histogram-pane(:id="id")
svg
</template>
<script>
import * as d3 from 'd3'
export default {
name: '',
data () {
return {
id: ''
}
},
methods: {
uuid () {
function s4 () {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1)
}
return (
s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4()
)
},
},
created () {
this.id = this.uuid()
},
mounted () {
//1.创建svg画布
let marge = { top: 60, bottom: 60, left: 60, right: 60 }
// let width = document.getElementById(this.id).clientWidth
// let height = document.getElementById(this.id).clientHeight
let width = 600
let height = 400
const svg = d3.select(this.$el).select(