c3js / c3js/c3

Adding and removing regions dynamically

Open
#1,527 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Hi,

Would it be possible to add functionality to add/remove regions dynamically? I see that this is not supported from http://c3js.org/reference.html#api-load

I know that it's possible to add regions this this... chart.regions.add({axis: 'x', start: 1 end: 3, class: "X"});

and them remove them like this: $(".c3-regions .X").remove()

But this is unsuitable because if you go to add a new region, c3js still "remembers" the removed ones. This will show both region X (which has been removed with CSS) and region Y ...

chart.regions.add({axis: 'x', start: '4', end: '7', class: 'regionY'})

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start with the regions API described in the issue, especially chart.regions.add and the api-load reference. Compare adding a region with removing its .c3-regions DOM element, then determine how the chart's remembered regions should be updated so later additions do not restore removed regions. Done means regions can be added and removed dynamically without stale regions reappearing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.