Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding caret icons to max/min for column chart #5

Merged
merged 4 commits into from
Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion addon/components/column-chart/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ export default Ember.Component.extend({
.attr('text-anchor', 'middle')
.attr('font-size', '12px')
.attr('fill', colors[seriesMaxMin]);

gLabels.append('text')
// unicode for font-awesome caret up
.html(() => '&#xf0d8')
.attr('text-anchor', 'middle')
.attr('class', 'caret-icon')
.attr('x', +b.getAttribute('x') + (b.getAttribute('width') / 2))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Trivial) missing a space after the first +

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in the other areas where this line is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I put a space in it failed the eslint. Should I change the eslint rule?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually I read this line wrong, I didn't realize that it's a leading +. I'm not sure why that's there, maybe to coerce it to a Number type? Probably can leave it as is then.

.attr('y', Math.max(12, +b.getAttribute('y') - 15));
}

b = bars[minIdx];
Expand All @@ -286,10 +294,18 @@ export default Ember.Component.extend({
gLabels.append('text')
.text(minValue)
.attr('x', +b.getAttribute('x') + (b.getAttribute('width') / 2))
.attr('y', Math.max(12, +b.getAttribute('y') - 5))
.attr('y', Math.max(12, +b.getAttribute('y') - 15))
.attr('text-anchor', 'middle')
.attr('font-size', '12px')
.attr('fill', colors[seriesMaxMin]);

gLabels.append('text')
// unicode for font-awesome caret down
.html(() => '&#xf0d7')
.attr('class', 'caret-icon')
.attr('text-anchor', 'middle')
.attr('x', +b.getAttribute('x') + (b.getAttribute('width') / 2))
.attr('y', Math.max(12, +b.getAttribute('y') - 5));
}
}
})
Expand Down
6 changes: 5 additions & 1 deletion addon/components/column-chart/style.less
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.column-chart {
}
.caret-icon {
font-family: FontAwesome;
font-size: 12px;
}
}
Loading