0

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

1 Answers1

0

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

Tom
  • 556
  • 1
  • 7
  • 16
  • The code is a little bit less straightforward than that, since we are embeding in an Angular 2 app. We use the `react` and `reactDOM` APIs to dynamically create an render the components. The element create code is: `react.createElement(this.chartType, props);` And the `props` is shaped like so: ``` export interface ChartProps { ... config: { legend: { enabled: boolean, position: string } }; ... } ``` Do you know if version `5.1.0` supports the `sortBy` functionality? I think it was not present in `5.0.0`. – Stewart Stephens Aug 10 '18 at 12:33
  • This should work even in Angular. Can you please post the whole code including this.chartType and props? Not just the shape but also the values. I can double check your exact example. sortBy support comes in 5.1.0 and we just released 5.2.0. – Tom Aug 14 '18 at 08:48
  • Here's a gist with some of that info. Please let me know if you would like more detail. https://gist.github.com/Blackbaud-StewartStephens/f65c5532539cfd6def595d4d627b96b4 – Stewart Stephens Aug 16 '18 at 13:38
  • I updated to 5.2.0 stable and this is now working for me. – Stewart Stephens Aug 16 '18 at 18:55