-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathTraceID.fs
More file actions
42 lines (37 loc) · 1.13 KB
/
TraceID.fs
File metadata and controls
42 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace Plotly.NET
open Plotly.NET.LayoutObjects
open Plotly.NET.TraceObjects
open DynamicObj
open System
open System.Runtime.InteropServices
[<RequireQualifiedAccess>]
type TraceID =
| Cartesian2D
| Cartesian3D
| Polar
| Geo
| Mapbox
| Ternary
| Carpet
| Domain
| Smith
| Multi
static member ofTrace(t: Trace) : TraceID =
match t with
| :? Trace2D -> TraceID.Cartesian2D
| :? Trace3D -> TraceID.Cartesian3D
| :? TracePolar -> TraceID.Polar
| :? TraceGeo -> TraceID.Geo
| :? TraceMapbox -> TraceID.Mapbox
| :? TraceTernary -> TraceID.Ternary
| :? TraceCarpet -> TraceID.Carpet
| :? TraceDomain -> TraceID.Domain
| :? TraceSmith -> TraceID.Smith
| unknownTraceType -> failwith $"cannot get trace id for type {unknownTraceType.GetType()}"
static member ofTraces(t: seq<Trace>) : TraceID =
let traceIds =
t |> Seq.map TraceID.ofTrace |> Seq.distinct |> Array.ofSeq
match traceIds with
| [| sameTraceID |] -> sameTraceID
| [||] -> TraceID.Domain
| _ -> TraceID.Multi