Skip to content

Commit 3391399

Browse files
authored
Merge pull request #148 from plotly/QOL
#132: Rework project structure and namespaces
2 parents 296b845 + fab07bf commit 3391399

File tree

127 files changed

+11458
-11355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+11458
-11355
lines changed

Plotly.NET.sln

+18
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{EAE25A1F
119119
src\Plotly.NET\Playground.fsx = src\Plotly.NET\Playground.fsx
120120
EndProjectSection
121121
EndProject
122+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plotly.NET.Tests.CSharp", "tests\Plotly.NET.Tests.CSharp\Plotly.NET.Tests.CSharp.csproj", "{C3CEE309-4C3F-4927-B012-220DB37750F6}"
123+
EndProject
124+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Plotly.NET.Tests.FSharpConsole", "tests\Plotly.NET.Tests.FSharpConsole\Plotly.NET.Tests.FSharpConsole.fsproj", "{60114ACE-77E6-4A19-9A2F-CB64084174AF}"
125+
EndProject
122126
Global
123127
GlobalSection(SolutionConfigurationPlatforms) = preSolution
124128
Debug|Any CPU = Debug|Any CPU
@@ -150,6 +154,18 @@ Global
150154
{6CFC629E-1A0C-4EF3-8495-BA00A356A381}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
151155
{6CFC629E-1A0C-4EF3-8495-BA00A356A381}.Release|Any CPU.ActiveCfg = Release|Any CPU
152156
{6CFC629E-1A0C-4EF3-8495-BA00A356A381}.Release|Any CPU.Build.0 = Release|Any CPU
157+
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
158+
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
159+
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
160+
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
161+
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
162+
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Release|Any CPU.Build.0 = Release|Any CPU
163+
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
164+
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
165+
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
166+
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
167+
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
168+
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Release|Any CPU.Build.0 = Release|Any CPU
153169
EndGlobalSection
154170
GlobalSection(SolutionProperties) = preSolution
155171
HideSolutionNode = FALSE
@@ -162,6 +178,8 @@ Global
162178
{60FB82C0-F472-494E-BCF7-7B3C54212406} = {7B09CC0A-F1E1-4094-9DE4-B047581E01F0}
163179
{CDB973F2-0F60-4ADB-84A8-924AFA8B6D49} = {7B09CC0A-F1E1-4094-9DE4-B047581E01F0}
164180
{6CFC629E-1A0C-4EF3-8495-BA00A356A381} = {0E87E47E-9EDC-4525-AF72-F0E139D54236}
181+
{C3CEE309-4C3F-4927-B012-220DB37750F6} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
182+
{60114ACE-77E6-4A19-9A2F-CB64084174AF} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
165183
EndGlobalSection
166184
GlobalSection(ExtensibilityGlobals) = postSolution
167185
SolutionGuid = {7177F1E1-341C-48AB-9864-6B525FFF7633}

docs/1_0_axis-styling.fsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ for even more fine-grained control, initialize a new axis and replace the old on
6363
The following example creates two mirrored axes with inside ticks, one of them with a log scale:
6464
*)
6565

