Plotly: Is it possible to dynamically change colors of traces on a .html file generated from a plotly figure using plotly's '.to_html()' function? - html

I've created an app that allows users to upload an excel or .csv file, extract the data and generate a plot for their desired data. I'm using plotly to produce the figures. I've included an option to create an .html file (so the user can access it later) containing the plot by using plotly's .to_html() function.
By default, this function creates plots with some level of interaction such as dynamic zoom, and capability to hide/unhide traces on the figure. This is great, but as I push this app out for others to use, I'd like them to also be able to change the colors of the traces on the figures, without requiring them to go into the source code. Ideally, the user would simply click on the plot/trace of interest on the legend (or some other button) then choose a new color.
Is it possible to add additional or custom interactive/dynamic functionality to the .html files generated by plotly? Specifically, is there a way to allow users to change the color of plots on a figure that has already been written to an .html file?
For context, I am using the python version of plotly.

Related

How to import excel/csv with "File Import" widget in Foundry's Slate?

Context:
For a data pipeline we need to ingest excel spreadsheets directly into foundry (arriving via email). In order to avoid any manual handling error, we'd like to build a small slate app that basically just uploads an excel sheet and automatically appends it to an existing dataset (given schema, headers, etc.).
Unfortunately, there is very little documentation on the "File Import" widget or the API that gets called when drag and dropping a file into a folder.
Idea: Is there a way of uploading a file with slate? Could this file then be added to a dataset, similarly as with the prompt that opens when dropping it into a folder?
You actually don't have to build a Slate app to do this! Datasets that are made up of underlying .csv files support new additions of files directly.
Note: All of the following screenshots are from the dataset preview page.
For example, the following dataset I created from 4 .csv files:
And I can click on the Import button in the top right to add in more files (with the same schema, or not. Depends on if you want to strictly adhere to your applied schema.
If you have already applied a schema, you can also simply Import new files on top of the dataset, but the schemas of the files must exactly match those already present, otherwise your dataset will fail when attempted to be read.

How to extract text from a Google drawing?

I am given a Google drawing containing an application component architecture. The drawings contain text used to manually populate a fairly long parameter file. The parameter file is then used to create an AWS database instance. I'm hoping to automate this tedious and error prone process by extracting the desired values from the drawing and populating the parameter file.
I'm using Python and just getting started with this effort. I've been able to download the file using the mime type "image/svg+xml" but it appears the text is rendered as a vector drawing. I've also downloaded the file as a PDF, but I still can't seem to get the text.
I'm not a master of Google drawings. From what I've read the drawings are very simple and don't support anything like a tag that one might use to find important data. I suspect I'm barking up the wrong tree.
Is it possible to extract text from a Google drawing? If so, what would be the general process flow and what mime type would I use?

extract all cell data from current Jupyter notebook

Within Jupyter, there's two options to export notebooks to other formats, using nbconvert either on the command-line or as a library. Both require you to pass the original notebook as input (either as a file name or JSON data).
What I would like to do is essentially automatic, self-contained report generation, i.e. use the nbconvert library within a notebook, to export that same notebook to HTML/PDF on execution. I envisage the export code in the final cell of the document, with instructions to ignore that last cell on export.
My problem is in getting the data. Within the notebook I can access the code cells through In[1], Out[2] etc, but AFAIK there is no such functionality for markdown cells. There's also no (official) method to grab the name of the notebook (no __file__ attribute) to pass information that way.
There's plenty of examples to grab all the cell data from other notebooks - but is there a way to access all the cell data from the current notebook?
You can do this with the notebook filename and nbconvert, as you surmise. Doing some stuff client side might require extensions, one I can envision is a server extension to do the convert, and a bit of JS you write in the last code cell which renders a button, for example, and posts the notebook back to the convert server extension. Hiding certain cells (say, the Js cell) you can do in the convert extension, or with cell metadata and nbconvert templates. Given the flexibility of the architecture, there are quite a few ways to do this

Saving HTML with Checkbox states

I am writing a Perl script that is parsing a file into an HTML table which essentially contains classes and their information. The main objective of the script is for the user to check which classes he needs and the script will read which checkbox states are TRUE and only include those when creating a file that is like the original. Currently, I'm at the point where the HTML file opens in the users default browser, but if I check some of the checkboxes and save the webpage it doesn't save their states (tried it in Chrome and IE). Is there anyway to do this so that when the file is saved the user can hit enter in the program and have it do its conversion?

How to I keep track of changes in FLA file (via version control)

I have all of my files in version control (SVN subversion). FLA file is not a text file, so when I change it and check it in, there isn't a way to see what has changed inside of FLA.
Is there a way to keep track of changes to FLA file and it's contents?
Flash CS5 has introduced a new file format called XFL which has been designed for use with version control systems. This format basically splits up your FLA file into a series of separate XML data files (all contained within the one folder) which means version control systems can accurately determine what parts of the file have changed.
Simply go to File > Save AS, and select xfl from the drop-down list.
If you're using anything before CS5, then unfortunately there is no similar way to accomplish this task. I will add, however, that if this is the case, then you can try and mitigate this problem by keeping all your code in an external AS file and load any data from external xml/image/etc. files. This way, there is at least some degree of tracking for certain parts of your project.