I'm trying to create a chart in C# (using the plotly libraries) from the json exported from plotly's chart studio.
I can see options in the code for exporting json GenericChart.toFigureJson(barChart);
, but nothing for from/importing/parsing.
Is this possible?
Is this related to this recent Discussion thread on Plotly.NET?
I'll port my answer from there anyways, to make it more visible:
However the actual question over there is more specific than here, so i'll add a bit detail:
You can absolutely deserialize Plotly.NET objects from JSON, but a lot of work has to be done to determine the types to use, meaning you cannot just use Newtsonsoft.JSON and use the default Deserializer and call it a day. You'd have to determine which Plotly.NET type to used based on member names, and then construct these types mapping their properties to the optional parameters of each type. Quite a hard task to do for any kind of object, which is why we do not offer this functionality.
However, if you want to deserialize a json string that is always looking kind of the same (e.g. it is always a single bar chart), then this manual mapping might be feasible.