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

fix colour settings of BeforeLabel and BeforeBody #4783

Merged
merged 3 commits into from Oct 2, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/core.tooltip.js
Expand Up @@ -677,13 +677,15 @@ module.exports = function(Chart) {
};

// Before body lines
ctx.fillStyle = mergeOpacity(vm.bodyFontColor, opacity);
helpers.each(vm.beforeBody, fillLineOfText);

var drawColorBoxes = vm.displayColors;
xLinePadding = drawColorBoxes ? (bodyFontSize + 2) : 0;

// Draw body lines now
helpers.each(body, function(bodyItem, i) {
ctx.fillStyle = mergeOpacity(vm.labelTextColors[i], opacity);
Copy link
Member

Choose a reason for hiding this comment

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

Could be:

var textColor = mergeOpacity(vm.labelTextColors[i], opacity);
ctx.fillStyle = textColor;

then we can remove line 706 and avoid calling this mergeOpacity more than one time per body item, right?

Copy link
Member

Choose a reason for hiding this comment

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

@Rittyan what do you think about the suggested change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simonbrunel
I think it is very good.
May I commit that change?(Include removing line 706)

Copy link
Member

Choose a reason for hiding this comment

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

@Rittyan yup, you can push that change to this branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it. thanks for reviewing 🙏

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @Rittyan

helpers.each(bodyItem.before, fillLineOfText);

helpers.each(bodyItem.lines, function(line) {
Expand Down