Skip to content

#132: Rework project structure and namespaces #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Plotly.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{EAE25A1F
src\Plotly.NET\Playground.fsx = src\Plotly.NET\Playground.fsx
EndProjectSection
EndProject
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}"
EndProject
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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -150,6 +154,18 @@ Global
{6CFC629E-1A0C-4EF3-8495-BA00A356A381}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
{6CFC629E-1A0C-4EF3-8495-BA00A356A381}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CFC629E-1A0C-4EF3-8495-BA00A356A381}.Release|Any CPU.Build.0 = Release|Any CPU
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3CEE309-4C3F-4927-B012-220DB37750F6}.Release|Any CPU.Build.0 = Release|Any CPU
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60114ACE-77E6-4A19-9A2F-CB64084174AF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -162,6 +178,8 @@ Global
{60FB82C0-F472-494E-BCF7-7B3C54212406} = {7B09CC0A-F1E1-4094-9DE4-B047581E01F0}
{CDB973F2-0F60-4ADB-84A8-924AFA8B6D49} = {7B09CC0A-F1E1-4094-9DE4-B047581E01F0}
{6CFC629E-1A0C-4EF3-8495-BA00A356A381} = {0E87E47E-9EDC-4525-AF72-F0E139D54236}
{C3CEE309-4C3F-4927-B012-220DB37750F6} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
{60114ACE-77E6-4A19-9A2F-CB64084174AF} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7177F1E1-341C-48AB-9864-6B525FFF7633}
Expand Down
6 changes: 4 additions & 2 deletions docs/1_0_axis-styling.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ for even more fine-grained control, initialize a new axis and replace the old on
The following example creates two mirrored axes with inside ticks, one of them with a log scale:
*)

open Plotly.NET.LayoutObjects // this namespace contains all object abstractions for layout styling

