Skip to content

Commit af2c8cd

Browse files
committed
fix: bar offset in small chart
1 parent 123ba01 commit af2c8cd

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

lib/cli/gfx/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ exports.historyCountryTracker = (req, res, n, c, tC, d, tD, r, a, cl, cPOM, u, h
5656
defaultChartStyle = require(`../gfx/layout/${allowedDefaultChartSize.indexOf(chartSize) != -1 ? chartSize: allowedDefaultChartSize[1] }.json`);
5757

5858
// load template with data
59-
// serverUtil.loadTemplate(template, {jsonData}, callback)
59+
// serverUtil.loadTemplate(template, {jsonStyle}, {jsonData}, callback)
6060
serverUtil.loadTemplate(template, defaultChartStyle, {
6161
name,
6262
cases,

lib/cli/gfx/layout/sm.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
},
66
"table": {
77
"grid": [2, 0, 2, 5],
8-
"columnSpacing": 5
8+
"columnSpacing": 3
99
},
1010
"bar": {
11-
"grid": [4, 0, 3, 3]
11+
"grid": [4, 0, 3, 3],
12+
"xOffset": 6
1213
},
1314
"map": {
1415
"grid": [0, 2, 2, 3]

lib/cli/gfx/template.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ exports.load = (grid, data, chartStyle) => {
2222
, width: '30%'
2323
, height: '30%'
2424
, border: {type: "line", fg: "cyan"}
25-
, columnSpacing: chartStyle.table.columnSpacing || 10 //in chars
26-
, columnWidth: [1,16, 12, 12, 12, 18],
25+
, columnSpacing: chartStyle.table.columnSpacing || 10
26+
, columnWidth: chartStyle.table.columnWidth || [1, 16, 12, 12, 12, 18],
2727
style: {
2828
border: {
2929
fg: 'white'
@@ -53,9 +53,9 @@ exports.load = (grid, data, chartStyle) => {
5353

5454
let bar = grid.set(chartStyle.bar.grid[0], chartStyle.bar.grid[1], chartStyle.bar.grid[2], chartStyle.bar.grid[3], contrib.bar,{
5555
barBgColor: 'red',
56-
barWidth: 7,
57-
barSpacing: 5,
58-
xOffset: 3,
56+
barWidth: chartStyle.bar.barWidth || 7,
57+
barSpacing: chartStyle.bar.barSpacing || 7,
58+
xOffset: chartStyle.bar.xOffset || 3,
5959
maxHeight: 9,
6060
style: {
6161
border: {

0 commit comments

Comments
 (0)