Search code examples
gooddata

React components not respecting legend position configuration


Is there any reason why my chart legends are always appearing on the right? My config looks like this: legend: { enabled: true, position: 'bottom' } Setting enabled to false causes the legend to disappear as expected, but changing the position has no effect.

This is using @gooddata/react-components 5.2.0-alpha17


Solution

  • The config looks correct. Please share the code for the whole component and we will have a look at it. This is unlikely the problem, but please try to use a stable version instead of alpha. Current stable version is 5.1.0.

    Please check you are importing your styles correctly

    import '@gooddata/react-components/styles/css/main.css';
    

    This snippet should work:

                    <PieChart
                        projectId={projectId}
                        measures={measures}
                        config={{
                            legend: {
                                enabled: true,
                                position: 'bottom'
                            }
                        }}
                    />
    

    You can find more information about chart legends in the official documentation