let mirroredXAxis =
Axis.LinearAxis.init(
LinearAxis.init(
Title = Title.init(Text="Mirrored axis"),
ShowLine = true,
Mirror = StyleParam.Mirror.AllTicks,
Expand All @@ -73,7 +75,7 @@ let mirroredXAxis =
)

let mirroredLogYAxis =
Axis.LinearAxis.init(
LinearAxis.init(
Title = Title.init(Text="Log axis"),
AxisType = StyleParam.AxisType.Log,
ShowLine = true,
Expand Down
2 changes: 2 additions & 0 deletions docs/1_3_shapes.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ multiple shapes at once.
**Attention**: Adding a shape after you added a previous one currently removes the old one. This is a bug and will be fixed
*)

open Plotly.NET.LayoutObjects

let s1 = Shape.init (StyleParam.ShapeType.Rectangle,2.,4.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")
let s2 = Shape.init (StyleParam.ShapeType.Rectangle,5.,7.,3.,4.,Opacity=0.3,Fillcolor="#d3d3d3")

Expand Down
2 changes: 2 additions & 0 deletions docs/1_4_annotations.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ multiple annotations at once.
**Attention**: Adding an annotation after you added a previous one currently removes the old one. This is a bug and will be fixed
*)

open Plotly.NET.LayoutObjects

let a1 = Annotation.init (X=2.,Y=4.,Text = "Hi there!")
let a2 = Annotation.init (X=5.,Y=7.,Text="I am another annotation!",BGColor="white",BorderColor="black")

Expand Down
2 changes: 2 additions & 0 deletions docs/3_1_3d-surface-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ let z' = [
[1.;2.;];
] // column (length y)

open Plotly.NET.TraceObjects

let surface2 =
Chart.Surface(z',x',y',Opacity=0.5,Contours=Contours.initXyz(Show=true))

Expand Down
3 changes: 2 additions & 1 deletion docs/3_2_3d-mesh-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ let a = Array.init 50 (fun _ -> rnd.NextDouble())
let b = Array.init 50 (fun _ -> rnd.NextDouble())
let c = Array.init 50 (fun _ -> rnd.NextDouble())

open Plotly.NET.TraceObjects

let mesh3d =
Trace3d.initMesh3d
Trace3D.initMesh3d
(fun mesh3d ->
mesh3d?x <- a
mesh3d?y <- b
Expand Down
1 change: 1 addition & 0 deletions docs/3_4_3d-streamtube-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ open Deedle
open FSharp.Data
open System
open Plotly.NET
open Plotly.NET.TraceObjects

let tubeData =
Http.RequestString @"https://raw.githubusercontent.com/plotly/datasets/master/streamtube-wind.csv"
Expand Down
2 changes: 2 additions & 0 deletions docs/3_5_3d-volume-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ let values =
sin(x*y*z) / (x*y*z)
) x y z

open Plotly.NET.TraceObjects

let volume =
Chart.Volume(
x, y, z, values,
Expand Down
2 changes: 2 additions & 0 deletions docs/3_6_3d-isosurface-plots .fsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ let valueIso =
x * x * 0.5 + y * y + z * z * 2.
) xIso yIso zIso

open Plotly.NET.TraceObjects

let isoSurface =
Chart.IsoSurface(
xIso,yIso,zIso,valueIso,
Expand Down
2 changes: 2 additions & 0 deletions docs/4_2_violin-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ violin1 |> GenericChart.toChartHTML
(**
By swapping x and y plus using `StyleParam.Orientation.Horizontal` we can flip the chart horizontaly.
*)
open Plotly.NET.TraceObjects

let violin2 =
Chart.Violin(
y,x,
Expand Down
1 change: 1 addition & 0 deletions docs/5_0_geo-vs-mapbox.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ baseMapOnly |> GenericChart.toChartHTML
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.
Here is a map with all physical features enabled and styled, at a larger-scale 1:50m resolution:
*)
open Plotly.NET.LayoutObjects

let myGeo =
Geo.init(
Expand Down
2 changes: 2 additions & 0 deletions docs/5_1_geo-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The simplest type of geo plot is plotting the (lon,lat) pairs of a location via
Here is an example using the location of Canadian cities:
*)

open Plotly.NET.LayoutObjects

let pointGeo =
Chart.PointGeo(
lon,
Expand Down
3 changes: 3 additions & 0 deletions docs/5_2_choropleth-map.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ choroplethMap1 |> GenericChart.toChartHTML

you can access various map styles via `Chart.withGeoStyle`, such as the projection type, lake/ocean color, and so on.
*)

open Plotly.NET.LayoutObjects

let choroplethMap2 =
Chart.ChoroplethMap(
locations,z,
Expand Down
1 change: 1 addition & 0 deletions docs/6_0_geo-vs-mapbox.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Mapbox tile maps are composed of various layers, of three different types:
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:
*)
open Plotly.NET
open Plotly.NET.LayoutObjects

// a simple Mapbox with a OpenStreetMap base layer.
let mb =
Expand Down
1 change: 1 addition & 0 deletions docs/6_1_mapbox-plots.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ let lat = [
The simplest type of geographic plot using Mapbox is plotting the (lon,lat) pairs of a location via `Chart.PointMapbox`.
Here is an example using the location of Canadian cities:
*)
open Plotly.NET.LayoutObjects

let pointMapbox =
Chart.PointMapbox(
Expand Down
1 change: 1 addition & 0 deletions docs/6_2_choropleth-mapbox.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ And finally put together the chart using GeoJSON:
*)

open Plotly.NET
open Plotly.NET.LayoutObjects

let choroplethMapbox =
Chart.ChoroplethMapbox(
Expand Down
1 change: 1 addition & 0 deletions docs/6_3_density-mapbox.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ let lat= dataDensityMapbox.["Latitude"] |> Series.values
let magnitudes = dataDensityMapbox.["Magnitude"] |> Series.values

open Plotly.NET
open Plotly.NET.LayoutObjects

let densityMapbox =
Chart.DensityMapbox(
Expand Down
2 changes: 2 additions & 0 deletions docs/7_0_candlestick.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ let's first create some data for the purpose of creating example charts:
*)

open Plotly.NET
open Plotly.NET.LayoutObjects
open Plotly.NET.TraceObjects

let candles =
[|("2020-01-17T13:40:00", 0.68888, 0.68888, 0.68879, 0.6888);
Expand Down
1 change: 1 addition & 0 deletions docs/7_1_funnel.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ it traversed. See also the [FunnelArea]({{root}}/6_2_funnel_area.html) chart for
*)

open Plotly.NET
open Plotly.NET.TraceObjects

// Customize the connector lines used to connect the funnel bars
let connectorLine = Line.init (Color="royalblue", Dash=StyleParam.DrawingStyle.Dot, Width=3.)
Expand Down
5 changes: 3 additions & 2 deletions docs/8_1_polar_bar_charts.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ A common use case is the **windrose chart**.
A wind rose is a graphic tool used by meteorologists to give a succinct view
of how wind speed and direction are typically distributed at a particular location.
*)

open Plotly.NET.LayoutObjects

let windrose1 =
[
Chart.BarPolar (r , t, Name="11-14 m/s")
Expand All @@ -60,7 +61,7 @@ let windrose1 =
]
|> Chart.combine
|> Chart.withAngularAxis(
Axis.AngularAxis.init(
AngularAxis.init(
CategoryOrder = StyleParam.CategoryOrder.Array,
CategoryArray = (["East"; "N-E"; "North"; "N-W"; "West"; "S-W"; "South"; "S-E";]) // set the order of the categorical axis
)
Expand Down
5 changes: 3 additions & 2 deletions docs/8_2_styling_polar_layouts.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ combinedPolar |> GenericChart.toChartHTML

Use the `Chart.withPolar` function and initialize a Polar layout with the desired looks
*)
open Plotly.NET.LayoutObjects

let styledPolar =
combinedPolar
Expand Down Expand Up @@ -95,12 +96,12 @@ You could pass these axes to `Chart.withPolar`, but for the case where you want
let styledPolar2 =
styledPolar
|> Chart.withAngularAxis(
Axis.AngularAxis.init(
AngularAxis.init(
Color="darkblue"
)
)
|> Chart.withRadialAxis(
Axis.RadialAxis.init(
RadialAxis.init(
Title = Title.init("Hi, i am the radial axis"),
Color="darkblue",
SeparateThousands = true
Expand Down
1 change: 1 addition & 0 deletions docs/9_0_parallel-categories.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The parallel categories diagram (also known as parallel sets or alluvial diagram
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.
*)
open Plotly.NET
open Plotly.NET.TraceObjects

let dims =
[
Expand Down
2 changes: 2 additions & 0 deletions docs/9_1_parallel-coords.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ parcoords1
parcoords1 |> GenericChart.toChartHTML
(***include-it-raw***)

open Plotly.NET.TraceObjects

// Dynamic object version
let parcoords =
let v = [|
Expand Down
6 changes: 4 additions & 2 deletions docs/index.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,17 @@ static void Main(string[] args)
### Declarative style in F# using the underlying `DynamicObj`:
*)

open Plotly.NET.LayoutObjects

let xAxis =
let tmp = Axis.LinearAxis()
let tmp = LinearAxis()
tmp?title <- "xAxis"
tmp?showgrid <- false
tmp?showline <- true
tmp

let yAxis =
let tmp = Axis.LinearAxis()
let tmp = LinearAxis()
tmp?title <- "yAxis"
tmp?showgrid <- false
tmp?showline <- true
Expand Down
Loading