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

Change areas and lines position when area's opacity is 1 #1543

Closed
qkreltms opened this issue Jul 21, 2020 · 3 comments
Closed

Change areas and lines position when area's opacity is 1 #1543

qkreltms opened this issue Jul 21, 2020 · 3 comments

Comments

@qkreltms
Copy link

qkreltms commented Jul 21, 2020

Description

How about adding an option changing areas and lines position when area's opacity set to 1?

When I set area's opacity 1, lines are look faint.

캡처1

캡처

When i changed each position it looks good

켑차22

캡처2

I was able to fix this by adding these lines

  const changeLinesAndAreasPosition = (ctx: any) => {
    const lines = d3.select<SVGElement, SVGElement>(ctx.element).selectAll<SVGGElement, SVGGElement>(".bb-chart-line > .bb-lines").nodes();
    d3.select<SVGGElement, SVGElement>(ctx.element).selectAll<SVGGElement, SVGGElement>(".bb-chart-line > .bb-areas").nodes().forEach((area, index) => {
      if (area.parentNode) {
        area.parentNode.insertBefore(area, lines[index]);
      }
    })
  }

Steps to check or reproduce

https://codepen.io/qkreltms/pen/JjGwLgo

@netil
Copy link
Member

netil commented Jul 22, 2020

Hi @qkreltms, the only difference between the node stacking order changes is to make line to be positioned over area element. Hence to make line to be rendered more sharper.

If that is something you need, how about styling with css prop. rather than handling node stacking?
Adding stroke-width will make that.

.bb-area-data1 {
  opacity: 1 !important;
  fill: lightgray !important;
  stroke-width: 1px;
}

@qkreltms
Copy link
Author

qkreltms commented Jul 23, 2020

@netil I've already tried, but it looks not clear than changing node stacking and also still looks faintstroke-width: n(n<1)

@netil
Copy link
Member

netil commented Jul 23, 2020

similar as grid.front option can be implemented for that.

area: {
    // default is 'true'. false make to be positioned behind the line element
    front: false,  
}

netil added a commit to netil/billboard.js that referenced this issue Jul 24, 2020
- Implement area.front option
- Split area's test codes as separate file from line's test.

Ref naver#1543
@netil netil closed this as completed in fe315dc Jul 24, 2020
netil pushed a commit that referenced this issue Aug 4, 2020
# [2.1.0-next.1](2.0.1...2.1.0-next.1) (2020-08-04)

### Bug Fixes

* **arc:** wrong right padding calculation ([f5a8602](f5a8602)), closes [#1545](#1545)
* **area:** Fix dynamic area loading ([9d6e1e0](9d6e1e0)), closes [#1547](#1547)
* **axis:** fix y axis clip-path coordinates ([bdf7694](bdf7694)), closes [#1572](#1572)
* **types:** Specify context for callbacks ([f3b9f26](f3b9f26)), closes [#1551](#1551)

### Features

* **area:** Intent to ship area.front ([fe315dc](fe315dc)), closes [#1543](#1543)
* **axis:** Improve log scale to handle 0 ([ca6cf62](ca6cf62)), closes [#1578](#1578)
* **axis:** Intent to ship axis.y2.type ([a94c25e](a94c25e)), closes [#1575](#1575)
netil pushed a commit that referenced this issue Sep 25, 2020
# [2.1.0](2.0.3...2.1.0) (2020-09-25)

### Bug Fixes

* **api:** prevent TypeError when chart already destroyed ([ce42768](ce42768)), closes [#1613](#1613)
* **axis:** fix y axis clip-path coordinates ([bdf7694](bdf7694)), closes [#1572](#1572)
* **bar:** Fix not firing data.onclick ([62e7a10](62e7a10)), closes [#1619](#1619) [#1620](#1620)
* **bar:** fix on bar tooglip grouped false ([4bd69be](4bd69be)), closes [/github.com//issues/1663#issuecomment-690991679](https://github.com//github.com/naver/billboard.js/issues/1663/issues/issuecomment-690991679)
* **grid:** Fix grid text position update ([056b565](056b565)), closes [#1592](#1592)
* **interaction:** bind touch event only for rect element ([12da3e4](12da3e4)), closes [#1650](#1650)
* upgrade d3-ease from 1.0.6 to 1.0.7 ([#1617](#1617)) ([4f78533](4f78533))
* **interaction:** correct draggable selection functionality ([160f873](160f873)), closes [#1642](#1642)
* upgrade d3-brush from 1.1.5 to 1.1.6 ([#1605](#1605)) ([624f044](624f044))
* **interaction:** fix for data point click on mobile ([727c26f](727c26f)), closes [#1651](#1651)
* **interaction:** fix retrieving event rect position ([6fc449e](6fc449e)), closes [#1670](#1670)
* **legend:** Fix error for color.threshold option ([6e06629](6e06629)), closes [#1604](#1604) [#1611](#1611)
* **legend:** Make legend blurry after click ([319d608](319d608)), closes [#1599](#1599)
* **shape:** fix possible condition removal by transpiler ([781fb61](781fb61)), closes [#1663](#1663)
* **step:** Fix rendering nullish data ([dbe7b9b](dbe7b9b)), closes [#1637](#1637)
* **types:** Fix donut option types ([1917169](1917169)), closes [#1615](#1615)
* **types:** Specify context for callbacks ([f3b9f26](f3b9f26)), closes [#1551](#1551)

### Features

* **area:** Intent to ship area.front ([fe315dc](fe315dc)), closes [#1543](#1543)
* **axis:** Improve log scale to handle 0 ([ca6cf62](ca6cf62)), closes [#1578](#1578)
* **axis:** Intent to ship axis.y2.type ([a94c25e](a94c25e)), closes [#1575](#1575)
* **interaction:** avoid multiple <rect> generation ([97df63a](97df63a)), closes [#1642](#1642)
* **plugin:** Add JS  Plugin class file ([4a20480](4a20480)), closes [#1665](#1665)
* **theme:** Add new 'datalab' theme ([aba20d4](aba20d4)), closes [#241](#241)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants