PMSI-AlignAlytics / dimple

An object-oriented API for business analytics
Other
2.73k stars 556 forks source link

I don't want to apply ordering. But, it applies automatically #277

Open mgolshan opened 7 years ago

mgolshan commented 7 years ago

Hello. This is my data:

data": [
    {
        "month": "2017-Jan",
        "redemption": "0.07",
        "issuance": "0.40"
    },
    {
        "month": "2017-Feb",
        "redemption": "0.18",
        "issuance": "9.52"
    },
    {
        "month": "2017-Mar",
        "redemption": "2.69",
        "issuance": "0.92"
    },
    {
        "month": "2017-Apr",
        "redemption": "0.18",
        "issuance": "0.33"
    },
    {
        "month": "2017-May",
        "redemption": "0.51",
        "issuance": "12.81"
    },
    {
        "month": "2017-Jun",
        "redemption": "0.09",
        "issuance": "0.27"
    }
]

The X axis is "month". I want to show in the same ordering I get the data. I do not apply any addOrderRule to the x axis. But, it is showing mis-ordered chart by this ordering: 2017-Mar , 2017-May , 2017-Apr , 2017-Feb , 2017-Jun , 2017-Jan

How may I prevent that? Thanks in advance

welshjs commented 7 years ago

It's going in alpha order. You need to parse the data as actual dates.

James

On Jun 27, 2017, at 3:53 PM, mgolshan notifications@github.com wrote:

Hello. This is my data:

data": [ { "month": "2017-Jan", "redemption": "0.07", "issuance": "0.40" }, { "month": "2017-Feb", "redemption": "0.18", "issuance": "9.52" }, { "month": "2017-Mar", "redemption": "2.69", "issuance": "0.92" }, { "month": "2017-Apr", "redemption": "0.18", "issuance": "0.33" }, { "month": "2017-May", "redemption": "0.51", "issuance": "12.81" }, { "month": "2017-Jun", "redemption": "0.09", "issuance": "0.27" } ] The X axis is "month". I want to show in the same ordering I get the data. I do not apply any addOrderRule to the x axis. But, it is showing mis-ordered chart by this ordering: 2017-Mar , 2017-May , 2017-Apr , 2017-Feb , 2017-Jun , 2017-Jan

How may I prevent that? Thanks in advance

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mgolshan commented 7 years ago

Thanks @welshjs. But, I don't see it in alpha order. If it was based on alpha, Apr should be the first one. However, my question is how to show in the main order I get in the response? I don't want to change any ordering. Thanks.

Rolok commented 7 years ago

I don't have an answer for you, but I do notice that it is ordered by 'redemption' in descending order.

You could provide yourself an additional value that you could use addOrderRule on?

With sorting dates (which I know you don't want), I have also noticed differing behavior between Chrome and Firefox. I wanted my data in order by dates, and I resorted to providing the data in YYYY-MM-DD format in all numbers. Chrome sorted the dates with MON correctly, but Firefox did not.