Skip to content

Commit 1439796

Browse files
committed
blue shades. moved scale to right. margin.
1 parent d8f933f commit 1439796

File tree

7 files changed

+64
-36
lines changed

7 files changed

+64
-36
lines changed

scout-ui/src/field-list/basic-field.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
.schema-field-name(data-hook='name')
66
div(data-hook='types-container')
77
.col-sm-7.col-sm-offset-1
8-
div(data-hook='minicharts-container')
8+
div(data-hook='minichart-container')

scout-ui/src/field-list/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var BasicFieldView = View.extend({
4444
},
4545
render: function() {
4646
this.renderWithTemplate(this);
47-
this.viewSwitcher = new ViewSwitcher(this.queryByHook('minicharts-container'));
47+
this.viewSwitcher = new ViewSwitcher(this.queryByHook('minichart-container'));
4848
},
4949
switchView: function(typeModel) {
5050
var type = typeModel._id.toLowerCase();

scout-ui/src/minicharts/d3fns/few.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ module.exports = function(data, g, width, height, options) {
5050
});
5151

5252
bar.append('rect')
53-
.attr('class', 'fg')
53+
.attr('class', function(d, i) {
54+
return 'fg-' + i;
55+
})
5456
.attr('y', 0)
5557
.attr('x', 0)
5658
.attr('width', function(d) {

scout-ui/src/minicharts/d3fns/many.js

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ require('d3-tip')(d3);
77

88
module.exports = function(data, g, width, height, options) {
99

10-
// if legend present, save some space
11-
var scaleWidth = 40;
12-
1310
options = _.defaults(options || {}, {
1411
bgbars: false,
1512
scale: false,
1613
labels: false // label defaults will be set further below
1714
});
1815

19-
// if (options.scale) {
20-
// width = width - scaleWidth;
21-
// }
22-
2316
var x = d3.scale.ordinal()
2417
.domain(_.pluck(data, 'label'))
2518
.rangeBands([0, width], 0.3, 0.0);
@@ -62,49 +55,49 @@ module.exports = function(data, g, width, height, options) {
6255

6356
legend.append('text')
6457
.attr('class', 'legend')
65-
.attr('x', width)
66-
.attr('dx', '1em')
58+
.attr('x', 0)
59+
.attr('dx', '-1em')
6760
.attr('y', 0)
6861
.attr('dy', '0.3em')
69-
.attr('text-anchor', 'start')
62+
.attr('text-anchor', 'end')
7063
.text(d3.max(y.domain()) + '%');
7164

7265
legend.append('text')
7366
.attr('class', 'legend')
74-
.attr('x', width)
75-
.attr('dx', '1em')
67+
.attr('x', 0)
68+
.attr('dx', '-1em')
7669
.attr('y', height / 2)
7770
.attr('dy', '0.3em')
78-
.attr('text-anchor', 'start')
71+
.attr('text-anchor', 'end')
7972
.text(d3.max(y.domain()) / 2 + '%');
8073

8174
legend.append('text')
8275
.attr('class', 'legend')
83-
.attr('x', width)
84-
.attr('dx', '1em')
76+
.attr('x', 0)
77+
.attr('dx', '-1em')
8578
.attr('y', height)
8679
.attr('dy', '0.3em')
87-
.attr('text-anchor', 'start')
88-
.text('0%');
80+
.attr('text-anchor', 'end')
81+
.text('99.9%');
8982

9083
legend.append('line')
9184
.attr('class', 'bg legend')
92-
.attr('x1', 0)
93-
.attr('x2', width + 5)
85+
.attr('x1', -5)
86+
.attr('x2', width)
9487
.attr('y1', 0)
9588
.attr('y2', 0);
9689

9790
legend.append('line')
9891
.attr('class', 'bg legend')
99-
.attr('x1', 0)
100-
.attr('x2', width + 5)
92+
.attr('x1', -5)
93+
.attr('x2', width)
10194
.attr('y1', height / 2)
10295
.attr('y2', height / 2);
10396

10497
legend.append('line')
10598
.attr('class', 'bg legend')
106-
.attr('x1', 0)
107-
.attr('x2', width + 5)
99+
.attr('x1', -5)
100+
.attr('x2', width)
108101
.attr('y1', height)
109102
.attr('y2', height);
110103
}

scout-ui/src/minicharts/d3fns/shared.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module.exports = {
22

33
margin: {
44
top: 10,
5-
right: 40,
5+
right: 0,
66
bottom: 10,
7-
left: 0
7+
left: 40
88
},
99

1010
};

scout-ui/src/minicharts/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = AmpersandView.extend({
1515
initialize: function(opts) {
1616
// setting some defaults for minicharts
1717
this.viewOptions = _.defaults(opts, {
18-
width: 400,
18+
width: 440,
1919
height: 100,
2020
renderMode: 'svg',
2121
className: 'minichart',

scout-ui/src/minicharts/index.less

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
// minicharts
2+
@mc-blue0: #43B1E5;
3+
@mc-blue1: lighten(@mc-blue0, 10%);
4+
@mc-blue2: lighten(@mc-blue0, 20%);
5+
@mc-blue3: lighten(@mc-blue0, 30%);
6+
@mc-blue4: lighten(@mc-blue0, 40%);
7+
@mc-blue5: lighten(@mc-blue0, 50%);
8+
29
@mc-bg: #F2F4F5;
3-
@mc-fg: #38A1DF;
4-
@mc-hl: #BEDFF0;
10+
@mc-fg: @mc-blue0;
511

612
div.minichart.unique {
713
font-size: 12px;
@@ -37,6 +43,12 @@ div.minichart.unique {
3743
}
3844
}
3945

46+
.minichart-wrapper {
47+
svg.minichart {
48+
margin-left: -40px;
49+
}
50+
}
51+
4052
svg.minichart {
4153
font-size: 10px;
4254

@@ -59,16 +71,37 @@ svg.minichart {
5971
fill: @mc-fg;
6072
}
6173

62-
rect.hl {
63-
fill: @mc-hl;
64-
}
65-
6674
&.few {
67-
rect.fg {
75+
76+
rect {
6877
stroke: white;
6978
stroke-width: 2px;
7079
}
7180

81+
rect.fg-0 {
82+
fill: @mc-blue0;
83+
}
84+
85+
rect.fg-1 {
86+
fill: @mc-blue1;
87+
}
88+
89+
rect.fg-2 {
90+
fill: @mc-blue2;
91+
}
92+
93+
rect.fg-3 {
94+
fill: @mc-blue3;
95+
}
96+
97+
rect.fg-4 {
98+
fill: @mc-blue4;
99+
}
100+
101+
rect.fg-5 {
102+
fill: @mc-blue5;
103+
}
104+
72105
text {
73106
fill: white;
74107
font-size: 12px;

0 commit comments

Comments
 (0)