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

[3.0] Chart legend 영역에서 Series label mouseleave event handler 이슈 #782

Merged
merged 3 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion src/components/chart/element/element.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defaultsDeep } from 'lodash-es';
import { numberWithComma } from '@/common/utils';
import { COLOR, BAR_OPTION } from '../helpers/helpers.constant';
import Canvas from '../helpers/helpers.canvas';
import Util from '../helpers/helpers.util';

class Bar {
constructor(sId, opt, sIdx, isHorizontal) {
Expand Down Expand Up @@ -94,7 +95,9 @@ class Bar {
let categoryPoint = null;

ctx.beginPath();
ctx.fillStyle = this.color;

const opacity = this.state === 'downplay' ? 0.1 : 1;
ctx.fillStyle = `rgba(${Util.hexToRgb(this.color)},${opacity})` || '';

this.data.forEach((item, index) => {
if (isHorizontal) {
Expand Down
5 changes: 4 additions & 1 deletion src/components/chart/element/element.bar.time.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Canvas from '../helpers/helpers.canvas';
import Bar from './element.bar';
import Util from '../helpers/helpers.util';

class TimeBar extends Bar {
/**
Expand Down Expand Up @@ -60,7 +61,9 @@ class TimeBar extends Bar {
this.size.ix = barSeriesX;

ctx.beginPath();
ctx.fillStyle = this.color;

const opacity = this.state === 'downplay' ? 0.1 : 1;
ctx.fillStyle = `rgba(${Util.hexToRgb(this.color)},${opacity})` || '';

this.data.forEach((item) => {
if (isHorizontal) {
Expand Down
4 changes: 3 additions & 1 deletion src/components/chart/element/element.pie.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { merge } from 'lodash-es';
import { PIE_OPTION, COLOR } from '../helpers/helpers.constant';
import Util from '../helpers/helpers.util';

class Pie {
constructor(sId, opt, sIdx) {
Expand Down Expand Up @@ -34,9 +35,10 @@ class Pie {
const radius = param.radius;
const startAngle = param.startAngle;
const endAngle = param.endAngle;
const opacity = this.state === 'downplay' ? 0.1 : 1;

ctx.beginPath();
ctx.fillStyle = this.color;
ctx.fillStyle = `rgba(${Util.hexToRgb(this.color)},${opacity})` || '';
ctx.moveTo(centerX, centerY);
ctx.arc(centerX, centerY, radius, startAngle, endAngle);
ctx.fill();
Expand Down
5 changes: 3 additions & 2 deletions src/components/chart/element/element.scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ class Scatter {
return item;
}, this.data[0]);

ctx.strokeStyle = this.color;
ctx.fillStyle = this.pointFill;
const opacity = this.state === 'downplay' ? 0.1 : 1;
ctx.fillStyle = `rgba(${Util.hexToRgb(this.pointFill)},${opacity})` || '';
ctx.strokeStyle = `rgba(${Util.hexToRgb(this.color)},${opacity})` || '';

this.data.forEach((curr) => {
if (curr.xp !== null && curr.yp !== null) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/chart/plugins/plugins.legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const modules = {
chartRect = this.chartDOM.getBoundingClientRect();

boxStyle.width = `${opt.legend.width - 10}px`; // legendDOM left padding
boxStyle.height = `${chartRect.height}px`;
boxStyle.maxHeight = `${chartRect.height}px`;

legendStyle.paddingLeft = '10px';
legendStyle.top = `${title}px`;
Expand Down Expand Up @@ -371,7 +371,7 @@ const modules = {
chartRect = this.chartDOM.getBoundingClientRect();

boxStyle.width = `${opt.legend.width}px`;
boxStyle.height = `${chartRect.height}px`;
boxStyle.maxHeight = `${chartRect.height}px`;
boxStyle.display = 'absolute';
boxStyle.bottom = '0px';

Expand Down