dash-docs icon indicating copy to clipboard operation
dash-docs copied to clipboard

Basic layout example in docs not working

Open okartal opened this issue 2 years ago • 3 comments

The data reading is broken in the example given in https://dash.plotly.com/julia/layout. I had to change

using Dash
using DataFrames, UrlDownload

df3 = DataFrame(urldownload("https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv"))

function generate_table(dataframe, max_rows = 10)
    html_table([
        html_thead(html_tr([html_th(col) for col in names(df3)])),
        html_tbody([
            html_tr([html_td(dataframe[r, c]) for c in names(dataframe)]) for r = 1:min(nrow(dataframe), max_rows)
        ]),
    ])
end

app = dash()

app.layout = html_div() do
    html_h4("US Agriculture Exports (2011)"),
    generate_table(df3, 10)
end

run_server(app, "0.0.0.0", debug=true)

to

using Dash
using CSV, DataFrames

table = download("https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv")
df3 = CSV.read(table, DataFrame)

...

okartal avatar Sep 19 '23 08:09 okartal

Thanks for reporting!

It might be best to repost in https://github.com/plotly/dash-docs/issues to get the attention from people with write rights to the Plotly docs.

etpinard avatar Oct 02 '23 20:10 etpinard

Moved - thanks @okartal and @etpinard. I take it the UrlDownload library or the DataFrames library had a major release that broke the previous behavior?

@LiamConnors would you mind changing the first couple of lines of these Julia examples to use CSV instead of UrlDownload?

dash_docs/chapters/basic_callbacks/examples/multi-inputs.jl
2:using DataFrames, PlotlyJS, UrlDownload
4:df2 = DataFrame(urldownload("https://raw.githubusercontent.com/plotly/datasets/master/country_indicators.csv"))

dash_docs/chapters/basic_callbacks/examples/simple-slider.jl
2:using DataFrames, PlotlyJS, UrlDownload
4:df = DataFrame(urldownload("https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv"))

dash_docs/chapters/graph_crossfiltering/examples/interactive-graph-2.jl
2:using DataFrames, UrlDownload, PlotlyJS
4:df6 = DataFrame(urldownload("https://raw.githubusercontent.com/plotly/datasets/master/country_indicators.csv"))

dash_docs/chapters/getting_started/examples/getting_started_table.jl
2:using DataFrames, UrlDownload
4:df3 = DataFrame(urldownload("https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv"))

alexcjohnson avatar Oct 02 '23 22:10 alexcjohnson

@okartal the examples are now updated in the docs at https://dash.plotly.com/ Thanks for letting us know

LiamConnors avatar Oct 05 '23 16:10 LiamConnors