c3js / c3js/c3

bar graph not rendering

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

Description

Hello,

I have a bar chart that I'm trying to populate with data, but it doesn't seem to be working. It doesn't render any bars.

Here's the Javascript I'm running:

var inherentCauseCriticalityByReceptorConfig = {
bindto: 'InherentCauseCriticalityByReceptor',
showLabels: true,
showLegend: true,
showYAxis: true,
showTooltip: true
};

...

inherentCauseCriticalityByReceptorBarGraph = ra.charting.barChart(inherentCauseCriticalityByReceptorConfig);

...

inherentCauseCriticalityByReceptorBarGraph.startLoading();

...

var DMCats = ['EquipmentFailure', 'Undetermined'];
var tempColors = {
EquipmentFailure: '#FF0000',
Undetermined: '#0000FF'
};
var tempData = [{ EquipmentFailure: 10000, label: '1 - Equipment Failure' }, { Undetermined: 1000, label: '2 - Undetermined' }];

inherentCauseCriticalityByReceptorBarGraph.loadData({
data: tempData,
stacked: true,
xValue: 'label',
yValue: DMCats,
colors: tempColors
});

...

inherentCauseCriticalityByReceptorBarGraph.doneLoading();

I'm expecting to see at least two bars in the graph: 1 - Equipment Failure, which is red and reads 10000, and 2 - Undetermined, which is blue and reads 1000, but nothing's showing up in the graph.

I've copied this code from another page in our application which does work.

Can anyone see any reason the bar graph doesn't render?

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied configuration and data passed to ra.charting.barChart and loadData. Trace how xValue, yValue, stacked, and colors are handled, then compare the configuration with the working page mentioned in the report. Done means the two expected colored bars render with their values and the cause is confirmed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.