c3js / c3js/c3

Gauge chart - color threshold can't be updated dynamically

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

Description

I've been trying to update the colors.threshold value dynamically on gauge chart as follows:

`chart.internal.config.color_threshold = [
Math.round(randomMaxValue/4),
Math.round(randomMaxValue/3),
Math.round(randomMaxValue/2),
randomMaxValue
];`

It doesn't seem to work. Is this a bug on c3?

Here's a codepen where you can see the issue:

[https://codepen.io/felipevega/pen/WBaQKP](url)

C3 version: v0.4.23
D3 version: N/A
Browser: Chrome - Version 69.0.3497.100 (Official Build) (64-bit)
OS: macOS Mojave - Version 10.14

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior in the linked CodePen with C3 v0.4.23, focusing on the gauge chart's color_threshold configuration. Trace how that configuration is read when the chart is updated, then verify that changing the thresholds dynamically updates the gauge colors without recreating the chart.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.