question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

flow() with category-labels on the X-axis doesn't work

See original GitHub issue

Example code:

var chart = c3.generate({
    data: {
        x: 'x',
        columns: [
            ['x', '2012-12-29', '2012-12-30', '2012-12-31'],
            ['data1', 230, 300, 330],
            ['data2', 190, 230, 200],
            ['data3', 90, 130, 180],
        ]
    },
    axis: {
      x: {
        type: 'category' // this needed to load string x value
      }
    }
});

setTimeout(function () {
    chart.flow({
        columns: [
            ['x', '2013-01-11', '2013-01-21'],
            ['data1', 500, 200],
            ['data2', 100, 300],
            ['data3', 200, 120],
        ],
    });
}, 1000);

Expected behavior

Data flowing into the graph, new data added, with labels intact (the verbatim ‘2013-01-11’ and ‘2013-01-21’ values)

Actual behavior

The data is flowing into the graph, new data added, but he labels are changed to ‘2’, ‘3’, and ‘4’ (I suspect these are the array-indexes for the data entries)

On a side-node: when flowing data into the graph, the datastructure ‘chart.x()’ contains arrays with length 5, while only 3 elements are shown. When flowing a lot of data into a chart (I’m using it to flow new data into the chart every second) this will result in a memory problem. But I don’t know if this is a related problem to the one addressed above.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ajohnsencommented, Nov 4, 2015

I need this fix, i have to be able to use my own x values when i insert data and not the array index.

See jsfiddle here: http://jsfiddle.net/jgogpbq4/

0reactions
mmakrzemcommented, Dec 13, 2019

I just started using c3 today and ran into this problem. I see it has existed for 4 years! Yikes, is c3 even an active project anymore? Why hasn’t this been fixed yet?

Read more comments on GitHub >

github_iconTop Results From Across the Web

x-axis category annotations doesn't work if xaxis labels is set ...
X-axis annotations for category charts find the x-axis label position and then set its position. As a workaround, set the xaxis labels font-size...
Read more >
How do I set what plot() labels the x-axis with? - Stack Overflow
I want a different character vector that I want to use as labels, in the standard way: Use as many as will fit,...
Read more >
Change axis labels in a chart in Office - Microsoft Support
Right-click the category labels to change, and click Select Data. ... In Horizontal (Category) Axis Labels, click Edit. In Axis label range, enter...
Read more >
Value axis – amCharts 5 Documentation
Value axis will automatically calculate its scope (min and max values) based on range of ... This means that zooming the chart on...
Read more >
Examples - Apache ECharts
Multiple X Axes. JS TS. Rainfall. JS TS. Area Chart with Time Axis ... Line Y Category ... Tangential Polar Bar Label Position....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found