I am using google Colab (Jupyter python notebook on a server) to run the pivot table.
This code:
pivot_ui(d1,outfile_path='pivottablejs.html')
HTML('pivottablejs.html')
Which I can manipulate to get this desired chart:
But when I refresh the page it all goes back to the blank pivot. What I would like is to store the config of the desired chart so that I can get it back after a refresh.
I am aware that there are instructions on how to do this in JavaScript, but I cannot figure out how to do this in a Jupyter notebook. Any ideas?
Edit It seems I am not the first to have tried: https://github.com/nicolaskruchten/jupyter_pivottablejs/issues/34 and it is not possible with the current set up.
My hacky solution
I rewrote part of the pivottablejs package to add a "copy config" button. I put this code in an earlier cell in by Jupyter notebook, so the function would be accessible later:
Version for Google Colab:
Version for standard Jupyter notebook:
This enables you to make a chart as so (google colab version, slightly different for Jupyter notebook version):
Which loads a blank chart which you can manually configure (below image is configured). Note the "copy settings" button:
If you press the button it copies a JSON of the config, which you can then put back into the charting function so that it runs your configured chart:
This is far from ideal... Ideally this should be added to the pivottablejs package as a PR. If I get time I will try to do this!