1.2.1 • Published 18 days ago

@ryan-n-may/funnelplus v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
18 days ago

Nivo Funnel ++

An extension to @Nivo/Funnel that adds functionality and features. A follow and star on the Github Page would be highly appreciated.

MIT License

Nivo Version

Authors

Features

  • Unlimited datasets drawn per chart area.
  • Auto-scaling input datasets relative to each other.
  • Colours customisable per dataset.
  • Section labels.
  • Stylised data labels.
  • Optional, fully customisable legend.

Installation

Install Funnel ++ with npm (NPM package)

 npm install @ryan-n-may/funnelplus
 "@ryan-n-may/funnelplus": "1.2.0"

Acknowledgements

Documentation

<ReactiveFunnelPlus
    ... />

Additional paramaters:

parametertype
dataFunnelDatum[] \| FunnelDatum[][]
colorsOrdinalColorScaleConfig<FunnelDatum> \| OrdinalColorScaleConfig<FunnelDatum>[]
enableLegendboolean
legendAnchorbottom-right \| bottom-left \| bottom \| top \| top-left \| top-right \| right \| left \| undefined
legendItemDirectionleft-to-right \| right-to-left \| top-to-bottom \| bottom-to-top
legendLayoutrow \| column
legendSymbolShapecircle \| triangle \| diamond \| square \| undefined
enableLabelboolean
enableAxisLabelboolean
sectionLabelColorOrdinalColorScaleConfig<FunnelDatum>
labelSpacingnumber
labelDirectionrow \| column
labelStyleverbose \| pretty
labelFormat(label: string) : string
labelColorOrdinalColorScaleConfig<FunnelDatum>
layers['separators', 'parts', 'labels', 'axislabels', 'legend', 'annotations']

Usage/Examples

return(
    <ResponsiveFunnelPlus
        data = {[
            data[0],
            data[1],
        ]}
        colors = {[
            colorThemePalette.stackedBarChartColors.primary, 
            colorThemePalette.stackedBarChartColors.secondary, 
        ]}
        margin={{ top: 8, right: 64, bottom: 16, left: 128 }}
        fillOpacity={0.25}
        borderOpacity={0.8}
        borderWidth={8}
        shapeBlending={0.50}
        interpolation='smooth'
        direction={'vertical'}
        spacing={2}
        isInteractive={true}
        animate={true}
        currentPartSizeExtension={32}
        currentBorderWidth={16}
        motionConfig={'stiff'} 
        layers={['separators', 'parts', 'labels', 'axislabels', 'legend', 'annotations']}
        // Inputs exceed 100, so seperators need to reduce chart width.
        // Auto-scaling relatively scales chart datasets, but if maximal chart dataset exceeds
        // 100, additional seperators must be specified. 
        beforeSeparatorLength={Math.abs(data[0].data[1].value - data[1].data[1].value)}
        afterSeparatorLength={Math.abs(data[0].data[1].value - data[1].data[1].value)}
        // Legend
        enableLegend={true}
        legendAnchor={'bottom-right'}
        legendItemDirection={'left-to-right'}
        legendLayout={'column'}
        legendSymbolShape={'square'}         
        // Labels
        enableLabel={true}
        labelSpacing={0}
        labelDirection={'row'}
        labelStyle={'pretty'}
        labelFormat={() => {}} // Doesnt do anything here, we are using 'pretty'
        valueFormat={'>-.3s'}
        labelColor={{from: 'color', modifiers:[['darker', 1]]}}
        // Axis labels
        enableAxisLabel={true} 
        sectionLabelColor={'dark-gray'}
    >
)

DEMO_IMAGE

1.2.1

18 days ago

1.2.0

18 days ago

1.0.22

18 days ago

1.0.21

18 days ago

1.0.20

18 days ago

1.0.19

18 days ago

1.0.18

18 days ago

1.0.17

18 days ago

1.0.16

18 days ago

1.0.15

18 days ago

1.0.14

18 days ago

1.0.13

18 days ago

1.0.12

18 days ago

1.0.11

18 days ago

1.0.10

18 days ago

1.0.9

18 days ago

1.0.8

18 days ago

1.0.7

18 days ago

1.0.6

18 days ago

1.0.5

18 days ago

1.0.4

18 days ago

1.0.3

18 days ago

1.0.2

18 days ago

1.0.1

18 days ago

1.0.0

18 days ago