c3 icon indicating copy to clipboard operation
c3 copied to clipboard

stacked Donut

Open DominicBoettger opened this issue 11 years ago • 7 comments

Hello,

is it correct, that it's currently not possible to stack pie or donut charts into each other?

Best regards Dominic

DominicBoettger avatar Feb 02 '15 17:02 DominicBoettger

I'm wondering the same thing. It would be nice to stack donut charts.

vnen avatar Feb 10 '15 13:02 vnen

What do you mean "stack"?

masayuki0812 avatar Mar 08 '15 06:03 masayuki0812

I mean concentric donut charts and assume the same for pie charts.

vnen avatar Mar 09 '15 02:03 vnen

@masayuki0812 I`m looking for this feature too. Basicly "stacked" pie (donut) chart is something that looks like hierarchical partition in d3.js, look at sunburst example http://bl.ocks.org/kerryrodden/7090426 ; Or multi level pie chart example is http://ecomfe.github.io/echarts/doc/example/pie.html#-en

As I understand for now in c3.js algoritm for creating pie chart looks like: we have some series:

data: {
        columns: [
            ['data1', 30, 170],
            ['data2', 120, 80],
        ],
        type : 'pie',
    }
// than its done reducing for each seria, smth like this:
dataReduced = data.columns.map(d3.sum());
totalCount = d3.sum(data_reduced);
dataForEachArc = dataReduced/ totalCount;
//after this we have dataForEachArc == {'data1': 0.5, 'data2': 0.5}
//then we draw pie based on dataForEachArc

For the "stacked" pie chart, I think we should draw another "level" based on not reduced data

dataForEachArcInSubLevel_data1 = data.columns['data1'] / totalCount
//same for data2

So we will get dataForEachArcInSubLevel_data1 == [30/400, 170/400] == [0.075, 0.425] Then we draw 4 more arcs with higher radius based on dataForEachArcInSubLevel_data1 and dataForEachArcInSubLevel_data2 At the end start angle of data1 should be equals to start angle of 0.075 valued arc, end angle of data1 equals to end angle of 0.425 valued arc. Finally we will get something like this:

001

Also it would be perfect, if it will be there axis.type=category support for labeling this pieces of data

norecces avatar Mar 20 '15 08:03 norecces

+1 Old issue but that would be super awesome

panthony avatar May 18 '16 13:05 panthony

Might be related to #1133

jondavidjohn avatar Aug 31 '18 22:08 jondavidjohn

duplicate with #1133

panthony avatar Jul 29 '19 13:07 panthony