Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order ignoring data order #2187

Closed
brianjenkins94 opened this issue Jul 15, 2021 · 3 comments
Closed

order ignoring data order #2187

brianjenkins94 opened this issue Jul 15, 2021 · 3 comments
Assignees
Labels
Milestone

Comments

@brianjenkins94
Copy link

brianjenkins94 commented Jul 15, 2021

Description

No matter what value of order I provide, offset is not the first segment in each stacked bar.

Steps to check or reproduce

To reproduce, I've been pasting the code below, here: https://naver.github.io/billboard.js/demo/#Chart.StackedBarChart

// for ESM environment, need to import modules as:
// import bb, {bar} from "billboard.js"

var chart = bb.generate({
    "bindto": "#stackedBarChart",
    "data": {
        "type": "bar",
        "json": [{"dateCreated":1622598181000,"ticketNumber":"A","offset":1626311530150,"#912544":87607330,"#912541":89347750,"#912524":93596920,"#912294":178088190,"#912291":178927930,"#912281":181207620,"#912214":201997430,"#912154":432548290,"#912151":433818200,"#912147":434648030,"#912009":522031300,"#911961":534727670,"#911842":613532160,"#911840":613807940,"#911758":692526680,"#911532":1048867900,"#911531":1048965620,"#911440":1129918580,"#911435":1132496980,"#911196":1218802530,"#911179":1223168150,"#911178":1223408380,"#910843":1406228610,"#910159":1993747990,"#909879":2344426410,"#909854":2352248420,"#909557":2520864830,"#909528":2528948370,"#909145":2943329400,"#909141":2945508430,"#909139":2945828140,"#909123":2948338960,"#908942":3038783900,"#908914":3047048540,"#908788":3131665980,"#908786":3132547320,"#908656":3210952850,"#908643":3215708460,"#908642":3216101610,"#908602":3225604640,"#908501":3462404650,"#908436":3482407000,"#907771":3563888250,"#907752":3565717530,"#907495":3631748130,"#907488":3633044620,"#907484":3635768340,"#907465":3641401220,"#907445":3651188430,"#907440":3652385480,"#907367":3713348300},{"dateCreated":1623259144000,"ticketNumber":"B","offset":1625870601240,"#911879":136230810,"#911859":27582860,"#911757":87955410,"#911589":205023100,"#911586":25582630,"#910424":1002204060,"#910192":164842690,"#909860":539594390,"#909835":544597750,"#909833":769800,"#909790":5051080,"#909770":47497790,"#909730":19151110,"#909631":75536300,"#909469":59282880,"#909463":11763480,"#909397":33546620,"#909121":340100210,"#909008":37436850,"#909007":613970,"#908982":38611320,"#908924":19555810,"#908903":7515450},{"dateCreated":1623274204000,"ticketNumber":"C","offset":1626300202430,"#912644":800360,"#910271":1898237640,"#909544":2514019760,"#909539":2514920710,"#909097":2948862600,"#909021":2972900770,"#908957":3021184320,"#908947":3025998390}],
        "keys": {
            "x": "ticketNumber",
            "value": ["offset","#912544","#912541","#912524","#912294","#912291","#912281","#912214","#912154","#912151","#912147","#912009","#911961","#911842","#911840","#911758","#911532","#911531","#911440","#911435","#911196","#911179","#911178","#910843","#910159","#909879","#909854","#909557","#909528","#909145","#909141","#909139","#909123","#908942","#908914","#908788","#908786","#908656","#908643","#908642","#908602","#908501","#908436","#907771","#907752","#907495","#907488","#907484","#907465","#907445","#907440","#907367","#911879","#911859","#911757","#911589","#911586","#910424","#910192","#909860","#909835","#909833","#909790","#909770","#909730","#909631","#909469","#909463","#909397","#909121","#909008","#909007","#908982","#908924","#908903","#912644","#910271","#909544","#909539","#909097","#909021","#908957","#908947"]
        },
        "groups": [["offset","#912544","#912541","#912524","#912294","#912291","#912281","#912214","#912154","#912151","#912147","#912009","#911961","#911842","#911840","#911758","#911532","#911531","#911440","#911435","#911196","#911179","#911178","#910843","#910159","#909879","#909854","#909557","#909528","#909145","#909141","#909139","#909123","#908942","#908914","#908788","#908786","#908656","#908643","#908642","#908602","#908501","#908436","#907771","#907752","#907495","#907488","#907484","#907465","#907445","#907440","#907367","#911879","#911859","#911757","#911589","#911586","#910424","#910192","#909860","#909835","#909833","#909790","#909770","#909730","#909631","#909469","#909463","#909397","#909121","#909008","#909007","#908982","#908924","#908903","#912644","#910271","#909544","#909539","#909097","#909021","#908957","#908947"]],
        "order": null // <--
    },
    "axis": {
        "x": {
            "type": "category"
        },
        "y": {
            "min": 1624993350470,
            "max": 1626319676808,
            "tick": {
                "format": function (index, categoryName) {
                    return new Date(index).toLocaleDateString("en-US");
                }
            }
        },
        "rotated": true
    },
    "legend": {
        "hide": true
    }
});

Relevant documentation:

https://naver.github.io/billboard.js/release/latest/doc/Options.html#.data%25E2%2580%25A4order

Works correctly here in C3: https://c3js.org/samples/chart_bar_stacked.html

@brianjenkins94
Copy link
Author

BountySource

@netil netil added the bug label Jul 19, 2021
@netil
Copy link
Member

netil commented Jul 19, 2021

Hi @brianjenkins94, thanks for the report. I'll check the issue.

netil added a commit to netil/billboard.js that referenced this issue Jul 21, 2021
- fix on getting shape offset value
- fix tooltip default value formatter function
- remove .isOrderDesc(), .isOrderAsc()

Ref naver#2187
@netil netil closed this as completed in d2be8c0 Jul 21, 2021
@brianjenkins94
Copy link
Author

Thank you! There's $10 for you on that BountySource link, fyi. @netil

@netil netil added this to the Patch milestone Jul 27, 2021
@netil netil self-assigned this Jul 27, 2021
github-actions bot pushed a commit that referenced this issue Jul 28, 2021
## [3.1.3](3.1.2...3.1.3) (2021-07-28)

### Bug Fixes

* **api:** fix subchart APIs usage with zoom reset button ([982f6ee](982f6ee)), closes [#2201](#2201)
* **axis:** fix bar type tick.fit=false throwing error ([083f5c7](083f5c7)), closes [#2210](#2210)
* **axis:** fix handling x axis localtime ([1d2ce8f](1d2ce8f)), closes [#2186](#2186)
* **Axis:** fix transition on flow ([a656fe5](a656fe5)), closes [#2189](#2189)
* **shape:** fix incorrect shape offset ([d2be8c0](d2be8c0)), closes [#2187](#2187)
* **types:** fix wrong legend.item callbacks args types ([1196bbf](1196bbf)), closes [#2203](#2203)
* **zoom:** fix inconsistent zoom on .zoom() -> wheel ([4eee2d8](4eee2d8)), closes [#2194](#2194)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants