JamieDixon / GraphViz-C-Sharp-Wrapper

GraphViz C# Wrapper
93 stars 55 forks source link

Can't cut and paste displayed chart #21

Open joezabel opened 6 years ago

joezabel commented 6 years ago

I recently implemented a graphviz chart web application using graphvizwrapper. It works quite well. The only issue is that, on the displayed webpage, I cannot copy and paste the chart picture to an outlook email or other applications. This is a function I'd very much like to have.

Below is the code I used to build the chart:

static public string GraphVizFun (string DotFile) { var getStartProcessQuery = new GetStartProcessQuery(); var getProcessStartInfoQuery = new GetProcessStartInfoQuery(); var registerLayoutPluginCommand = new RegisterLayoutPluginCommand(getProcessStartInfoQuery, getStartProcessQuery);

        // GraphGeneration can be injected via the IGraphGeneration interface

        var wrapper = new GraphGeneration(getStartProcessQuery,
                                          getProcessStartInfoQuery,
                                          registerLayoutPluginCommand);

        byte[] output = wrapper.GenerateGraph(DotFile, Enums.GraphReturnType.Png);

        var picture = string.Format("data:image/png;base64,{0}", Convert.ToBase64String(output));

        return picture;
    }
joezabel commented 6 years ago

Clarifying further: it does let me download the chart as a .png file. It would simply be more convenient if I could copy and paste using the clipboard, like I can for other graphics on web pages.