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

rendering area behind bar #2965

Closed
michkami opened this issue Nov 21, 2022 · 1 comment
Closed

rendering area behind bar #2965

michkami opened this issue Nov 21, 2022 · 1 comment

Comments

@michkami
Copy link
Collaborator

Description

When we create a chart with 2 data rows, data1 being area-spline, and data2 being a bar, the bars will be rendered behind the area, not considering the columns order of the data.
This makes the parts, where the area overlapps the bars look blueish:
01  current order

The unwanted effect here is that the area will always change the color of the overlapped bar as it was decided to always render the bars first:
grafik

The wanted result is only the area being rendered behind the bars, and the line and points still being rendered in front of the bars like this:
03  area between bar

Is there any way to achieve this without changing the way the data types are rendered in billboard?

There was also similar issue created in c3 in 2015 which I will also link here: c3js/c3#1446

@netil
Copy link
Member

netil commented Nov 28, 2022

Hi @michkami, this happens because line types(including area) nodes area generated and controlled as a group, and they're rendered after bar node in DOM hierarchy order.

The simple workaround is manipulate area node hierarchy order to stay before the bar node element as:

  onafterinit: function() {
    const bars = this.$.main.select(".bb-chart-bars").node();
    const areas = this.$.main.selectAll(".bb-areas").nodes();

    areas.forEach(v => {
      bars.insertAdjacentElement("beforebegin", v);
    });
  }

I'm not sure how this functionality is needed, but I'll be considering for the next release.

netil pushed a commit to netil/billboard.js that referenced this issue Jun 16, 2023
- Implement bar.front option
- Make eventRect element to stay at the top of shape elements

Ref naver#2965
netil pushed a commit to netil/billboard.js that referenced this issue Jun 16, 2023
- Implement bar.front option
- Make eventRect element to stay at the top of shape elements

Ref naver#2965
netil added a commit that referenced this issue Jun 16, 2023
- Implement bar.front option
- Make eventRect element to stay at the top of shape elements

Ref #2965
@netil netil closed this as completed Jun 16, 2023
github-actions bot pushed a commit that referenced this issue Jun 21, 2023
# [3.9.0-next.2](3.9.0-next.1...3.9.0-next.2) (2023-06-21)

### Features

* **bar:** Intent to ship bar.front ([f7e0d80](f7e0d80)), closes [#2965](#2965)
* **point:** Enhance point.sensitivity ([a537201](a537201)), closes [#2568](#2568)
github-actions bot pushed a commit that referenced this issue Jul 3, 2023
# [3.9.0](3.8.2...3.9.0) (2023-07-03)

### Bug Fixes

* **export:** Fix Plugin class import ([24c0976](24c0976)), closes [#3221](#3221)
* **shape:** Fix shape rendering issue on Windows ([cf1b484](cf1b484)), closes [#3222](#3222)
* **tooltip:** Fix tooltip overflow when right side edge is hovered ([9ce900d](9ce900d)), closes [#3254](#3254)

### Features

* **arc:** Intent to ship arc.needle ([04e90aa](04e90aa)), closes [#3205](#3205)
* **bar:** Intent to ship bar.front ([f7e0d80](f7e0d80)), closes [#2965](#2965)
* **data:** Intent to ship data.labels.position function ([59be3ec](59be3ec)), closes [#3237](#3237)
* **legend:** Intent to ship legend.item.interaction.dblclick ([18f5c4a](18f5c4a)), closes [#1404](#1404)
* **legend:** Intent to ship legent.item.interaction ([af87d10](af87d10)), closes [#1598](#1598)
* **point:** Enhance point.sensitivity ([a537201](a537201)), closes [#2568](#2568)
* **theme:** Intent to ship dark theme ([252a28e](252a28e)), closes [#3229](#3229)
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