66+
open Plotly.NET.LayoutObjects // this namespace contains all object abstractions for layout styling
67+
6668
let mirroredXAxis =
67-
Axis.LinearAxis.init(
69+
LinearAxis.init(
6870
Title = Title.init(Text="Mirrored axis"),
6971
ShowLine = true,
7072
Mirror = StyleParam.Mirror.AllTicks,
@@ -73,7 +75,7 @@ let mirroredXAxis =
7375
)
7476

7577
let mirroredLogYAxis =
76-
Axis.LinearAxis.init(
78+
LinearAxis.init(
7779
Title = Title.init(Text="Log axis"),
7880
AxisType = StyleParam.AxisType.Log,
7981
ShowLine = true,

docs/1_3_shapes.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ multiple shapes at once.
4545
**Attention**: Adding a shape after you added a previous one currently removes the old one. This is a bug and will be fixed
4646
*)
4747

48+
open Plotly.NET.LayoutObjects
49+
4850
let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
4951
let s2 = Shape.init (StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
5052

docs/1_4_annotations.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ multiple annotations at once.
4646
**Attention**: Adding an annotation after you added a previous one currently removes the old one. This is a bug and will be fixed
4747
*)
4848

49+
open Plotly.NET.LayoutObjects
50+
4951
let a1 = Annotation.init (X=2.,Y=4.,Text = "Hi there!")
5052
let a2 = Annotation.init (X=5.,Y=7.,Text="I am another annotation!",BGColor="white",BorderColor="black")
5153

docs/3_1_3d-surface-plots.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ let z' = [
7373
[1.;2.;];
7474
] // column (length y)
7575

76+
open Plotly.NET.TraceObjects
77+
7678
let surface2 =
7779
Chart.Surface(z',x',y',Opacity=0.5,Contours=Contours.initXyz(Show=true))
7880

docs/3_2_3d-mesh-plots.fsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ let a = Array.init 50 (fun _ -> rnd.NextDouble())
6262
let b = Array.init 50 (fun _ -> rnd.NextDouble())
6363
let c = Array.init 50 (fun _ -> rnd.NextDouble())
6464

65+
open Plotly.NET.TraceObjects
6566

6667
let mesh3d =
67-
Trace3d.initMesh3d
68+
Trace3D.initMesh3d
6869
(fun mesh3d ->
6970
mesh3d?x <- a
7071
mesh3d?y <- b

docs/3_4_3d-streamtube-plots.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ open Deedle
3838
open FSharp.Data
3939
open System
4040
open Plotly.NET
41+
open Plotly.NET.TraceObjects
4142

4243
let tubeData =
4344
Http.RequestString @"https://raw.githubusercontent.com/plotly/datasets/master/streamtube-wind.csv"

docs/3_5_3d-volume-plots.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ let values =
6262
sin(x*y*z) / (x*y*z)
6363
) x y z
6464

65+
open Plotly.NET.TraceObjects
66+
6567
let volume =
6668
Chart.Volume(
6769
x, y, z, values,

docs/3_6_3d-isosurface-plots .fsx

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ let valueIso =
6262
x * x * 0.5 + y * y + z * z * 2.
6363
) xIso yIso zIso
6464

65+
open Plotly.NET.TraceObjects
66+
6567
let isoSurface =
6668
Chart.IsoSurface(
6769
xIso,yIso,zIso,valueIso,

docs/4_2_violin-plots.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ violin1 |> GenericChart.toChartHTML
6262
(**
6363
By swapping x and y plus using `StyleParam.Orientation.Horizontal` we can flip the chart horizontaly.
6464
*)
65+
open Plotly.NET.TraceObjects
66+
6567
let violin2 =
6668
Chart.Violin(
6769
y,x,

docs/5_0_geo-vs-mapbox.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ baseMapOnly |> GenericChart.toChartHTML
6666
To control the features of the map, a `Geo` object is used that can be associtaed with a given chart using the `Chart.WithGeo` function.
6767
Here is a map with all physical features enabled and styled, at a larger-scale 1:50m resolution:
6868
*)
69+
open Plotly.NET.LayoutObjects
6970

7071
let myGeo =
7172
Geo.init(

docs/5_1_geo-plots.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ The simplest type of geo plot is plotting the (lon,lat) pairs of a location via
5252
Here is an example using the location of Canadian cities:
5353
*)
5454

55+
open Plotly.NET.LayoutObjects
56+
5557
let pointGeo =
5658
Chart.PointGeo(
5759
lon,

docs/5_2_choropleth-map.fsx

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ choroplethMap1 |> GenericChart.toChartHTML
112112
113113
you can access various map styles via `Chart.withGeoStyle`, such as the projection type, lake/ocean color, and so on.
114114
*)
115+
116+
open Plotly.NET.LayoutObjects
117+
115118
let choroplethMap2 =
116119
Chart.ChoroplethMap(
117120
locations,z,

docs/6_0_geo-vs-mapbox.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Mapbox tile maps are composed of various layers, of three different types:
5050
a `Mapbox` object where these properties can be set can be initialized via `Mapbox.init`. To use it in a chart, use the `Chart.withMapbox` function:
5151
*)
5252
open Plotly.NET
53+
open Plotly.NET.LayoutObjects
5354

5455
// a simple Mapbox with a OpenStreetMap base layer.
5556
let mb =

docs/6_1_mapbox-plots.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ let lat = [
5151
The simplest type of geographic plot using Mapbox is plotting the (lon,lat) pairs of a location via `Chart.PointMapbox`.
5252
Here is an example using the location of Canadian cities:
5353
*)
54+
open Plotly.NET.LayoutObjects
5455

5556
let pointMapbox =
5657
Chart.PointMapbox(

docs/6_2_choropleth-mapbox.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ And finally put together the chart using GeoJSON:
124124
*)
125125

126126
open Plotly.NET
127+
open Plotly.NET.LayoutObjects
127128

128129
let choroplethMapbox =
129130
Chart.ChoroplethMapbox(

docs/6_3_density-mapbox.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ let lat= dataDensityMapbox.["Latitude"] |> Series.values
5050
let magnitudes = dataDensityMapbox.["Magnitude"] |> Series.values
5151

5252
open Plotly.NET
53+
open Plotly.NET.LayoutObjects
5354

5455
let densityMapbox =
5556
Chart.DensityMapbox(

docs/7_0_candlestick.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ let's first create some data for the purpose of creating example charts:
3333
*)
3434

3535
open Plotly.NET
36+
open Plotly.NET.LayoutObjects
37+
open Plotly.NET.TraceObjects
3638

3739
let candles =
3840
[|("2020-01-17T13:40:00", 0.68888, 0.68888, 0.68879, 0.6888);

docs/7_1_funnel.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ it traversed. See also the [FunnelArea]({{root}}/6_2_funnel_area.html) chart for
4242
*)
4343

4444
open Plotly.NET
45+
open Plotly.NET.TraceObjects
4546

4647
// Customize the connector lines used to connect the funnel bars
4748
let connectorLine = Line.init (Color="royalblue", Dash=StyleParam.DrawingStyle.Dot, Width=3.)

docs/8_1_polar_bar_charts.fsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ A common use case is the **windrose chart**.
5050
A wind rose is a graphic tool used by meteorologists to give a succinct view
5151
of how wind speed and direction are typically distributed at a particular location.
5252
*)
53-
53+
open Plotly.NET.LayoutObjects
54+
5455
let windrose1 =
5556
[
5657
Chart.BarPolar (r , t, Name="11-14 m/s")
@@ -60,7 +61,7 @@ let windrose1 =
6061
]
6162
|> Chart.combine
6263
|> Chart.withAngularAxis(
63-
Axis.AngularAxis.init(
64+
AngularAxis.init(
6465
CategoryOrder = StyleParam.CategoryOrder.Array,
6566
CategoryArray = (["East"; "N-E"; "North"; "N-W"; "West"; "S-W"; "South"; "S-E";]) // set the order of the categorical axis
6667
)

docs/8_2_styling_polar_layouts.fsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ combinedPolar |> GenericChart.toChartHTML
6666
6767
Use the `Chart.withPolar` function and initialize a Polar layout with the desired looks
6868
*)
69+
open Plotly.NET.LayoutObjects
6970

7071
let styledPolar =
7172
combinedPolar
@@ -95,12 +96,12 @@ You could pass these axes to `Chart.withPolar`, but for the case where you want
9596
let styledPolar2 =
9697
styledPolar
9798
|> Chart.withAngularAxis(
98-
Axis.AngularAxis.init(
99+
AngularAxis.init(
99100
Color="darkblue"
100101
)
101102
)
102103
|> Chart.withRadialAxis(
103-
Axis.RadialAxis.init(
104+
RadialAxis.init(
104105
Title = Title.init("Hi, i am the radial axis"),
105106
Color="darkblue",
106107
SeparateThousands = true

docs/9_0_parallel-categories.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The parallel categories diagram (also known as parallel sets or alluvial diagram
3434
Combinations of category rectangles across dimensions are connected by ribbons, where the height of the ribbon corresponds to the relative frequency of occurrence of the combination of categories in the data set.
3535
*)
3636
open Plotly.NET
37+
open Plotly.NET.TraceObjects
3738

3839
let dims =
3940
[

docs/9_1_parallel-coords.fsx

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ parcoords1
6464
parcoords1 |> GenericChart.toChartHTML
6565
(***include-it-raw***)
6666

67+
open Plotly.NET.TraceObjects
68+
6769
// Dynamic object version
6870
let parcoords =
6971
let v = [|

docs/index.fsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,17 @@ static void Main(string[] args)
235235
### Declarative style in F# using the underlying `DynamicObj`:
236236
*)
237237

238+
open Plotly.NET.LayoutObjects
239+
238240
let xAxis =
239-
let tmp = Axis.LinearAxis()
241+
let tmp = LinearAxis()
240242
tmp?title <- "xAxis"
241243
tmp?showgrid <- false
242244
tmp?showline <- true
243245
tmp
244246

245247
let yAxis =
246-
let tmp = Axis.LinearAxis()
248+
let tmp = LinearAxis()
247249
tmp?title <- "yAxis"
248250
tmp?showgrid <- false
249251
tmp?showline <- true

0 commit comments

Comments
 (0)