| | |
| | | component.cols = getColumns(component.cols) |
| | | } |
| | | |
| | | if (component.wrap.datatype === 'static') { |
| | | if (component.wrap && component.wrap.datatype === 'static') { |
| | | component.format = '' |
| | | } |
| | | |
| | |
| | | return image |
| | | } |
| | | |
| | | chartToImage(canvas) { |
| | | let image = new Image() |
| | | image.src = canvas.toDataURL('image/jpg') |
| | | image.style = `width:100%;height:${canvas.style.height || '100%'};` |
| | | return image |
| | | } |
| | | |
| | | print = () => { |
| | | const { config, printing } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let charts = document.getElementsByTagName('canvas') |
| | | |
| | | if (charts.length) { |
| | | for (let i = 0; i < charts.length; i++) { |
| | | let img = this.chartToImage(charts[i]) |
| | | let parentNode = charts[i].parentNode |
| | | |
| | | parentNode.append(img) |
| | | } |
| | | |
| | | while (charts[0]) { |
| | | charts[0].remove() |
| | | } |
| | | } |
| | | |
| | | let jubuData = document.getElementById('bill-print').innerHTML |
| | | |
| | | this.setState({printing: true}) |