I have a plotly component that properly renders a combo Scatter and Bar chart. It has been working for months. I have also been providing my users a “Download As PDF” button so they could have their own copy of the chart using PDFRenderer. This PDF creation has also been working flawlessly for months.
Issue: All of a sudden, when trying to pass plotly data & layout to the server code so that PDFRenderer can do its thing, the client side is throwing errors out like:
ValueError: Invalid property specified for object of type plotly.graph_objs.Bar:
Troubleshooting: My combo Scatter/Bar chart has checkboxes for the user that control what data is displayed to them in the chart. When the user makes the chart display the Scatter data only, the PDFRenderer works properly. But when Bar information is displayed, this is when the errors begin.
Given that I haven’t touched the code to this app for a long time, I’m wondering if there have been any updates/changes to the plotly graph_objects library recently?
Additionally, I don’t understand when the error is actually being triggered. In the code below, I’ve indicated with “# this line works” to show successful execution progress. The error message I’m getting indicates the line with “# this line DOESN"T work” is producing the error. How can it be producing the error when the chart_data and chart_layout variables being passed to the ‘create_pdf’ server function are successfully produced immediately beforehand? And I think the server side isn’t the issue because the ‘create_pdf’ server function included below never fires the simple print statement I’ve used to troubleshoot.
CLIENT SIDE
def button_download_pdf_click(self, **event_args):
Globals.chart_to_print=self.plot_overall
chart_data=self.plot_overall.data
chart_layout=self.plot_overall.layout
print(chart_data) # this line works
print(chart_layout) # this line works
**pdf=anvil.server.call('create_pdf',chart_data,chart_layout) # this line DOESN'T work**
anvil.media.download(pdf)
SERVER SIDE:
def create_pdf(chart_data,chart_layout):
print("in server side pdf maker") # this line never fires!
pdf=PDFRenderer(filename="Survey Overall Results- Spring 2022.pdf").render_form('PDF_Maker',chart_data,chart_layout)
return pdf
Thank you for your attention.