react-dc-js icon indicating copy to clipboard operation
react-dc-js copied to clipboard

How we use legend in PieChart

Open slgauravsharma opened this issue 4 years ago • 2 comments

How we use legend in PieChart?

Please share example code for the same

slgauravsharma avatar Jun 09 '21 02:06 slgauravsharma

@slgauravsharma The legend can be used in a similar way standard dc.js

For example, from App.js in the playground:

import * as dc from 'dc'
<PieChart
    dimension={gainOrLoss}
    group={gainOrLossGroup}
    width={180}
    height={180}
    radius={80}
    legend={dc.legend()}
/>

Or something slightly more custom:

<PieChart
    dimension={gainOrLoss}
    group={gainOrLossGroup}
    width={250}
    height={180}
    radius={80}
    legend={new dc.Legend().itemHeight(20).gap(5)}
/>

WoodMKII avatar Jun 24 '21 01:06 WoodMKII

Adding to the comment above, ideally, this would soon become a feature (avoiding the use of dc directly), such as:

legend={{
    itemHeight: 20,
    gap: 5
}}

or even

legendItemHeight={20}
legendGap={5}

plourenco avatar Jun 24 '21 12:06 plourenco