Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify plot size #31

Open
rmaranhao opened this issue Sep 8, 2020 · 1 comment
Open

Specify plot size #31

rmaranhao opened this issue Sep 8, 2020 · 1 comment

Comments

@rmaranhao
Copy link

Hi.
I am integrating PivotTable with other components in the same screen. I have already included a scrollable DIV
as suggested in #7 but I would really like to be able to specify the size of the plots. Due to the nature of my data I get very large plots that would be much better if rendered in a smaller format.

The code would be something like this:

    return  html.Div(id='div_pivot', children=[
                dash_pivottable.PivotTable(
                    id='Tabela',
                    data=data,
                    cols=dic_pivot['cols'],
                    #colOrder='key_a_to_z',
                    rows=dic_pivot['rows'],
                    #rowOrder='key_a_to_z',
                    rendererName='Table',
                    aggregatorName='Sum',
                    vals=dic_pivot['vals'],
                    valueFilter={},
                    hiddenFromAggregators=dic_pivot['hiddenFromAggregators'],
                    hiddenFromDragDrop=dic_pivot['vals'],
                    hiddenAttributes=hidden,                     
#The line below is a suggestion and causes an error in the current version
                    rendererOptions={'autosize':True, 'width':700, 'height':450,},
                ),], style={'height':'450px', 'overflow':'scroll', 'resize':'both'} )
@xhluca
Copy link

xhluca commented Jan 28, 2021

Hi @rmaranhao , thanks for opening the PR!

rendererOptions is not available in the API reference, which is why it causes an error.

For plot size, I believe it is controlled on the JS side of react-pivottable. It might be possible to modify the stylesheet (see this comment) but you will likely need to modify the react source code (see contributing FAQ for details). Here's the piece of code that controls the width/height.
You will likely need to specify a plotlyOptions prop from the Renderer component being created in the previous link. See this line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants