-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
23 lines (20 loc) · 813 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import path from 'path';
import TableRenderer, { saveImage } from '../../src';
const renderTable = TableRenderer({ paddingHorizontal: 20, paddingVertical: 20, backgroundColor: '#efefef' }).render;
const canvas = renderTable({
title: 'Marketing Summary',
columns: [
{ width: 200, title: 'Campaign', dataIndex: 'campaign' },
{ width: 100, title: 'Install', dataIndex: 'install', align: 'right' },
{ width: 100, title: 'Cost', dataIndex: 'cost', align: 'right' },
],
dataSource: [
'-',
{ campaign: 'Google CPC', install: '12', cost: '$ 400' },
{ campaign: 'Facebook CPC', install: '3', cost: '$ 60' },
{ campaign: 'Youtube Video', install: '131', cost: '$ 1,230' },
'-',
{ campaign: 'Total', install: '146', cost: '$ 1,690' },
],
});
saveImage(canvas, path.join(__dirname, 'padding.png'));