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

Automatic sorting of values #6

Open
Knudian opened this issue Mar 14, 2015 · 2 comments
Open

Automatic sorting of values #6

Knudian opened this issue Mar 14, 2015 · 2 comments

Comments

@Knudian
Copy link

Knudian commented Mar 14, 2015

On a page, I have two pies that are comparisons of two objects.

Problem, even if the legend is good, there is still the problem of the datas sorting.

Given those two datasets :

$scope.datas = {
    set: [
        {label: "Type 1", value: 17, color: "#1f77b4"},
        {label: "Type 2", value: 3, color: "#ff7f0e"},
        {label: "Type 3", value: 8, color: "#2ca02c"},
        {label: "Type 4", value: 1, color: "#000000"}
    ],
    sat: [
        {label: "Type 1", value: 5, color: "#1f77b4"},
        {label: "Type 2", value: 13, color: "#ff7f0e"},
        {label: "Type 3", value: 3, color: "#2ca02c"},
        {label: "Type 4", value: 6, color: "#000000"}
    ]
};

Colors are the same, objects order is exactly the same, just the valuethat change.
And the sorting will follow the descending order of each datasets following value.

That's not good, I'm using those to quickly generate images from those pies, and the order is really important for the client.

Any place/line where i can change that, or is there an option to modify to avoid that problematic automatic sorting ?

@arunrajiah
Copy link

+1

I have a similar query. How to avoid sorting and display the pie based on the sequence.

@chiefie
Copy link

chiefie commented May 31, 2016

I made a modification to the file for my own project, however, I have no idea how to make a pull request.

In the method getTools, I changef the follow statement

if (options.mode === "gauge") {
    pieLayout.sort(null);
}

to

if (options.mode === "gauge" || !options.sort) {
    pieLayout.sort(null);
}

And in the method sanitizeOptions, I added the following statement

if (options.sort === undefined) {
    options.sort = true;
}

To override the automatic sorting, ensure the options has sort property set to false. If not specified, the default is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants