c3js / c3js/c3

Grid classes are not correct when grids are dynamically added w/ chart.xgrids

Open
#1,458 2 comments 0 reactions 0 assignees View on GitHub
C-bug
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Hi there,

First off; nice project, this is awesome! I've gotten to the point where I'm noticing strange behavior when I am adding and removing x grids via chart.xgrids([{...}, {...}]). I think the only reason I'm noticing this behavior is that I'm using the class property and changing the colors of the grid lines. Without the color, I wouldn't have noticed this.

I've put together a fiddle to illustrate the behavior.

https://jsfiddle.net/a7hap5zm/1/

The expected results should be:
1. Blue line @ 1
2. Blue line @ 1, red line @ 3
3. Red line @ 3
4. Red line @ 3, blue line @ 1

Instead, what I get is:
1. Blue line @ 1
2. Blue line @ 1, red line @ 3
3. Blue line @ 3
4. Blue line @ 3, blue line @ 1

It seems like the class name attribute of the grid nodes aren't being changed to reflect the desired class name.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.