# Dash.jl: download graph as svg, 'toImageButtonOptions' not working!

**URL:** <https://discourse.julialang.org/t/dash-jl-download-graph-as-svg-toimagebuttonoptions-not-working/88212>\
**Category:** Visualization\
**Created:** [October 4, 2022, 7:04am UTC](https://discourse.julialang.org/t/dash-jl-download-graph-as-svg-toimagebuttonoptions-not-working/88212 "2022-10-04T07:04:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bondan000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bondan000/32/43220_2.png) [@Bondan000](https://discourse.julialang.org/u/Bondan000)\
**Post date:** [October 4, 2022, 7:04am UTC](https://discourse.julialang.org/t/dash-jl-download-graph-as-svg-toimagebuttonoptions-not-working/88212/1 "2022-10-04T07:04:25Z")

</div>

Hi, I created a small webapp which reads a csv and generate a plot using Plotly.jl and Dash.jl! I have a custom ‘myPlot’ function which generates the plot! I added the config settings in the ‘myPlot’ function:

```julia
function myPlot(...)
trace1 = scatter(....)
conf = PlotConfig(
        toImageButtonOptions=attr(
            format="svg", # one of png, svg, jpeg, webp
            filename="myPlot",
            height=900,
            width=1600,
            scale=1 
        ).fields)
    plot(trace1, config=conf)

```

This allows me to download the plot as ‘svg’ instead of ‘png’ from the modebar of the plot! but when you use it with dash it some how ignores the ‘PlotConfig’ settings, i can only download as ‘png’! Under ‘dcc\_graph’, I added the code:

```julia
function create_app()
app = dash(suppress_callback_exceptions = true)
app.title ="myWebApp"
app.layout = html_div() do
   html_div(id="div3", dcc_graph(id="fig", config= toImageButtonOptions=attr(
        format="svg",
        filename = "myplot"
        ).fields, figure = myPlot(df, 200, 50, length(df[!,9]))))

```

Can someone please help me with it? Is it a bug? Thank you!

PS: I tried to make a custom download button:

```julia
    callback!(app, Output("download-image", "data"), Input("fig", "figure"), Input("btn-get-svg", "n_clicks"), prevent_initial_call=true) do figure, get_svg_clicks
        ctx = callback_context()
        if !isempty(ctx.triggered)
            input_id = split(ctx.triggered[1].prop_id, ".")[1]
            action = "download"
            ftype = split(input_id, "-")[end]
            #ftype = "svg"
            return Dict(
                "type" => ftype,
                "action" => action
            )
            else
            throw(PreventUpdate())
        end
   end

```

---

<div class="post-metadata">

**Author:** ![Bondan000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bondan000/32/43220_2.png) [@Bondan000](https://discourse.julialang.org/u/Bondan000)\
**Post date:** [October 7, 2022, 6:31am UTC](https://discourse.julialang.org/t/dash-jl-download-graph-as-svg-toimagebuttonoptions-not-working/88212/2 "2022-10-07T06:31:41Z")

</div>

solved:  
`... dcc_graph(id="fig", config= PlotConfig(toImageButtonOptions=attr( format="svg", filename = "myplot" ).fields) ...`
