JuliaPlots / JuliaPlots/PlotlyJS.jl

Time series plot with period data type

Open
#474 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
444
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Plotting time series with the data type Date works as expected
```
df1 = DataFrame(a=Date[Date("2023-10-20"), Date("2023-10-21"), Date("2023-10-22"), Date("2023-10-23")], b=Int[1, 2, 3, 2])
p1 = plot(df1, x=:a, y=:b)
```
Result:
![plot-1](https://github.com/JuliaPlots/PlotlyJS.jl/assets/1370470/de1e8b83-ad98-49a1-bbad-732650adb358)

But when using a Period data type such as Millisecond, Day, CompoundPeriod, ... the plot will appear blank
```
df2 = DataFrame(b=Millisecond[Millisecond(1000), Millisecond(2000), Millisecond(3000), Millisecond(4000)], a=Int[1, 2, 3, 2])
p2 = plot(df2, x=:a, y=:b)
```
```
startDate = Day(0)
df3 = DataFrame(b=Dates.CompoundPeriod[Dates.CompoundPeriod(startDate), Dates.CompoundPeriod(startDate + Day(1)), Dates.CompoundPeriod(startDate + Day(2)),Dates.CompoundPeriod(startDate + Day(3))], a=Int[1, 2, 3, 2])
p3 = plot(df3, x=:a, y=:b)
```
Result:
![plot-2](https://github.com/JuliaPlots/PlotlyJS.jl/assets/1370470/aff45e34-72e8-4848-9039-b6008bce4896)

**Version info**
```
julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a (2023-08-24 14:43 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 8 × Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, ivybridge)
Threads: 1 on 8 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =
```

```
julia> using Pkg; pkg"status"
Status `... .julia\environments\v1.9\Project.toml`
[336ed68f] CSV v0.10.11
[a93c6f00] DataFrames v1.6.1
[864edb3b] DataStructures v0.18.15
[f0f68f2c] PlotlyJS v0.18.11
[2913bbd2] StatsBase v0.34.2
[fdbf4ff8] XLSX v0.10.0
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.