Tables

using PlotlyJS, DataFrames, CSV
function table1()
    values = [
        "Salaries" 1200000 1300000 1300000 1400000
        "Office" 20000 20000 20000 20000
        "Merchandise" 80000 70000 120000 90000
        "Legal" 2000 2000 2000 2000
        "TOTAL" 12120000 130902000 131222000 14102000
    ]

    trace = table(
        header=attr(
            values=["Expenses", "Q1", "Q2", "Q3", "Q4"],
            align="center", line=attr(width=1, color="black"),
            fill_color="grey", font=attr(family="Arial", size=12, color="white")
        ),
        cells=attr(
            values=values, align="center", line=attr(color="black", width=1),
            font=attr(family="Arial", size=11, color="black")
        )
    )
    plot(trace)

end
table1()
SalariesOfficeMerchandiseLegalTOTALExpenses12000002000080000200012120000Q1130000020000700002000130902000Q21300000200001200002000131222000Q314000002000090000200014102000Q4
function table2()
    values = [
        "Salaries" 1200000 1300000 1300000 1400000
        "Office" 20000 20000 20000 20000
        "Merchandise" 80000 70000 120000 90000
        "Legal" 2000 2000 2000 2000
        "TOTAL" 12120000 130902000 131222000 14102000
    ]

    trace = table(
        header=attr(
            values=["EXPENSES", "Q1", "Q2", "Q3", "Q4"],
            align=["left", "center"], line=attr(width=1, color="#506784"),
            fill_color="#119DFF",
            font=attr(family="Arial", size=12, color="white")
        ),
        cells=attr(
            values=values, align=["left", "center"],
            line=attr(color="#506784", width=1),
            font=attr(family="Arial", size=11, color="#506784"),
            fill_color=["#25FEFD", "white"]
        )
    )
    plot(trace)

end
table2()
SalariesOfficeMerchandiseLegalTOTALEXPENSES12000002000080000200012120000Q1130000020000700002000130902000Q21300000200001200002000131222000Q314000002000090000200014102000Q4
function table2a()
    p1 = table1()
    restyle!(p1,
        header=attr(
            align=["left", "center"], line_color="#506784", fill_color="#119DFF"
        ),
        cells=attr(
            align=["left", "center"], line_color="#506784",
            fill_color=["#25FEFD", "white"], font_color="#506784"
        )
    )
    p1
end
table2a()
SalariesOfficeMerchandiseLegalTOTALExpenses12000002000080000200012120000Q1130000020000700002000130902000Q21300000200001200002000131222000Q314000002000090000200014102000Q4
function table3()
    nm = tempname()
    url = "https://raw.githubusercontent.com/plotly/datasets/master/Mining-BTC-180.csv"
    download(url, nm)
    df = CSV.read(nm)
    rm(nm)

    data = Array(df)

    trace = table(
        columnwidth=[200, 500, 600, 600, 400, 400, 600, 600, 600],
        # columnorder=0:9,
        header=attr(
            values=map(x-> replace(string(x), '_' => '-'), names(df)),
            align="center",
            line=attr(width=1, color="rgb(50, 50, 50)"),
            fill_color=["rgb(235, 100, 230)"],
            font=attr(family="Arial", size=12, color="white")
        ),
        cells=attr(
            values=Array(df),
            align=["center", "center"],
            line=attr(width=1, color="black"),
            fill_color=["rgba(228, 222, 249, 0.65)", "rgb(235, 193, 238)", "rgba(228, 222, 249, 0.65)"],
            font=attr(family="Arial", size=10, color="black")
        )
    )

    layout = Layout(
        title="Bitcoin mining stats for 180 days",
        width=1200
    )
    plot(trace, layout)
end
table3()
01234567891011121314151617181920212223242526272829303132333435363738394041424344454647Column12017-04-2900:00:002017-04-3000:00:002017-05-0100:00:002017-05-0200:00:002017-05-0300:00:002017-05-0400:00:002017-05-0500:00:002017-05-0600:00:002017-05-0700:00:002017-05-0800:00:002017-05-0900:00:002017-05-1000:00:002017-05-1100:00:002017-05-1200:00:002017-05-1300:00:002017-05-1400:00:002017-05-1500:00:002017-05-1600:00:002017-05-1700:00:002017-05-1800:00:002017-05-1900:00:002017-05-2000:00:002017-05-2100:00:002017-05-2200:00:002017-05-2300:00:002017-05-2400:00:002017-05-2500:00:002017-05-2600:00:002017-05-2700:00:002017-05-2800:00:002017-05-2900:00:002017-05-3000:00:002017-05-3100:00:002017-06-0100:00:002017-06-0200:00:002017-06-0300:00:002017-06-0400:00:002017-06-0500:00:002017-06-0600:00:002017-06-0700:00:002017-06-0800:00:002017-06-0900:00:002017-06-1000:00:002017-06-1100:00:002017-06-1200:00:002017-06-1300:00:002017-06-1400:00:002017-06-1500:00:00Date341319281489294786333161295149354737267193363022316011365096332879311391294743317698329266369098329229233977317527288904319502352805326057327868367710338642350114333340331914308143321638347961321634319709271539305320266044289930297416339720307377282184254993222892269098291776287644293141Number-transactions448891639180723892124409970434250694359179334722743591794333232467054940218624119773375790142867914398136456515447321723674392431462739527554565154459299040919374064100497673845620104828621453238649767384887867447313953025964858244503598543250225687700543235755335815094944556732255673225094944475753049262374959978475753047237895162426Output-volume(BTC)311917927202162878278314955327603733500746277917036107893505620406217337153943665041346807737317183885821401802840907033356332424126439861754746880486231743314904499105566894655244885871334511962051217375262057526081461320645808558624522954377757190853596710565865846705146706070869056906408509591695362553845779114596768452170935540766Market-price448891639180723892124409970434250694359179334722743591794333232467054940218624119773375790142867914398136456515447321723674392431462739527554565154459299040919374064100497673845620104828621453238649767384887867447313953025964858244503598543250225687700543235755335815094944556732255673225094944475753049262374959978475753047237895162426Hash-rate91010101010111011121212121212111315141415141414161717161618171819202124232423212323242922211920Cost-per-trans-USD311917927202162878278314955327603733500746277917036107893505620406217337153943665041346807737317183885821401802840907033356332424126439861754746880486231743314904499105566894655244885871334511962051217375262057526081461320645808558624522954377757190853596710565865846705146706070869056906408509591695362553845779114596768452170935540766Mining-revenue-USD256199228273247307261297277316303303280322301297327343486392443388353407468473499470529421495588570569470546442475511668491456391356410479455435Transaction-fees-BTCBitcoin mining stats for 180 days