typst / packages

Packages for Typst.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I think graph_plots seem to have issues with too large numbers in Visual Studio Code

Nic01o opened this issue · comments

I was trying to plot benchmarks and at a certain point Visual Studio Code shows at the preview window (opens at hovering over an variable) says "Loading...".

I've excluded that its just VS Code, it could far more than my reproduction code could.
Additionally pie_charts were not affected...
Anywhere beyond 10e+7 is the border. When this happens, VSCode starts eating ram like Chrome and starts intellisense again when there is no more left, thus stariting over again. I have to comment it out, reopen it (VSCode) and then it is fine.
I tried to reproduce and could make this:

working example:

#let usual_plot_2 = {

    let data_raw = (1, 2, 3, 4, 5)

    let data = data_raw.enumerate()

    let first_x = data.at(0).at(0)
    let last_x = data.last().at(0)

    let first_y = data.at(0).at(1)
    let last_y = data.last().at(1)


    let x_axis = axis(min: first_x, max: last_x + 1, location: "bottom")
    let y_axis = axis(min: first_y, max: last_y + 1, location: "left")

    let plot = plot(axes: (x_axis, y_axis), data: data)

    graph_plot(plot, (100%, 50%))
}

#usual_plot_2

too large:

#let usual_plot_3 = {

    let data_raw = (50000000000, 5555555555555555)

    let data = data_raw.enumerate()

    let first_x = data.at(0).at(0)
    let last_x = data.last().at(0)

    let first_y = data.at(0).at(1)
    let last_y = data.last().at(1)


    let x_axis = axis(min: first_x, max: last_x + 1, location: "bottom")
    let y_axis = axis(min: first_y, max: last_y + 1, location: "left")

    let plot = plot(axes: (x_axis, y_axis), data: data)

    graph_plot(plot, (100%, 50%))
}

// #usual_plot_3

VS Code:

#let data_raw = (5000, 10000, 20000, 40000, 80000, 160000, 320000, 640000, 1280000, 2560000, 5120000, 10240000, 20480000, 40960000, 81920000, 163840000, 327680000, 655360000, 1310720000, 2621440000, 5242880000, 10485760000, 20971520000, 41943040000, 83886080000, 167772160000, 335544320000, 671088640000, 1342177280000, 2684354560000, 5368709120000, 10737418240000, 21474836480000, 42949672960000, 85899345920000, 171798691840000, 343597383680000, 687194767360000, 1374389534720000, 2748779069440000, 5497558138880000, 10995116277760000, 21990232555520000, 43980465111040000, 87960930222080000, 175921860444160000, 351843720888320000, 703687441776640000, 1407374883553280000, 2814749767106560000, 5629499534213120000, 11258999068426200000, 22517998136852400000, 45035996273704800000, 90071992547409600000, 180143985094819000000, 360287970189639000000, 720575940379279000000, 1441151880758560000000, 2882303761517120000000, 5764607523034230000000, 11529215046068500000000, 23058430092136900000000, 46116860184273900000000, 92233720368547800000000, 184467440737096000000000, 368934881474192000000000, 737869762948384000000000, 1475739525896760000000000, 2951479051793520000000000, 5902958103587040000000000, 11805916207174000000000000, 23611832414348000000000000, 47223664828696000000000000, 94447329657392000000000000, 188894659314784000000000000, 377789318629568000000000000, 755578637259136000000000000, 1511157274518270000000000000, 3022314549036540000000000000)

#let data = data_raw.enumerate()

pie chart works fine:

// works
#let pie_chart_2 = {
    let data_raw = (10e+5, 10e+10, 10e+20)

    // let data_raw = (10e+3, 10e+4)

    let data = data_raw.enumerate()

    let plot = plot(data: data)

    pie_chart(plot, (50%, 50%))
}

#pie_chart_2

grafik

damn, i posted it too in the wrong repo. sorry about that