From 842e932bf34e56f2ebc1d08d95b761d784205ce7 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 10:09:55 +0300 Subject: [PATCH 01/39] First batch of fixes --- src/Plotly.NET/ChartExtensions.fs | 18 +- src/Plotly.NET/GenericChartExtensions.fs | 155 ++++++++++++++---- src/Plotly.NET/Playground.fsx | 86 +++++----- .../HtmlCodegen/ChartLayout.fs | 8 +- 4 files changed, 179 insertions(+), 88 deletions(-) diff --git a/src/Plotly.NET/ChartExtensions.fs b/src/Plotly.NET/ChartExtensions.fs index e47ca0750..e94f45af2 100644 --- a/src/Plotly.NET/ChartExtensions.fs +++ b/src/Plotly.NET/ChartExtensions.fs @@ -1064,14 +1064,14 @@ module ChartExtensions = /// Show chart in browser [] - static member WithDescription (description:ChartDescription) (ch:GenericChart) = + static member withDescription (description:ChartDescription) (ch:GenericChart) = ch |> mapDisplayOptions (DisplayOptions.style(Description=description)) /// Adds the given additional html tags on the chart's DisplayOptions. They will be included in the document's [] - static member WithAdditionalHeadTags (additionalHeadTags:seq) (ch:GenericChart) = + static member withAdditionalHeadTags (additionalHeadTags:seq) (ch:GenericChart) = ch |> mapDisplayOptions ( fun d -> let tags = d.TryGetTypedValue>("AdditionalHeadTags") @@ -1084,14 +1084,14 @@ module ChartExtensions = /// Sets the given additional head tags on the chart's DisplayOptions. They will be included in the document's [] - static member WithHeadTags (headTags:seq) (ch:GenericChart) = + static member withHeadTags (headTags:seq) (ch:GenericChart) = ch |> mapDisplayOptions (DisplayOptions.style(AdditionalHeadTags=headTags)) /// Adds the necessary script tags to render tex strings to the chart's DisplayOptions [] - static member WithMathTex ([]?AppendTags:bool) = + static member withMathTex ([]?AppendTags:bool) = let tags = [ """""" """""" @@ -1099,14 +1099,14 @@ module ChartExtensions = (fun (ch:GenericChart) -> if (AppendTags |> Option.defaultValue true) then - ch |> Chart.WithAdditionalHeadTags tags + ch |> Chart.withAdditionalHeadTags tags else - ch |> Chart.WithHeadTags tags + ch |> Chart.withHeadTags tags ) /// Save chart as html single page [] - static member SaveHtmlAs pathName (ch:GenericChart,[] ?Verbose) = + static member saveHtmlAs pathName (ch:GenericChart,[] ?Verbose) = let html = GenericChart.toEmbeddedHTML ch let file = sprintf "%s.html" pathName // remove file extension File.WriteAllText(file, html) @@ -1117,7 +1117,7 @@ module ChartExtensions = /// Show chart in browser [] - static member Show (ch:GenericChart) = + static member show (ch:GenericChart) = let guid = Guid.NewGuid().ToString() let html = GenericChart.toEmbeddedHTML ch let tempPath = Path.GetTempPath() @@ -1128,7 +1128,7 @@ module ChartExtensions = /// Show chart in browser [] - static member ShowAsImage (format:StyleParam.ImageFormat) (ch:GenericChart) = + static member showAsImage (format:StyleParam.ImageFormat) (ch:GenericChart) = let guid = Guid.NewGuid().ToString() let html = GenericChart.toEmbeddedImage format ch let tempPath = Path.GetTempPath() diff --git a/src/Plotly.NET/GenericChartExtensions.fs b/src/Plotly.NET/GenericChartExtensions.fs index 4a394ce75..996169f0e 100644 --- a/src/Plotly.NET/GenericChartExtensions.fs +++ b/src/Plotly.NET/GenericChartExtensions.fs @@ -15,7 +15,7 @@ module GenericChartExtensions = [] [] - member this.WithTraceName + member this.withTraceName ( [] ?Name, [] ?Showlegend, @@ -27,7 +27,7 @@ module GenericChartExtensions = /// Set the axis anchor id the trace is belonging to [] [] - member this.WithAxisAnchor + member this.withAxisAnchor ( [] ?X, [] ?Y, @@ -46,13 +46,13 @@ module GenericChartExtensions = /// Apply styling to the Marker(s) of the chart as Object. [] [] - member this.WithMarker(marker:Marker) = + member this.withMarker(marker:Marker) = this |> mapTrace (Trace.TraceStyle.SetMarker(marker)) /// Apply styling to the Marker(s) of the chart. [] [] - member this.WithMarkerStyle + member this.withMarkerStyle ( [] ?Size, [] ?Color, @@ -68,13 +68,13 @@ module GenericChartExtensions = /// Apply styling to the Line(s) of the chart as Object. [] [] - member this.WithLine(line:Line) = + member this.withLine(line:Line) = this |> mapTrace (Trace.TraceStyle.SetLine(line)) /// Apply styling to the Line(s) of the chart. [] [] - member this.WithLineStyle + member this.withLineStyle ( [] ?Width, [] ?Color, @@ -92,13 +92,13 @@ module GenericChartExtensions = /// Apply styling to the xError(s) of the chart as Object [] [] - member this.WithXError(xError:Error) = + member this.withXError(xError:Error) = this |> mapTrace (Trace.TraceStyle.SetErrorX(xError)) /// Apply styling to the xError(s) of the chart as Object [] [] - member this.WithXErrorStyle + member this.withXErrorStyle ( [] ?Array, [] ?Arrayminus, @@ -113,13 +113,13 @@ module GenericChartExtensions = /// Apply styling to the yError(s) of the chart as Object [] [] - member this.WithYError(yError:Error) = + member this.withYError(yError:Error) = this |> mapTrace (Trace.TraceStyle.SetErrorY(yError)) /// Apply styling to the yError(s) of the chart as Object [] [] - member this.WithYErrorStyle + member this.withYErrorStyle ( [] ?Array, [] ?Arrayminus, @@ -134,14 +134,14 @@ module GenericChartExtensions = /// Apply styling to the zError(s) of the chart as Object [] [] - member this.WithZError(zError:Error) = + member this.withZError(zError:Error) = this |> mapTrace (Trace.TraceStyle.SetErrorZ(zError)) /// Apply styling to the zError(s) of the chart as Object [] [] - member this.WithZErrorStyle + member this.withZErrorStyle ( [] ?Array, [] ?Arrayminus, @@ -157,10 +157,16 @@ module GenericChartExtensions = // ############################################################ // ####################### Apply to layout - // Sets x-Axis of 2d and 3d- Charts + [] [] [] - member this.WithX_Axis(xAxis:Axis.LinearAxis,[] ?Id) = + member this.WithX_Axis(xAxis:Axis.LinearAxis,[] ?Id : int) = + this.withXAxis(xAxis, ?Id = Id) + + // Sets x-Axis of 2d and 3d- Charts + [] + [] + member this.withXAxis(xAxis:Axis.LinearAxis,[] ?Id : int) = let contains3d = this @@ -182,10 +188,37 @@ module GenericChartExtensions = |> Layout.style (Scene=Scene.init( xAxis=xAxis) ) GenericChart.addLayout layout this + + [] + [] + [] + member this.WithX_AxisStyle(title, + [] ?MinMax, + [] ?Showgrid, + [] ?Showline, + [] ?Side, + [] ?Overlaying, + [] ?Id, + [] ?Domain, + [] ?Position, + [] ?Zeroline, + [] ?Anchor) = + this.withXAxisStyle(title, + ?MinMax = MinMax, + ?Showgrid = Showgrid, + ?Showline = Showline, + ?Side = Side, + ?Overlaying = Overlaying, + ?Id = Id, + ?Domain = Domain, + ?Position = Position, + ?Zeroline = Zeroline, + ?Anchor = Anchor) + // Sets x-Axis of 2d and 3d- Charts - [] + [] [] - member this.WithX_AxisStyle(title, + member this.withXAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -202,18 +235,31 @@ module GenericChartExtensions = ?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) this |> Chart.withX_Axis(xaxis,?Id=Id) - /// Sets the range slider for the xAxis + [] [] [] member this.WithX_AxisRangeSlider(rangeSlider:RangeSlider, [] ?Id) = + this.withXAxisRangeSlider(rangeSlider, ?Id = Id) + + /// Sets the range slider for the xAxis + [] + [] + member this.withXAxisRangeSlider(rangeSlider:RangeSlider, + [] ?Id) = let xaxis = Axis.LinearAxis.init(RangeSlider = rangeSlider) this |> Chart.withX_Axis(xaxis,?Id=Id) - // Sets y-Axis of 2d and 3d- Charts + [] [] [] - member this.WithY_Axis(yAxis:Axis.LinearAxis,[] ?Id) = + member this.WithY_Axis(yAxis:Axis.LinearAxis,[] ?Id : int) = + this.withYAxis(yAxis, ?Id = Id) + + // Sets y-Axis of 2d and 3d- Charts + [] + [] + member this.withYAxis(yAxis:Axis.LinearAxis,[] ?Id) = let contains3d = this @@ -235,10 +281,36 @@ module GenericChartExtensions = |> Layout.style(Scene=Scene.init(yAxis=yAxis) ) GenericChart.addLayout layout this - // Sets y-Axis of 3d- Charts + [] [] [] member this.WithY_AxisStyle(title, + [] ?MinMax, + [] ?Showgrid, + [] ?Showline, + [] ?Side, + [] ?Overlaying, + [] ?Id, + [] ?Domain, + [] ?Position, + [] ?Zeroline, + [] ?Anchor) = + this.withYAxisStyle(title, + ?MinMax = MinMax, + ?Showgrid = Showgrid, + ?Showline = Showline, + ?Side = Side, + ?Overlaying = Overlaying, + ?Id = Id, + ?Domain = Domain, + ?Position = Position, + ?Zeroline = Zeroline, + ?Anchor = Anchor) + + // Sets y-Axis of 3d- Charts + [] + [] + member this.withYAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -255,22 +327,41 @@ module GenericChartExtensions = ?Showline=Showline,?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) this |> Chart.withY_Axis(yaxis,?Id=Id) - - // Sets z-Axis of 3d- Charts + [] [] [] member this.WithZ_Axis(zAxis:Axis.LinearAxis) = + this.withZAxis(zAxis) + + // Sets z-Axis of 3d- Charts + [] + [] + member this.withZAxis(zAxis:Axis.LinearAxis) = let layout = Layout() |> Layout.style(Scene=Scene.init(zAxis=zAxis)) GenericChart.addLayout layout this - - - // Sets z-Axis style with ... + [] [] [] member this.WithZ_AxisStyle(title, + [] ?MinMax, + [] ?Showgrid, + [] ?Showline, + [] ?Domain, + [] ?Anchor) = + this.withZAxisStyle(title, + ?MinMax = MinMax, + ?Showgrid = Showgrid, + ?Showline = Showline, + ?Domain = Domain, + ?Anchor = Anchor) + + // Sets z-Axis style with ... + [] + [] + member this.withZAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -646,43 +737,43 @@ module GenericChartExtensions = [] [] member this.WithDescription (description:ChartDescription) = - this |> Chart.WithDescription description + this |> Chart.withDescription description /// Adds the given additional script tags on the chart's DisplayOptions. They will be included in the document's [] [] member this.WithAdditionalHeadTags (additionalHeadTags:seq) = - this |> Chart.WithAdditionalHeadTags additionalHeadTags + this |> Chart.withAdditionalHeadTags additionalHeadTags /// Sets the given additional script tags on the chart's DisplayOptions. They will be included in the document's [] [] member this.WithHeadTags (headTags:seq) = - this |> Chart.WithHeadTags headTags + this |> Chart.withHeadTags headTags /// Adds the necessary script tags to render tex strings to the chart's DisplayOptions [] [] member this.WithMathTex([]?AppendTags:bool) = let append = Option.defaultValue true AppendTags - this |> Chart.WithMathTex(append) + this |> Chart.withMathTex(append) /// Save chart as html single page [] [] member this.SaveHtmlAs (pathName:string, [] ?Verbose) = - Chart.SaveHtmlAs pathName this + Chart.saveHtmlAs pathName this /// Show chart in browser [] [] - member this.Show() = this |> Chart.Show + member this.Show() = this |> Chart.show /// Show chart in browser [] [] member this.ShowAsImage (format:StyleParam.ImageFormat) = - this |> Chart.ShowAsImage format + this |> Chart.showAsImage format \ No newline at end of file diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index 1326d0d6a..31735c84b 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -81,7 +81,7 @@ open FSharpAux |> Chart.withLayoutGridStyle(YGap= 0.1) |> Chart.withTitle("Hi i am the new SingleStackChart") |> Chart.withX_AxisStyle("im the shared xAxis") -|> Chart.Show +|> Chart.show [ [ @@ -107,7 +107,7 @@ open FSharpAux ] ] |> Chart.Grid() -|> Chart.Show +|> Chart.show [ Chart.Point([1,2],Name="1,1") @@ -149,7 +149,7 @@ open FSharpAux ] |> Chart.Grid(6,2,Pattern=StyleParam.LayoutGridPattern.Coupled) |> Chart.withSize (1000., 2000.) -|> Chart.Show +|> Chart.show [ @@ -180,7 +180,7 @@ open FSharpAux Annotation.init(1,2,Text= "soos1",YRef="y") Annotation.init(1,2,Text= "soos2",YRef="y2") ] -|> Chart.Show +|> Chart.show let dataDensityMapbox = @@ -206,7 +206,7 @@ Chart.DensityMapbox( Center = (60.,30.) ) ) -|> Chart.Show +|> Chart.show let dataMapbox = @@ -243,7 +243,7 @@ Chart.LineMapbox( ) |> Chart.withSize(1000.,1000.) |> Chart.withTitle "lol?" -|> Chart.Show +|> Chart.show Chart.Column( keysvalues= [ @@ -258,7 +258,7 @@ Chart.Column( CategoryArray = ["first"; "second"; "third"] ) ) -|> Chart.Show +|> Chart.show Chart.Range( x = [1;2], @@ -269,7 +269,7 @@ Chart.Range( UpperLabels=["upper1";"upper2"], LowerLabels=["lower1";"lower2"] ) -|> Chart.Show +|> Chart.show let geoJson = Http.RequestString "https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json" @@ -300,7 +300,7 @@ Chart.ChoroplethMapbox( |> Chart.withMapbox( Mapbox.init(Style=StyleParam.MapboxStyle.OpenStreetMap) ) -|> Chart.Show +|> Chart.show Chart.ChoroplethMap( locations = locations, @@ -314,7 +314,7 @@ Chart.ChoroplethMap( Scope=StyleParam.GeoScope.Usa ) ) -|> Chart.Show +|> Chart.show Trace.initChoroplethMap(id) |> fun t -> @@ -330,7 +330,7 @@ Trace.initChoroplethMap(id) Scope=StyleParam.GeoScope.Usa ) ) -|> Chart.Show +|> Chart.show System.Random().Next(1,40) @@ -343,19 +343,19 @@ let funnel = let connector = FunnelConnector.init(Line=connectorLine) Chart.Funnel (x,y,Color="59D4E8", Line=line, Connector=connector) |> Chart.withMarginSize(Left=100) - |> Chart.Show + |> Chart.show let funnelArea = let values = [|5; 4; 3; 2; 1|] let text = [|"The 1st"; "The 2nd"; "The 3rd"; "The 4th"; "The 5th"|] let line = Line.init (Color="purple", Width=3.) Chart.FunnelArea(Values=values, Text=text, Line=line) - |> Chart.Show + |> Chart.show let funnelArea2 = let labels = [|1;2;2;3;3;3|] Chart.FunnelArea(Labels=labels) - |> Chart.Show + |> Chart.show let yAxis = Axis.LinearAxis.init( @@ -383,14 +383,14 @@ Chart.Range( | 1 -> t |> Trace.TraceStyle.TextLabel ["lowerOne";"lowerTwo"] | 2 -> t ) -|> Chart.Show +|> Chart.show let testAnnotation = Annotation.init(X=System.DateTime.Now, Y=0,Text="test") Chart.Line([System.DateTime.Now, 5]) |> Chart.withAnnotations [testAnnotation] -|> Chart.Show +|> Chart.show let descritptionTable =""" @@ -408,8 +408,8 @@ let descritptionTable ="""
""" Chart.Point([1.,2.]) -|> Chart.WithDescription (ChartDescription.create "Some Table" descritptionTable) -|> Chart.Show +|> Chart.withDescription (ChartDescription.create "Some Table" descritptionTable) +|> Chart.show [ Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") @@ -417,8 +417,8 @@ Chart.Point([1.,2.]) ] |> Chart.Combine |> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" -|> Chart.WithMathTex(true) -|> Chart.Show +|> Chart.withMathTex(true) +|> Chart.show let myTemplate = @@ -448,7 +448,7 @@ let myLegend = |> List.map Chart.Line |> Chart.Combine |> Chart.withLegend(myLegend) -|> Chart.Show +|> Chart.show // Dynamic object style, which is more or less equivalent to how you would create figure objects in plotly.js. @@ -486,7 +486,7 @@ let trace = trace |> GenericChart.ofTraceObject |> GenericChart.setLayout layout -|> Chart.Show +|> Chart.show Chart.LineGeo( @@ -499,7 +499,7 @@ Chart.LineGeo( 44.64; 48.25; 49.89; 50.45 ],ShowMarkers = true,MarkerSymbol = StyleParam.Symbol.Cross ) -|> Chart.Show +|> Chart.show Chart.ScatterGeo( [ @@ -518,7 +518,7 @@ Chart.ScatterGeo( ShowOcean=true, OceanColor="lightblue", ShowRivers=true) -|> Chart.Show +|> Chart.show //test new withMapStyle function let locations2,z2 = @@ -582,7 +582,7 @@ Chart.ChoroplethMap(locations2,z2,Locationmode=StyleParam.LocationFormat.Country ShowRivers=true) |> Chart.withColorBarStyle ("Alcohol consumption[l/y]",Length=0.5) |> Chart.withSize(1000.,1000.) -|> Chart.Show +|> Chart.show let waterfallData = [ "Sales" , 60 , StyleParam.WaterfallMeasure.Relative @@ -594,7 +594,7 @@ let waterfallData = [ ] Chart.Waterfall(waterfallData) -|> Chart.Show +|> Chart.show let manyPoints = @@ -619,37 +619,37 @@ let manyLines = Chart.Scatter(x = [1;2;3], y = [4;3;4],mode=StyleParam.Mode.Markers, StackGroup = "meem", Orientation= StyleParam.Orientation.Vertical, GroupNorm = StyleParam.GroupNorm.Percent ) ] |> Chart.Combine -|> Chart.Show +|> Chart.show //Just try this, its amazing how much faster WebGL loads and zooms Chart.Point(manyPoints,UseWebGL=true) -|> Chart.Show +|> Chart.show Chart.Point(manyPoints) -|> Chart.Show +|> Chart.show manyLines |> List.map (fun l -> Chart.Line(l,UseWebGL=true)) |> Chart.Combine -|> Chart.Show +|> Chart.show Chart.Line(manyPoints,UseWebGL=true) -|> Chart.Show +|> Chart.show Chart.Line(manyPoints,UseWebGL=false) -|> Chart.Show +|> Chart.show Chart.Spline(manyPoints,UseWebGL=true) -|> Chart.Show +|> Chart.show Chart.Spline(manyPoints,UseWebGL=false) -|> Chart.Show +|> Chart.show Chart.Bubble(manyBubbles,UseWebGL=true) -|> Chart.Show +|> Chart.show Chart.Bubble(manyBubbles,UseWebGL=false) -|> Chart.Show +|> Chart.show let stockData = [|("2020-01-17T13:40:00", 0.68888, 0.68888, 0.68879, 0.6888); @@ -667,10 +667,10 @@ let stockData = |> Array.map (fun (d,o,h,l,c)->System.DateTime.Parse d, StockData.Create(o,h,l,c)) Chart.Candlestick stockData -|> Chart.Show +|> Chart.show Chart.OHLC stockData -|> Chart.Show +|> Chart.show Chart.Treemap( ["Eve"; "Cain"; "Seth"; "Enos"; "Noam"; "Abel"; "Awan"; "Enoch"; "Azura"], @@ -678,7 +678,7 @@ Chart.Treemap( Values = [10.; 14.; 12.; 10.; 2.; 6.; 6.; 4.; 4.] ) |> Chart.withTitle "Treemap test" -|> Chart.Show +|> Chart.show //Sunbursst example from plotly docs: https://plotly.com/javascript/sunburst-charts @@ -688,7 +688,7 @@ Chart.Sunburst( Values = [10.; 14.; 12.; 10.; 2.; 6.; 6.; 4.; 4.] ) |> Chart.withTitle "Sunburst test" -|> Chart.Show +|> Chart.show let stack ( columns:int, space) = @@ -757,7 +757,7 @@ generateDomainRanges 8 1 |> Chart.withLayoutGridStyle(XSide=StyleParam.LayoutGridXSide.Bottom) |> Chart.withTitle("Hi i am the new SingleStackChart") |> Chart.withX_AxisStyle("im the shared xAxis") -|> Chart.Show +|> Chart.show [ [1;2] @@ -769,7 +769,7 @@ generateDomainRanges 8 1 TitleSide=StyleParam.Side.Right, TitleFont=Font.init(Size=20.) ) -|> Chart.Show +|> Chart.show // Heatmap example from Plotly docs: https://plotly.net/2_7_heatmaps.html let matrix = @@ -792,7 +792,7 @@ let heat1 = ) |> Chart.withSize(700.,500.) |> Chart.withMarginSize(Left=200.) - |> Chart.Show + |> Chart.show let values,labels = [ diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs index 12ecd79a6..cb08be51c 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs @@ -210,7 +210,7 @@ let displayOptionsChartDescriptionChart = let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.] let description1 = ChartDescription.create "Hello" "F#" Chart.Point(x,y,Name="desc1") - |> Chart.WithDescription(description1) + |> Chart.withDescription(description1) let additionalHeadTagsChart = let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ] @@ -233,9 +233,9 @@ let additionalHeadTagsChart = """

I am heading

""" bulmaHero Chart.Point(x,y,Name="desc3") - |> Chart.WithDescription description3 + |> Chart.withDescription description3 // Add reference to the bulma css framework - |> Chart.WithAdditionalHeadTags [""""""] + |> Chart.withAdditionalHeadTags [""""""] let mathtexChart = [ @@ -245,7 +245,7 @@ let mathtexChart = |> Chart.Combine |> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" // include mathtex tags in . pass true to append these scripts, false to ONLY include MathTeX. - |> Chart.WithMathTex(true) + |> Chart.withMathTex(true) [] let ``Display options`` = From edeac3e2d12fcd02e0eaefefef55f2e20bbf2c36 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 10:25:11 +0300 Subject: [PATCH 02/39] C# Extensions reverted --- src/Plotly.NET/GenericChartExtensions.fs | 141 ++++------------------- 1 file changed, 25 insertions(+), 116 deletions(-) diff --git a/src/Plotly.NET/GenericChartExtensions.fs b/src/Plotly.NET/GenericChartExtensions.fs index 996169f0e..c20477223 100644 --- a/src/Plotly.NET/GenericChartExtensions.fs +++ b/src/Plotly.NET/GenericChartExtensions.fs @@ -15,7 +15,7 @@ module GenericChartExtensions = [] [] - member this.withTraceName + member this.WithTraceName ( [] ?Name, [] ?Showlegend, @@ -27,7 +27,7 @@ module GenericChartExtensions = /// Set the axis anchor id the trace is belonging to [] [] - member this.withAxisAnchor + member this.WithAxisAnchor ( [] ?X, [] ?Y, @@ -46,13 +46,13 @@ module GenericChartExtensions = /// Apply styling to the Marker(s) of the chart as Object. [] [] - member this.withMarker(marker:Marker) = + member this.WithMarker(marker:Marker) = this |> mapTrace (Trace.TraceStyle.SetMarker(marker)) /// Apply styling to the Marker(s) of the chart. [] [] - member this.withMarkerStyle + member this.WithMarkerStyle ( [] ?Size, [] ?Color, @@ -68,13 +68,13 @@ module GenericChartExtensions = /// Apply styling to the Line(s) of the chart as Object. [] [] - member this.withLine(line:Line) = + member this.WithLine(line:Line) = this |> mapTrace (Trace.TraceStyle.SetLine(line)) /// Apply styling to the Line(s) of the chart. [] [] - member this.withLineStyle + member this.WithLineStyle ( [] ?Width, [] ?Color, @@ -92,13 +92,13 @@ module GenericChartExtensions = /// Apply styling to the xError(s) of the chart as Object [] [] - member this.withXError(xError:Error) = + member this.WithXError(xError:Error) = this |> mapTrace (Trace.TraceStyle.SetErrorX(xError)) /// Apply styling to the xError(s) of the chart as Object [] [] - member this.withXErrorStyle + member this.WithXErrorStyle ( [] ?Array, [] ?Arrayminus, @@ -113,13 +113,13 @@ module GenericChartExtensions = /// Apply styling to the yError(s) of the chart as Object [] [] - member this.withYError(yError:Error) = + member this.WithYError(yError:Error) = this |> mapTrace (Trace.TraceStyle.SetErrorY(yError)) /// Apply styling to the yError(s) of the chart as Object [] [] - member this.withYErrorStyle + member this.WithYErrorStyle ( [] ?Array, [] ?Arrayminus, @@ -134,14 +134,14 @@ module GenericChartExtensions = /// Apply styling to the zError(s) of the chart as Object [] [] - member this.withZError(zError:Error) = + member this.WithZError(zError:Error) = this |> mapTrace (Trace.TraceStyle.SetErrorZ(zError)) /// Apply styling to the zError(s) of the chart as Object [] [] - member this.withZErrorStyle + member this.WithZErrorStyle ( [] ?Array, [] ?Arrayminus, @@ -157,16 +157,10 @@ module GenericChartExtensions = // ############################################################ // ####################### Apply to layout - [] - [] - [] - member this.WithX_Axis(xAxis:Axis.LinearAxis,[] ?Id : int) = - this.withXAxis(xAxis, ?Id = Id) - // Sets x-Axis of 2d and 3d- Charts - [] + [] [] - member this.withXAxis(xAxis:Axis.LinearAxis,[] ?Id : int) = + member this.WithX_Axis(xAxis:Axis.LinearAxis,[] ?Id) = let contains3d = this @@ -188,37 +182,10 @@ module GenericChartExtensions = |> Layout.style (Scene=Scene.init( xAxis=xAxis) ) GenericChart.addLayout layout this - - [] - [] - [] - member this.WithX_AxisStyle(title, - [] ?MinMax, - [] ?Showgrid, - [] ?Showline, - [] ?Side, - [] ?Overlaying, - [] ?Id, - [] ?Domain, - [] ?Position, - [] ?Zeroline, - [] ?Anchor) = - this.withXAxisStyle(title, - ?MinMax = MinMax, - ?Showgrid = Showgrid, - ?Showline = Showline, - ?Side = Side, - ?Overlaying = Overlaying, - ?Id = Id, - ?Domain = Domain, - ?Position = Position, - ?Zeroline = Zeroline, - ?Anchor = Anchor) - // Sets x-Axis of 2d and 3d- Charts - [] + [] [] - member this.withXAxisStyle(title, + member this.WithX_AxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -235,31 +202,18 @@ module GenericChartExtensions = ?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) this |> Chart.withX_Axis(xaxis,?Id=Id) - [] + /// Sets the range slider for the xAxis [] [] member this.WithX_AxisRangeSlider(rangeSlider:RangeSlider, [] ?Id) = - this.withXAxisRangeSlider(rangeSlider, ?Id = Id) - - /// Sets the range slider for the xAxis - [] - [] - member this.withXAxisRangeSlider(rangeSlider:RangeSlider, - [] ?Id) = let xaxis = Axis.LinearAxis.init(RangeSlider = rangeSlider) this |> Chart.withX_Axis(xaxis,?Id=Id) - [] - [] - [] - member this.WithY_Axis(yAxis:Axis.LinearAxis,[] ?Id : int) = - this.withYAxis(yAxis, ?Id = Id) - // Sets y-Axis of 2d and 3d- Charts - [] + [] [] - member this.withYAxis(yAxis:Axis.LinearAxis,[] ?Id) = + member this.WithY_Axis(yAxis:Axis.LinearAxis,[] ?Id) = let contains3d = this @@ -281,36 +235,10 @@ module GenericChartExtensions = |> Layout.style(Scene=Scene.init(yAxis=yAxis) ) GenericChart.addLayout layout this - [] + // Sets y-Axis of 3d- Charts [] [] member this.WithY_AxisStyle(title, - [] ?MinMax, - [] ?Showgrid, - [] ?Showline, - [] ?Side, - [] ?Overlaying, - [] ?Id, - [] ?Domain, - [] ?Position, - [] ?Zeroline, - [] ?Anchor) = - this.withYAxisStyle(title, - ?MinMax = MinMax, - ?Showgrid = Showgrid, - ?Showline = Showline, - ?Side = Side, - ?Overlaying = Overlaying, - ?Id = Id, - ?Domain = Domain, - ?Position = Position, - ?Zeroline = Zeroline, - ?Anchor = Anchor) - - // Sets y-Axis of 3d- Charts - [] - [] - member this.withYAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -327,41 +255,22 @@ module GenericChartExtensions = ?Showline=Showline,?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) this |> Chart.withY_Axis(yaxis,?Id=Id) - [] - [] - [] - member this.WithZ_Axis(zAxis:Axis.LinearAxis) = - this.withZAxis(zAxis) // Sets z-Axis of 3d- Charts - [] + [] [] - member this.withZAxis(zAxis:Axis.LinearAxis) = + member this.WithZ_Axis(zAxis:Axis.LinearAxis) = let layout = Layout() |> Layout.style(Scene=Scene.init(zAxis=zAxis)) GenericChart.addLayout layout this - [] - [] - [] - member this.WithZ_AxisStyle(title, - [] ?MinMax, - [] ?Showgrid, - [] ?Showline, - [] ?Domain, - [] ?Anchor) = - this.withZAxisStyle(title, - ?MinMax = MinMax, - ?Showgrid = Showgrid, - ?Showline = Showline, - ?Domain = Domain, - ?Anchor = Anchor) + // Sets z-Axis style with ... - [] + [] [] - member this.withZAxisStyle(title, + member this.WithZ_AxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, From c180198468bcc30b6cb20cf41d9e674929704776 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 10:40:29 +0300 Subject: [PATCH 03/39] Working on chart extesions --- src/Plotly.NET/ChartExtensions.fs | 128 +++++++++++++++--- src/Plotly.NET/GenericChartExtensions.fs | 8 +- src/Plotly.NET/Playground.fsx | 88 ++++++------ .../HtmlCodegen/ChartLayout.fs | 32 ++--- .../Plotly.NET.Tests/HtmlCodegen/Charts3D.fs | 12 +- .../HtmlCodegen/FinanceCharts.fs | 2 +- .../HtmlCodegen/SimpleTests.fs | 4 +- 7 files changed, 182 insertions(+), 92 deletions(-) diff --git a/src/Plotly.NET/ChartExtensions.fs b/src/Plotly.NET/ChartExtensions.fs index e94f45af2..d820a38c5 100644 --- a/src/Plotly.NET/ChartExtensions.fs +++ b/src/Plotly.NET/ChartExtensions.fs @@ -188,9 +188,14 @@ module ChartExtensions = // ############################################################ // ####################### Apply to layout - // Sets x-Axis of 2d and 3d- Charts + [] [] - static member withX_Axis(xAxis:Axis.LinearAxis,[] ?Id) = + static member withX_Axis(xAxis:Axis.LinearAxis,[] ?Id : int) = + Chart.withXAxis(xAxis, ?Id = Id) + + // Sets x-Axis of 2d and 3d- Charts + [] + static member withXAxis(xAxis:Axis.LinearAxis,[] ?Id) = (fun (ch:GenericChart) -> let contains3d = ch @@ -214,9 +219,35 @@ module ChartExtensions = ) - // Sets x-Axis of 2d and 3d- Charts + [] [] - static member withX_AxisStyle(title, + static member WithX_AxisStyle(title, + [] ?MinMax, + [] ?Showgrid, + [] ?Showline, + [] ?Side, + [] ?Overlaying, + [] ?Id, + [] ?Domain, + [] ?Position, + [] ?Zeroline, + [] ?Anchor) = + Chart.withXAxisStyle(title, + ?MinMax = MinMax, + ?Showgrid = Showgrid, + ?Showline = Showline, + ?Side = Side, + ?Overlaying = Overlaying, + ?Id = Id, + ?Domain = Domain, + ?Position = Position, + ?Zeroline = Zeroline, + ?Anchor = Anchor) + + + // Sets x-Axis of 2d and 3d- Charts + [] + static member withXAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -231,18 +262,30 @@ module ChartExtensions = let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None let xaxis = Axis.LinearAxis.init(Title=title,?Range=range,?Showgrid=Showgrid,?Showline=Showline, ?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) - Chart.withX_Axis(xaxis,?Id=Id) + Chart.withXAxis(xaxis,?Id=Id) - /// Sets the range slider for the xAxis + + [] [] static member withX_AxisRangeSlider(rangeSlider:RangeSlider, [] ?Id) = + Chart.withXAxisRangeSlider(rangeSlider, ?Id = Id) + + /// Sets the range slider for the xAxis + [] + static member withXAxisRangeSlider(rangeSlider:RangeSlider, + [] ?Id) = let xaxis = Axis.LinearAxis.init(RangeSlider = rangeSlider) - Chart.withX_Axis(xaxis,?Id=Id) + Chart.withXAxis(xaxis,?Id=Id) - // Sets y-Axis of 2d and 3d- Charts + [] [] - static member withY_Axis(yAxis:Axis.LinearAxis,[] ?Id) = + static member withY_Axis(yAxis:Axis.LinearAxis,[] ?Id : int) = + Chart.withYAxis(yAxis, ?Id = Id) + + // Sets y-Axis of 2d and 3d- Charts + [] + static member withYAxis(yAxis:Axis.LinearAxis,[] ?Id) = (fun (ch:GenericChart) -> let contains3d = ch @@ -266,9 +309,34 @@ module ChartExtensions = ) - // Sets y-Axis of 3d- Charts + [] [] - static member withY_AxisStyle(title, + static member WithY_AxisStyle(title, + [] ?MinMax, + [] ?Showgrid, + [] ?Showline, + [] ?Side, + [] ?Overlaying, + [] ?Id, + [] ?Domain, + [] ?Position, + [] ?Zeroline, + [] ?Anchor) = + Chart.withYAxisStyle(title, + ?MinMax = MinMax, + ?Showgrid = Showgrid, + ?Showline = Showline, + ?Side = Side, + ?Overlaying = Overlaying, + ?Id = Id, + ?Domain = Domain, + ?Position = Position, + ?Zeroline = Zeroline, + ?Anchor = Anchor) + + // Sets y-Axis of 3d- Charts + [] + static member withYAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -283,12 +351,17 @@ module ChartExtensions = let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None let yaxis = Axis.LinearAxis.init(Title=title,?Range=range,?Showgrid=Showgrid, ?Showline=Showline,?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) - Chart.withY_Axis(yaxis,?Id=Id) + Chart.withYAxis(yaxis,?Id=Id) - // Sets z-Axis of 3d- Charts + [] [] - static member withZ_Axis(zAxis:Axis.LinearAxis) = + static member withZ_Axis(xAxis:Axis.LinearAxis) = + Chart.withZAxis xAxis + + // Sets z-Axis of 3d- Charts + [] + static member withZAxis(zAxis:Axis.LinearAxis) = (fun (ch:GenericChart) -> let layout = Layout() @@ -297,9 +370,26 @@ module ChartExtensions = ) - // Sets z-Axis style with ... + + [] [] - static member withZ_AxisStyle(title, + static member WithZ_AxisStyle(title, + [] ?MinMax, + [] ?Showgrid, + [] ?Showline, + [] ?Domain, + [] ?Anchor) = + Chart.withZAxisStyle(title, + ?MinMax = MinMax, + ?Showgrid = Showgrid, + ?Showline = Showline, + ?Domain = Domain, + ?Anchor = Anchor) + + + // Sets z-Axis style with ... + [] + static member withZAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -308,7 +398,7 @@ module ChartExtensions = let range = if MinMax.IsSome then Some (StyleParam.Range.MinMax (MinMax.Value)) else None let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None let zaxis = Axis.LinearAxis.init(Title=title,?Range=range,?Showgrid=Showgrid,?Showline=Showline,?Anchor=Anchor,?Domain=domain) - Chart.withZ_Axis(zaxis) + Chart.withZAxis(zaxis) [] static member withColorBar(colorbar:Colorbar) = @@ -801,7 +891,7 @@ module ChartExtensions = gChart |> Chart.withAxisAnchor(xAnchor,yAnchor) // set adapted axis anchors - |> Chart.withX_Axis(xAxis,i+1) // set previous axis with adapted id (one individual axis for each subplot, wether or not they will be used later) + |> Chart.withXAxis(xAxis,i+1) // set previous axis with adapted id (one individual axis for each subplot, wether or not they will be used later) |> Chart.withY_Axis(yAxis,i+1) // set previous axis with adapted id (one individual axis for each subplot, wether or not they will be used later) |> GenericChart.mapLayout (fun l -> if i > 0 then @@ -1052,7 +1142,7 @@ module ChartExtensions = ch |> GenericChart.setLayout layout |> Chart.withAxisAnchor(X=index,Y=index) - |> Chart.withX_Axis(xaxis,index) + |> Chart.withXAxis(xaxis,index) |> Chart.withY_Axis(yaxis,index) ) diff --git a/src/Plotly.NET/GenericChartExtensions.fs b/src/Plotly.NET/GenericChartExtensions.fs index c20477223..91651c020 100644 --- a/src/Plotly.NET/GenericChartExtensions.fs +++ b/src/Plotly.NET/GenericChartExtensions.fs @@ -200,7 +200,7 @@ module GenericChartExtensions = let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None let xaxis = Axis.LinearAxis.init(Title=title,?Range=range,?Showgrid=Showgrid,?Showline=Showline, ?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) - this |> Chart.withX_Axis(xaxis,?Id=Id) + this |> Chart.withXAxis(xaxis,?Id=Id) /// Sets the range slider for the xAxis [] @@ -208,7 +208,7 @@ module GenericChartExtensions = member this.WithX_AxisRangeSlider(rangeSlider:RangeSlider, [] ?Id) = let xaxis = Axis.LinearAxis.init(RangeSlider = rangeSlider) - this |> Chart.withX_Axis(xaxis,?Id=Id) + this |> Chart.withXAxis(xaxis,?Id=Id) // Sets y-Axis of 2d and 3d- Charts [] @@ -253,7 +253,7 @@ module GenericChartExtensions = let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None let yaxis = Axis.LinearAxis.init(Title=title,?Range=range,?Showgrid=Showgrid, ?Showline=Showline,?Anchor=Anchor,?Side=Side,?Domain=domain,?Overlaying=Overlaying,?Position=Position,?Zeroline=Zeroline) - this |> Chart.withY_Axis(yaxis,?Id=Id) + this |> Chart.withYAxis(yaxis,?Id=Id) // Sets z-Axis of 3d- Charts @@ -279,7 +279,7 @@ module GenericChartExtensions = let range = if MinMax.IsSome then Some (StyleParam.Range.MinMax (MinMax.Value)) else None let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None let zaxis = Axis.LinearAxis.init(Title=title,?Range=range,?Showgrid=Showgrid,?Showline=Showline,?Anchor=Anchor,?Domain=domain) - this |> Chart.withZ_Axis(zaxis) + this |> Chart.withZAxis(zaxis) [] [] diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index 31735c84b..ef1d6ccfc 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -68,42 +68,42 @@ open FSharpAux [ Chart.Point([1,2;1,3]) - |> Chart.withY_AxisStyle("This title must") + |> Chart.withYAxisStyle("This title must") Chart.Line([1,2;1,3]) - |> Chart.withY_AxisStyle("be set on the",Zeroline=false) + |> Chart.withYAxisStyle("be set on the",Zeroline=false) Chart.Spline([1,2;1,3]) - |> Chart.withY_AxisStyle("respective subplots",Zeroline=false) + |> Chart.withYAxisStyle("respective subplots",Zeroline=false) ] |> Chart.SingleStack(Pattern= StyleParam.LayoutGridPattern.Coupled) //move xAxis to bottom and increase spacing between plots by using the withLayoutGridStyle function |> Chart.withLayoutGridStyle(YGap= 0.1) |> Chart.withTitle("Hi i am the new SingleStackChart") -|> Chart.withX_AxisStyle("im the shared xAxis") +|> Chart.withXAxisStyle("im the shared xAxis") |> Chart.show [ [ Chart.Point([1,2],Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Point([1,2],Name="1,2") - |> Chart.withX_AxisStyle "x2" - |> Chart.withY_AxisStyle "y2" + |> Chart.withXAxisStyle "x2" + |> Chart.withYAxisStyle "y2" ] [ Chart.Point([1,2],Name="2,1") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" ] [ Chart.Point([1,2],Name="3,1") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" Chart.Point([1,2],Name="3,2") - |> Chart.withX_AxisStyle "x5" - |> Chart.withY_AxisStyle "y5" + |> Chart.withXAxisStyle "x5" + |> Chart.withYAxisStyle "y5" ] ] |> Chart.Grid() @@ -111,41 +111,41 @@ open FSharpAux [ Chart.Point([1,2],Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Point([1,2],Name="1,2") - |> Chart.withX_AxisStyle "x2" - |> Chart.withY_AxisStyle "y2" + |> Chart.withXAxisStyle "x2" + |> Chart.withYAxisStyle "y2" Chart.Point([1,2],Name="2,2") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" Chart.Point([1,2],Name="3,2") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" Chart.Point([1,2],Name="1,1") - |> Chart.withX_AxisStyle "x5" - |> Chart.withY_AxisStyle "y5" + |> Chart.withXAxisStyle "x5" + |> Chart.withYAxisStyle "y5" Chart.Point([1,2],Name="1,2") - |> Chart.withX_AxisStyle "x6" - |> Chart.withY_AxisStyle "y6" + |> Chart.withXAxisStyle "x6" + |> Chart.withYAxisStyle "y6" Chart.Point([1,2],Name="2,2") - |> Chart.withX_AxisStyle "x7" - |> Chart.withY_AxisStyle "y7" + |> Chart.withXAxisStyle "x7" + |> Chart.withYAxisStyle "y7" Chart.Point([1,2],Name="3,2") - |> Chart.withX_AxisStyle "x8" - |> Chart.withY_AxisStyle "y8" + |> Chart.withXAxisStyle "x8" + |> Chart.withYAxisStyle "y8" Chart.Point([1,2],Name="1,1") - |> Chart.withX_AxisStyle "x9" - |> Chart.withY_AxisStyle "y9" + |> Chart.withXAxisStyle "x9" + |> Chart.withYAxisStyle "y9" Chart.Point([1,2],Name="1,2") - |> Chart.withX_AxisStyle "x10" - |> Chart.withY_AxisStyle "y10" + |> Chart.withXAxisStyle "x10" + |> Chart.withYAxisStyle "y10" Chart.Point([1,2],Name="2,2") - |> Chart.withX_AxisStyle "x11" - |> Chart.withY_AxisStyle "y11" + |> Chart.withXAxisStyle "x11" + |> Chart.withYAxisStyle "y11" Chart.Point([1,2],Name="3,2") - |> Chart.withX_AxisStyle "x12" - |> Chart.withY_AxisStyle "y12" + |> Chart.withXAxisStyle "x12" + |> Chart.withYAxisStyle "y12" ] |> Chart.Grid(6,2,Pattern=StyleParam.LayoutGridPattern.Coupled) |> Chart.withSize (1000., 2000.) @@ -252,7 +252,7 @@ Chart.Column( "third", 1 ] ) -|> Chart.withX_Axis( +|> Chart.withXAxis( Axis.LinearAxis.initCategorical( StyleParam.CategoryOrder.Array, CategoryArray = ["first"; "second"; "third"] @@ -376,7 +376,7 @@ Chart.Range( LowerName = "Lower", UpperName = "Upper", Labels = []) -|> Chart.withY_Axis (yAxis) +|> Chart.withYAxis (yAxis) |> GenericChart.mapiTrace (fun i t -> match i with | 0 -> t |> Trace.TraceStyle.TextLabel ["upperOne";"upperTwo"] @@ -747,16 +747,16 @@ generateDomainRanges 8 1 [ - Chart.Point([(0,1)]) |> Chart.withY_AxisStyle("This title") + Chart.Point([(0,1)]) |> Chart.withYAxisStyle("This title") Chart.Point([(0,1)]) - |> Chart.withY_AxisStyle("Must be set",Zeroline=false) + |> Chart.withYAxisStyle("Must be set",Zeroline=false) Chart.Point([(0,1)]) - |> Chart.withY_AxisStyle("on the respective charts",Zeroline=false) + |> Chart.withYAxisStyle("on the respective charts",Zeroline=false) ] |> Chart.SingleStack |> Chart.withLayoutGridStyle(XSide=StyleParam.LayoutGridXSide.Bottom) |> Chart.withTitle("Hi i am the new SingleStackChart") -|> Chart.withX_AxisStyle("im the shared xAxis") +|> Chart.withXAxisStyle("im the shared xAxis") |> Chart.show [ diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs index cb08be51c..a283d6124 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs @@ -10,8 +10,8 @@ let axisStylingChart = let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.] let plot1 = Chart.Point(x,y) - |> Chart.withX_AxisStyle ("X axis title quack quack", MinMax = (-1.,10.)) - |> Chart.withY_AxisStyle ("Y axis title boo foo", MinMax = (-1.,10.)) + |> Chart.withXAxisStyle ("X axis title quack quack", MinMax = (-1.,10.)) + |> Chart.withYAxisStyle ("Y axis title boo foo", MinMax = (-1.,10.)) plot1 @@ -52,12 +52,12 @@ let multipleAxesChart = anchoredAt2 ] |> Chart.Combine - |> Chart.withY_AxisStyle( + |> Chart.withYAxisStyle( "axis 1", Side=StyleParam.Side.Left, Id=1 ) - |> Chart.withY_AxisStyle( + |> Chart.withYAxisStyle( "axis2", Side=StyleParam.Side.Right, Id=2, @@ -122,17 +122,17 @@ let subPlotChart = let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.] [ Chart.Point(x, y, Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Line(x, y, Name="1,2") - |> Chart.withX_AxisStyle "x2" - |> Chart.withY_AxisStyle "y2" + |> Chart.withXAxisStyle "x2" + |> Chart.withYAxisStyle "y2" Chart.Spline(x, y, Name="2,1") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" Chart.Point(x, y, Name="2,2") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" ] |> Chart.Grid(2, 2) @@ -142,19 +142,19 @@ let singleStackChart = let y = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.] [ Chart.Point(x,y) - |> Chart.withY_AxisStyle("This title must") + |> Chart.withYAxisStyle("This title must") Chart.Line(x,y) - |> Chart.withY_AxisStyle("be set on the",Zeroline=false) + |> Chart.withYAxisStyle("be set on the",Zeroline=false) Chart.Spline(x,y) - |> Chart.withY_AxisStyle("respective subplots",Zeroline=false) + |> Chart.withYAxisStyle("respective subplots",Zeroline=false) ] |> Chart.SingleStack(Pattern = StyleParam.LayoutGridPattern.Coupled) //move xAxis to bottom and increase spacing between plots by using the withLayoutGridStyle function |> Chart.withLayoutGridStyle(XSide=StyleParam.LayoutGridXSide.Bottom,YGap= 0.1) |> Chart.withTitle("Hi i am the new SingleStackChart") - |> Chart.withX_AxisStyle("im the shared xAxis") + |> Chart.withXAxisStyle("im the shared xAxis") [] diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs b/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs index beadfad94..12762f7b4 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs @@ -12,9 +12,9 @@ let scatterChart = let z = [19; 26; 55;] Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers) - |> Chart.withX_AxisStyle("my x-axis") - |> Chart.withY_AxisStyle("my y-axis") - |> Chart.withZ_AxisStyle("my z-axis") + |> Chart.withXAxisStyle("my x-axis") + |> Chart.withYAxisStyle("my y-axis") + |> Chart.withZAxisStyle("my z-axis") |> Chart.withSize(800.,800.) [] @@ -43,9 +43,9 @@ let lineChart = |> List.unzip3 Chart.Scatter3d(x, y, z, StyleParam.Mode.Lines_Markers) - |> Chart.withX_AxisStyle("x-axis") - |> Chart.withY_AxisStyle("y-axis") - |> Chart.withZ_AxisStyle("z-axis") + |> Chart.withXAxisStyle("x-axis") + |> Chart.withYAxisStyle("y-axis") + |> Chart.withZAxisStyle("z-axis") |> Chart.withSize(800., 800.) diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/FinanceCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/FinanceCharts.fs index 0693fea38..22cbff569 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/FinanceCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/FinanceCharts.fs @@ -27,7 +27,7 @@ let candles1Chart = Chart.Candlestick candles let candles2Chart = let rangeslider = RangeSlider.init(Visible=false) Chart.Candlestick candles - |> Chart.withX_AxisRangeSlider rangeslider + |> Chart.withXAxisRangeSlider rangeslider [] let ``Candlestick charts`` = diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/SimpleTests.fs b/tests/Plotly.NET.Tests/HtmlCodegen/SimpleTests.fs index 9ab18ca11..8689cfda2 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/SimpleTests.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/SimpleTests.fs @@ -11,8 +11,8 @@ let simpleChart = let yData = [0. .. 10.] Chart.Point(xData, yData) |> Chart.withTitle "Hello world!" - |> Chart.withX_AxisStyle ("xAxis", Showgrid=false) - |> Chart.withY_AxisStyle ("yAxis", Showgrid=false) + |> Chart.withXAxisStyle ("xAxis", Showgrid=false) + |> Chart.withYAxisStyle ("yAxis", Showgrid=false) [] From acf24924bc1401c7db5b640d78b8a5b180208654 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 10:42:51 +0300 Subject: [PATCH 04/39] Chart extension case unification finished --- src/Plotly.NET/ChartExtensions.fs | 6 +++--- src/Plotly.NET/Playground.fsx | 8 ++++---- tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs | 6 +++--- tests/Plotly.NET.Tests/HtmlCodegen/DistributionCharts.fs | 6 +++--- tests/Plotly.NET.Tests/HtmlCodegen/GeoMapCharts.fs | 2 +- tests/Plotly.NET.Tests/HtmlCodegen/MapboxMapCharts.fs | 2 +- tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs | 4 ++-- tests/Plotly.NET.Tests/HtmlCodegen/SimpleCharts.fs | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Plotly.NET/ChartExtensions.fs b/src/Plotly.NET/ChartExtensions.fs index d820a38c5..cc4c5f7ae 100644 --- a/src/Plotly.NET/ChartExtensions.fs +++ b/src/Plotly.NET/ChartExtensions.fs @@ -818,7 +818,7 @@ module ChartExtensions = // ####################### /// Create a combined chart with the given charts merged [] - static member Combine(gCharts:seq) = + static member combine(gCharts:seq) = GenericChart.combine gCharts /// @@ -901,7 +901,7 @@ module ChartExtensions = l ) ) - |> Chart.Combine + |> Chart.combine |> Chart.withLayoutGrid ( LayoutGrid.init( Rows = nRows, @@ -1146,7 +1146,7 @@ module ChartExtensions = |> Chart.withY_Axis(yaxis,index) ) - |> Chart.Combine + |> Chart.combine ) // ############################################################ diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index ef1d6ccfc..b4ff27eb0 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -415,7 +415,7 @@ Chart.Point([1.,2.]) Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") Chart.Line([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") ] -|> Chart.Combine +|> Chart.combine |> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" |> Chart.withMathTex(true) |> Chart.show @@ -446,7 +446,7 @@ let myLegend = ] |> List.map Chart.Line -|> Chart.Combine +|> Chart.combine |> Chart.withLegend(myLegend) |> Chart.show @@ -618,7 +618,7 @@ let manyLines = Chart.Scatter(x = [1;2;3], y = [2;3;4],mode=StyleParam.Mode.Markers, StackGroup = "meem", Orientation= StyleParam.Orientation.Vertical, GroupNorm = StyleParam.GroupNorm.Percent ) Chart.Scatter(x = [1;2;3], y = [4;3;4],mode=StyleParam.Mode.Markers, StackGroup = "meem", Orientation= StyleParam.Orientation.Vertical, GroupNorm = StyleParam.GroupNorm.Percent ) ] -|> Chart.Combine +|> Chart.combine |> Chart.show //Just try this, its amazing how much faster WebGL loads and zooms @@ -630,7 +630,7 @@ Chart.Point(manyPoints) manyLines |> List.map (fun l -> Chart.Line(l,UseWebGL=true)) -|> Chart.Combine +|> Chart.combine |> Chart.show Chart.Line(manyPoints,UseWebGL=true) diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs index a283d6124..0ff3969d5 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs @@ -51,7 +51,7 @@ let multipleAxesChart = anchoredAt1 anchoredAt2 ] - |> Chart.Combine + |> Chart.combine |> Chart.withYAxisStyle( "axis 1", Side=StyleParam.Side.Left, @@ -114,7 +114,7 @@ let combinedChart = Chart.Line(x, y, Name="first") Chart.Line(y, x, Name="second") ] - |> Chart.Combine + |> Chart.combine let subPlotChart = @@ -242,7 +242,7 @@ let mathtexChart = Chart.Point([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") Chart.Point([(2.,4.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") ] - |> Chart.Combine + |> Chart.combine |> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" // include mathtex tags in . pass true to append these scripts, false to ONLY include MathTeX. |> Chart.withMathTex(true) diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/DistributionCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/DistributionCharts.fs index 72ca69bbd..59a9a3807 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/DistributionCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/DistributionCharts.fs @@ -47,7 +47,7 @@ let box3Chart = Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All); Chart.BoxPlot("y'",y',Name="bin2",Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All); ] - |> Chart.Combine + |> Chart.combine [] let ``Box charts`` = @@ -102,7 +102,7 @@ let violin3Chart = Chart.Violin ("y" ,y,Name="bin1",Jitter=0.1,Points=StyleParam.Jitterpoints.All); Chart.Violin ("y'",y',Name="bin2",Jitter=0.1,Points=StyleParam.Jitterpoints.All); ] - |> Chart.Combine + |> Chart.combine [] let ``Violin charts`` = @@ -193,7 +193,7 @@ let histogramContourChart = Chart.Histogram2dContour (x,y,Line=Line.init(Width=0.)) Chart.Point(x,y,Opacity=0.3) ] - |> Chart.Combine + |> Chart.combine let histogram2dChart = diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/GeoMapCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/GeoMapCharts.fs index 664a68c03..7fb3de42d 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/GeoMapCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/GeoMapCharts.fs @@ -134,7 +134,7 @@ let flightsMapChart = Color = "red" ) ) - |> Chart.Combine + |> Chart.combine |> Chart.withLegend(false) |> Chart.withMapStyle( Scope=StyleParam.GeoScope.NorthAmerica, diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/MapboxMapCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/MapboxMapCharts.fs index 1ef36acdb..23efbabb5 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/MapboxMapCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/MapboxMapCharts.fs @@ -87,7 +87,7 @@ let flightsChart = Color = "red" ) ) - |> Chart.Combine + |> Chart.combine |> Chart.withLegend(false) |> Chart.withMapbox( Mapbox.init( diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs index e58bd0500..cbcc882cb 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/PolarCharts.fs @@ -17,7 +17,7 @@ let polar1Chart = Chart.Polar(r2,t,StyleParam.Mode.Markers,Name="2") Chart.Polar(r3,t,StyleParam.Mode.Markers,Name="3") ] - |> Chart.Combine + |> Chart.combine [] let ``Polar charts`` = @@ -45,7 +45,7 @@ let windrose1Chart = Chart.WindRose (r'' ,t,Name="5-8 m/s") Chart.WindRose (r''',t,Name="< 5 m/s") ] - |> Chart.Combine + |> Chart.combine [] let ``Windrose charts`` = diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/SimpleCharts.fs b/tests/Plotly.NET.Tests/HtmlCodegen/SimpleCharts.fs index c6581c0da..1e74ce9b6 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/SimpleCharts.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/SimpleCharts.fs @@ -87,7 +87,7 @@ let stackedBarChart = Chart.StackedBar(keys,values,Name="old"); Chart.StackedBar(keys,[8; 21; 13;],Name="new") ] - |> Chart.Combine + |> Chart.combine let stackedColumnChart = let values = [20; 14; 23;] @@ -96,7 +96,7 @@ let stackedColumnChart = Chart.StackedColumn(keys,values,Name="old"); Chart.StackedColumn(keys,[8; 21; 13;],Name="new") ] - |> Chart.Combine + |> Chart.combine [] let ``Bar and column charts`` = @@ -151,7 +151,7 @@ let stackedAreaChart = Chart.StackedArea(x,y) Chart.StackedArea(x,y |> Seq.rev) ] - |> Chart.Combine + |> Chart.combine [] let ``Area charts`` = From 1d90f4a9a892f36b2a99f6bfff986bca52249fcd Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 10:54:12 +0300 Subject: [PATCH 05/39] Docs library added --- Plotly.NET.sln | 13 ++++++- docs/DocsLibrary/DocsLibrary.fsproj | 58 +++++++++++++++++++++++++++++ docs/DocsLibrary/Library.fs | 5 +++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 docs/DocsLibrary/DocsLibrary.fsproj create mode 100644 docs/DocsLibrary/Library.fs diff --git a/Plotly.NET.sln b/Plotly.NET.sln index c61a4a92e..eda3dd108 100644 --- a/Plotly.NET.sln +++ b/Plotly.NET.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29709.97 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31521.260 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}" ProjectSection(SolutionItems) = preProject @@ -115,6 +115,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{EAE25A1F src\Plotly.NET\Playground.fsx = src\Plotly.NET\Playground.fsx EndProjectSection EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DocsLibrary", "docs\DocsLibrary\DocsLibrary.fsproj", "{124331A4-DD56-40FA-94E6-79980ABE86EE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -146,6 +148,12 @@ 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 + {124331A4-DD56-40FA-94E6-79980ABE86EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {124331A4-DD56-40FA-94E6-79980ABE86EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {124331A4-DD56-40FA-94E6-79980ABE86EE}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU + {124331A4-DD56-40FA-94E6-79980ABE86EE}.Dotnet|Any CPU.Build.0 = Debug|Any CPU + {124331A4-DD56-40FA-94E6-79980ABE86EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {124331A4-DD56-40FA-94E6-79980ABE86EE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -158,6 +166,7 @@ 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} + {124331A4-DD56-40FA-94E6-79980ABE86EE} = {7B09CC0A-F1E1-4094-9DE4-B047581E01F0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7177F1E1-341C-48AB-9864-6B525FFF7633} diff --git a/docs/DocsLibrary/DocsLibrary.fsproj b/docs/DocsLibrary/DocsLibrary.fsproj new file mode 100644 index 000000000..9318df449 --- /dev/null +++ b/docs/DocsLibrary/DocsLibrary.fsproj @@ -0,0 +1,58 @@ + + + + net6.0 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/DocsLibrary/Library.fs b/docs/DocsLibrary/Library.fs new file mode 100644 index 000000000..3254ea87a --- /dev/null +++ b/docs/DocsLibrary/Library.fs @@ -0,0 +1,5 @@ +namespace DocsLibrary + +module Say = + let hello name = + printfn "Hello %s" name From 739ab30dcdaedfbc2ba9d9d548db1a045382d674 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 18:56:19 +0300 Subject: [PATCH 06/39] Verification --- build.fsx | 22 +++++++++++ docs/0_0_basics.fsx | 2 +- docs/DocsLibrary/DocsLibrary.fsproj | 58 ----------------------------- docs/DocsLibrary/Library.fs | 5 --- src/Plotly.NET/ChartExtensions.fs | 6 +-- src/Plotly.NET/Playground.fsx | 39 ++++++++++++------- 6 files changed, 51 insertions(+), 81 deletions(-) delete mode 100644 docs/DocsLibrary/DocsLibrary.fsproj delete mode 100644 docs/DocsLibrary/Library.fs diff --git a/build.fsx b/build.fsx index d5c920c7a..dd9ed57db 100644 --- a/build.fsx +++ b/build.fsx @@ -15,6 +15,8 @@ nuget Fake.Api.Github nuget Fake.DotNet.Testing.Expecto nuget Fake.Tools.Git //" +#r "FSharp.Compiler.Service.dll" + #if !FAKE #load "./.fake/build.fsx/intellisense.fsx" #r "netstandard" // Temp fix for https://github.com/dotnet/fsharp/issues/5216 @@ -168,6 +170,26 @@ module TestTasks = ) testProject } + +module VerificationTasks = + open FSharp.Compiler.Diagnostics + + let verifyDocs = BuildTask.create "VerifyDocs" [] { + let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) + + for target in targets do + let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + + checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) + |> Async.RunSynchronously + |> (fun (diags, _) -> + for diag in diags do + match diag.Severity with + | FSharpDiagnosticSeverity.Error -> raise (System.Exception(diag.ToString())) + | _ -> () + ) + } + /// Package creation module PackageTasks = diff --git a/docs/0_0_basics.fsx b/docs/0_0_basics.fsx index d5cf251db..39b86d69c 100644 --- a/docs/0_0_basics.fsx +++ b/docs/0_0_basics.fsx @@ -75,7 +75,7 @@ myTrace?x <- [0;1;2] // set the x property (the x dimension of the data) myTrace?y <- [0;1;2] // set the y property (the y dimension of the data) GenericChart.ofTraceObject myTrace // create a generic chart (layout and config are empty objects) -|> Chart.Show +|> Chart.show (** lets have a look at the trace object that will be created. The relevant section of the html generated with Chart.Show is the following: diff --git a/docs/DocsLibrary/DocsLibrary.fsproj b/docs/DocsLibrary/DocsLibrary.fsproj deleted file mode 100644 index 9318df449..000000000 --- a/docs/DocsLibrary/DocsLibrary.fsproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - net6.0 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/DocsLibrary/Library.fs b/docs/DocsLibrary/Library.fs deleted file mode 100644 index 3254ea87a..000000000 --- a/docs/DocsLibrary/Library.fs +++ /dev/null @@ -1,5 +0,0 @@ -namespace DocsLibrary - -module Say = - let hello name = - printfn "Hello %s" name diff --git a/src/Plotly.NET/ChartExtensions.fs b/src/Plotly.NET/ChartExtensions.fs index cc4c5f7ae..f9c6e5724 100644 --- a/src/Plotly.NET/ChartExtensions.fs +++ b/src/Plotly.NET/ChartExtensions.fs @@ -221,7 +221,7 @@ module ChartExtensions = [] [] - static member WithX_AxisStyle(title, + static member withX_AxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -311,7 +311,7 @@ module ChartExtensions = [] [] - static member WithY_AxisStyle(title, + static member withY_AxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -373,7 +373,7 @@ module ChartExtensions = [] [] - static member WithZ_AxisStyle(title, + static member withZ_AxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index b4ff27eb0..46fb09aca 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -1,4 +1,5 @@ open Plotly.NET.StyleParam +open FSharp.Compiler.Diagnostics #r "nuget: FSharp.Data" @@ -745,20 +746,6 @@ generateDomainRanges 8 1 - -[ - Chart.Point([(0,1)]) |> Chart.withYAxisStyle("This title") - Chart.Point([(0,1)]) - |> Chart.withYAxisStyle("Must be set",Zeroline=false) - Chart.Point([(0,1)]) - |> Chart.withYAxisStyle("on the respective charts",Zeroline=false) -] -|> Chart.SingleStack -|> Chart.withLayoutGridStyle(XSide=StyleParam.LayoutGridXSide.Bottom) -|> Chart.withTitle("Hi i am the new SingleStackChart") -|> Chart.withXAxisStyle("im the shared xAxis") -|> Chart.show - [ [1;2] [3;4] @@ -802,3 +789,27 @@ let values,labels = |> Seq.unzip let cols =[|"black";"blue"|] + + +#r "FSharp.Compiler.Service.dll" +open System.IO +open FSharp.Compiler.CodeAnalysis + +let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + +checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; "Playground.fsx" |] ) +// checker.Compile ( [| "fsc.exe"; "-o"; @"D:/main/vs_prj/plotly.NETFork/Plotly.NET/docs/aaaaaaaaaaa.exe"; "-a"; "Playground.fsx" |] ) +|> Async.RunSynchronously +|> (fun (diags, _) -> + diags + |> Seq.tryPick (fun d -> + match d.Severity with + | FSharpDiagnosticSeverity.Error -> Some(d) + | _ -> None + ) +) +|> (fun c -> + match c with + | Some d -> d.ToString() + | None -> "Ok" +) \ No newline at end of file From a66f5ab31ab7eab6c5e74c350cc3c7396a303bf2 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 18:56:30 +0300 Subject: [PATCH 07/39] Project removed --- Plotly.NET.sln | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Plotly.NET.sln b/Plotly.NET.sln index eda3dd108..9d9883551 100644 --- a/Plotly.NET.sln +++ b/Plotly.NET.sln @@ -115,8 +115,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{EAE25A1F src\Plotly.NET\Playground.fsx = src\Plotly.NET\Playground.fsx EndProjectSection EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DocsLibrary", "docs\DocsLibrary\DocsLibrary.fsproj", "{124331A4-DD56-40FA-94E6-79980ABE86EE}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -148,12 +146,6 @@ 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 - {124331A4-DD56-40FA-94E6-79980ABE86EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {124331A4-DD56-40FA-94E6-79980ABE86EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {124331A4-DD56-40FA-94E6-79980ABE86EE}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU - {124331A4-DD56-40FA-94E6-79980ABE86EE}.Dotnet|Any CPU.Build.0 = Debug|Any CPU - {124331A4-DD56-40FA-94E6-79980ABE86EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {124331A4-DD56-40FA-94E6-79980ABE86EE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -166,7 +158,6 @@ 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} - {124331A4-DD56-40FA-94E6-79980ABE86EE} = {7B09CC0A-F1E1-4094-9DE4-B047581E01F0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7177F1E1-341C-48AB-9864-6B525FFF7633} From 5deef60278fc7fbd6a66fda0e0dea8b60434094f Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 18:59:53 +0300 Subject: [PATCH 08/39] Create verify-docs.yml --- .github/workflows/verify-docs.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/verify-docs.yml diff --git a/.github/workflows/verify-docs.yml b/.github/workflows/verify-docs.yml new file mode 100644 index 000000000..1c91e94f3 --- /dev/null +++ b/.github/workflows/verify-docs.yml @@ -0,0 +1,25 @@ +name: Verify docs + +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + +jobs: + build-and-test-linux: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup .NET 5 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.302' + + - name: Run verification script + run: | + dotnet tool restore + dotnet fake build -t verifydocs From 26be7b5230c0ec8e728a30fc0133b89164eb0f5e Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 19:37:00 +0300 Subject: [PATCH 09/39] Update build.fsx --- build.fsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.fsx b/build.fsx index dd9ed57db..deb790d36 100644 --- a/build.fsx +++ b/build.fsx @@ -15,7 +15,7 @@ nuget Fake.Api.Github nuget Fake.DotNet.Testing.Expecto nuget Fake.Tools.Git //" -#r "FSharp.Compiler.Service.dll" +#r "nuget:FSharp.Compiler.Service" #if !FAKE #load "./.fake/build.fsx/intellisense.fsx" @@ -426,4 +426,4 @@ let _preReleaseNoDocs = [setPrereleaseTag; clean; build; copyBinaries; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease] // run copyBinaries by default -BuildTask.runOrDefault copyBinaries \ No newline at end of file +BuildTask.runOrDefault copyBinaries From 8bd761d3634db5fc2de5f1588bcbf97047eae95e Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 19:39:47 +0300 Subject: [PATCH 10/39] Update build.fsx --- build.fsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.fsx b/build.fsx index deb790d36..09d701fb8 100644 --- a/build.fsx +++ b/build.fsx @@ -1,4 +1,5 @@ #r "paket: +nuget FSharp.Compiler.Service nuget BlackFox.Fake.BuildTask nuget Fake.Core.Target nuget Fake.Core.Process @@ -15,8 +16,6 @@ nuget Fake.Api.Github nuget Fake.DotNet.Testing.Expecto nuget Fake.Tools.Git //" -#r "nuget:FSharp.Compiler.Service" - #if !FAKE #load "./.fake/build.fsx/intellisense.fsx" #r "netstandard" // Temp fix for https://github.com/dotnet/fsharp/issues/5216 From 445af468b60d5fdda0944baf86a7223f00e4aa36 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 19:42:57 +0300 Subject: [PATCH 11/39] Update build.fsx --- build.fsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.fsx b/build.fsx index 09d701fb8..a917bce1b 100644 --- a/build.fsx +++ b/build.fsx @@ -1,5 +1,4 @@ #r "paket: -nuget FSharp.Compiler.Service nuget BlackFox.Fake.BuildTask nuget Fake.Core.Target nuget Fake.Core.Process @@ -171,9 +170,10 @@ module TestTasks = module VerificationTasks = - open FSharp.Compiler.Diagnostics + // open FSharp.Compiler.Diagnostics let verifyDocs = BuildTask.create "VerifyDocs" [] { + (* let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) for target in targets do @@ -186,7 +186,8 @@ module VerificationTasks = match diag.Severity with | FSharpDiagnosticSeverity.Error -> raise (System.Exception(diag.ToString())) | _ -> () - ) + )*) + () } /// Package creation From d91601418bc448a07546190347a84fa02a386aaa Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 19:45:03 +0300 Subject: [PATCH 12/39] Update build.fsx --- build.fsx | 1 + 1 file changed, 1 insertion(+) diff --git a/build.fsx b/build.fsx index a917bce1b..a3fbe7370 100644 --- a/build.fsx +++ b/build.fsx @@ -1,4 +1,5 @@ #r "paket: +nuget FSharp.Compiler.Service nuget BlackFox.Fake.BuildTask nuget Fake.Core.Target nuget Fake.Core.Process From 364b8cde8717b85c8cf60f13f3b83e45557cd6b4 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 20:31:22 +0300 Subject: [PATCH 13/39] Update build.fsx --- build.fsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.fsx b/build.fsx index a3fbe7370..99e8a001d 100644 --- a/build.fsx +++ b/build.fsx @@ -171,10 +171,10 @@ module TestTasks = module VerificationTasks = - // open FSharp.Compiler.Diagnostics + open FSharp.Compiler.Diagnostics let verifyDocs = BuildTask.create "VerifyDocs" [] { - (* + let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) for target in targets do @@ -187,7 +187,7 @@ module VerificationTasks = match diag.Severity with | FSharpDiagnosticSeverity.Error -> raise (System.Exception(diag.ToString())) | _ -> () - )*) + ) () } From 7d79490098e111df623e19db322b1db1100e4f80 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 20:36:06 +0300 Subject: [PATCH 14/39] Update build.fsx --- build.fsx | 1 + 1 file changed, 1 insertion(+) diff --git a/build.fsx b/build.fsx index 99e8a001d..e9887c879 100644 --- a/build.fsx +++ b/build.fsx @@ -1,4 +1,5 @@ #r "paket: +nuget System.Runtime nuget FSharp.Compiler.Service nuget BlackFox.Fake.BuildTask nuget Fake.Core.Target From 87cb0c76ef8c7ddef79404faf45c948e31d61b63 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 22:48:17 +0300 Subject: [PATCH 15/39] Update build.fsx --- build.fsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.fsx b/build.fsx index e9887c879..98f42ebb4 100644 --- a/build.fsx +++ b/build.fsx @@ -1,6 +1,4 @@ #r "paket: -nuget System.Runtime -nuget FSharp.Compiler.Service nuget BlackFox.Fake.BuildTask nuget Fake.Core.Target nuget Fake.Core.Process From 8e97d0a51d60d8c9a8b6077057b7db5792c4b481 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 22:51:34 +0300 Subject: [PATCH 16/39] Update build.fsx --- build.fsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.fsx b/build.fsx index 98f42ebb4..23c88a9b8 100644 --- a/build.fsx +++ b/build.fsx @@ -15,6 +15,9 @@ nuget Fake.Api.Github nuget Fake.DotNet.Testing.Expecto nuget Fake.Tools.Git //" +#r "System.Runtime.Remoting.dll" +#r "FSharp.Compiler.Service.dll" + #if !FAKE #load "./.fake/build.fsx/intellisense.fsx" #r "netstandard" // Temp fix for https://github.com/dotnet/fsharp/issues/5216 From 305fa20b2a96f0684dc4db5212316d8e67d7c364 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 22:54:35 +0300 Subject: [PATCH 17/39] Update verify-docs.yml --- .github/workflows/verify-docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-docs.yml b/.github/workflows/verify-docs.yml index 1c91e94f3..3d76b2418 100644 --- a/.github/workflows/verify-docs.yml +++ b/.github/workflows/verify-docs.yml @@ -7,9 +7,9 @@ on: branches: [ dev ] jobs: - build-and-test-linux: + verify-docs: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v2 From 0410c0bf674f9a9d0f05873a831441f9ad0aff93 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Mon, 9 Aug 2021 22:58:11 +0300 Subject: [PATCH 18/39] Update build.fsx --- build.fsx | 1 - 1 file changed, 1 deletion(-) diff --git a/build.fsx b/build.fsx index 23c88a9b8..b2962f3dc 100644 --- a/build.fsx +++ b/build.fsx @@ -15,7 +15,6 @@ nuget Fake.Api.Github nuget Fake.DotNet.Testing.Expecto nuget Fake.Tools.Git //" -#r "System.Runtime.Remoting.dll" #r "FSharp.Compiler.Service.dll" #if !FAKE From f81aa26ab540c98e6df0ffafc9ac9cce5f268fd9 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 06:56:49 +0300 Subject: [PATCH 19/39] Update build.fsx --- build.fsx | 1 + 1 file changed, 1 insertion(+) diff --git a/build.fsx b/build.fsx index b2962f3dc..a67aef0f4 100644 --- a/build.fsx +++ b/build.fsx @@ -175,6 +175,7 @@ module VerificationTasks = open FSharp.Compiler.Diagnostics let verifyDocs = BuildTask.create "VerifyDocs" [] { + BuildTask.runOrDefault copyBinaries let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) From 0dec087d6ba9915fc647b28d911c839cf8ab8595 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 06:59:43 +0300 Subject: [PATCH 20/39] Update build.fsx --- build.fsx | 1 + 1 file changed, 1 insertion(+) diff --git a/build.fsx b/build.fsx index a67aef0f4..a3689b393 100644 --- a/build.fsx +++ b/build.fsx @@ -173,6 +173,7 @@ module TestTasks = module VerificationTasks = open FSharp.Compiler.Diagnostics + open BasicTasks let verifyDocs = BuildTask.create "VerifyDocs" [] { BuildTask.runOrDefault copyBinaries From 7aef7273b6b2498a3ceaea7a28bef08c0a59b184 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 07:04:01 +0300 Subject: [PATCH 21/39] Update build.fsx --- build.fsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.fsx b/build.fsx index a3689b393..bf8283bc6 100644 --- a/build.fsx +++ b/build.fsx @@ -175,9 +175,7 @@ module VerificationTasks = open FSharp.Compiler.Diagnostics open BasicTasks - let verifyDocs = BuildTask.create "VerifyDocs" [] { - BuildTask.runOrDefault copyBinaries - + let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] { let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) for target in targets do From da8a975b526e23c5f18a5d36c15a7564d63555e6 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 08:13:40 +0300 Subject: [PATCH 22/39] More advanced verification algorithm --- build.fsx | 23 +++++++++++++++-------- src/Plotly.NET/Playground.fsx | 34 ++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/build.fsx b/build.fsx index bf8283bc6..e2982c01b 100644 --- a/build.fsx +++ b/build.fsx @@ -178,17 +178,24 @@ module VerificationTasks = let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] { let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) - for target in targets do - let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + targets + |> Seq.map ( + fun target -> checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously - |> (fun (diags, _) -> - for diag in diags do - match diag.Severity with - | FSharpDiagnosticSeverity.Error -> raise (System.Exception(diag.ToString())) - | _ -> () + |> fst + |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.map (fun diag -> diag.ToString()) ) + |> Seq.collect id + |> String.concat "\n" + |> (fun errorText -> + match errorText with + | "" -> () + | text -> raise (System.Exception $"Errors:\n{errorText}" ) + ) () } @@ -428,4 +435,4 @@ let _preReleaseNoDocs = [setPrereleaseTag; clean; build; copyBinaries; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease] // run copyBinaries by default -BuildTask.runOrDefault copyBinaries +// BuildTask.runOrDefault copyBinaries diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index 46fb09aca..f01ffaac5 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -1,5 +1,4 @@ open Plotly.NET.StyleParam -open FSharp.Compiler.Diagnostics #r "nuget: FSharp.Data" @@ -794,22 +793,25 @@ let cols =[|"black";"blue"|] #r "FSharp.Compiler.Service.dll" open System.IO open FSharp.Compiler.CodeAnalysis +open FSharp.Compiler.Diagnostics let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () -checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; "Playground.fsx" |] ) -// checker.Compile ( [| "fsc.exe"; "-o"; @"D:/main/vs_prj/plotly.NETFork/Plotly.NET/docs/aaaaaaaaaaa.exe"; "-a"; "Playground.fsx" |] ) -|> Async.RunSynchronously -|> (fun (diags, _) -> - diags - |> Seq.tryPick (fun d -> - match d.Severity with - | FSharpDiagnosticSeverity.Error -> Some(d) - | _ -> None - ) +let targets = [ @"D:\main\vs_prj\plotly.NETFork\Plotly.NET\docs\1_0_axis-styling.fsx" ] + +targets +|> Seq.map ( + fun target -> + checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) + |> Async.RunSynchronously + |> fst + |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.map (fun diag -> diag.ToString()) ) -|> (fun c -> - match c with - | Some d -> d.ToString() - | None -> "Ok" -) \ No newline at end of file +|> Seq.collect id +|> String.concat "\n" +|> (fun errorText -> + match errorText with + | "" -> () + | text -> raise (System.Exception $"Errors:\n{errorText}" ) + ) \ No newline at end of file From 4b2902c1114956f214deb146a193d88c6fe901d8 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 08:30:05 +0300 Subject: [PATCH 23/39] Trying to fix verification script --- build.fsx | 5 ++--- src/Plotly.NET/Playground.fsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.fsx b/build.fsx index e2982c01b..8fcccd36d 100644 --- a/build.fsx +++ b/build.fsx @@ -178,15 +178,14 @@ module VerificationTasks = let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] { let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) - let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () - targets |> Seq.map ( fun target -> + let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously |> fst - |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) |> Seq.map (fun diag -> diag.ToString()) ) |> Seq.collect id diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index f01ffaac5..d150e784b 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -805,7 +805,7 @@ targets checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously |> fst - |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) |> Seq.map (fun diag -> diag.ToString()) ) |> Seq.collect id @@ -813,5 +813,5 @@ targets |> (fun errorText -> match errorText with | "" -> () - | text -> raise (System.Exception $"Errors:\n{errorText}" ) + | text -> raise (System.Exception $"Errors:\n{text}" ) ) \ No newline at end of file From 22b63941cf8fa95fe24c9d6eb1690d20a987d2f9 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 09:04:27 +0300 Subject: [PATCH 24/39] Trying to fix.. --- build.fsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build.fsx b/build.fsx index 8fcccd36d..b300d4ac1 100644 --- a/build.fsx +++ b/build.fsx @@ -178,15 +178,16 @@ module VerificationTasks = let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] { let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) + let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + targets |> Seq.map ( fun target -> - let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () - checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) - |> Async.RunSynchronously - |> fst - |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) - |> Seq.map (fun diag -> diag.ToString()) + checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) + |> Async.RunSynchronously + |> fst + |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.map (fun diag -> diag.ToString()) ) |> Seq.collect id |> String.concat "\n" From 9416b760e6838ae37a3970910862d7209f8b9651 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 09:07:32 +0300 Subject: [PATCH 25/39] Update build.fsx --- build.fsx | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/build.fsx b/build.fsx index b300d4ac1..83df2a461 100644 --- a/build.fsx +++ b/build.fsx @@ -178,24 +178,17 @@ module VerificationTasks = let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] { let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) - let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () - - targets - |> Seq.map ( - fun target -> - checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) - |> Async.RunSynchronously - |> fst - |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) - |> Seq.map (fun diag -> diag.ToString()) + for target in targets do + let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + + checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) + |> Async.RunSynchronously + |> (fun (diags, _) -> + for diag in diags do + match diag.Severity with + | FSharpDiagnosticSeverity.Error -> raise (System.Exception(diag.ToString())) + | _ -> () ) - |> Seq.collect id - |> String.concat "\n" - |> (fun errorText -> - match errorText with - | "" -> () - | text -> raise (System.Exception $"Errors:\n{errorText}" ) - ) () } From 21850be999715b6d579801e42117ca0cb49d286d Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 09:12:26 +0300 Subject: [PATCH 26/39] Update build.fsx --- build.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.fsx b/build.fsx index 83df2a461..bf8283bc6 100644 --- a/build.fsx +++ b/build.fsx @@ -428,4 +428,4 @@ let _preReleaseNoDocs = [setPrereleaseTag; clean; build; copyBinaries; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease] // run copyBinaries by default -// BuildTask.runOrDefault copyBinaries +BuildTask.runOrDefault copyBinaries From a5847fa2371191fa71cadfa4f3c61e083e5da02b Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 10:11:45 +0300 Subject: [PATCH 27/39] Update build.fsx --- build.fsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/build.fsx b/build.fsx index bf8283bc6..5752c8975 100644 --- a/build.fsx +++ b/build.fsx @@ -178,17 +178,24 @@ module VerificationTasks = let verifyDocs = BuildTask.create "VerifyDocs" [clean; build; copyBinaries] { let targets = !! "docs/**.fsx" |> Seq.map (fun f -> f.ToString()) - for target in targets do - let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + targets + |> Seq.map ( + fun target -> checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously - |> (fun (diags, _) -> - for diag in diags do - match diag.Severity with - | FSharpDiagnosticSeverity.Error -> raise (System.Exception(diag.ToString())) - | _ -> () + |> fst + |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.map (fun diag -> diag.ToString()) ) + |> Seq.collect id + |> String.concat "\n" + |> (fun errorText -> + match errorText with + | "" -> () + | text -> raise (System.Exception $"Errors:\n{errorText}" ) + ) () } From 8d02d343df0e060e7c5602e43189795562735b4e Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 10:21:41 +0300 Subject: [PATCH 28/39] Warning also prohibited --- build.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.fsx b/build.fsx index 5752c8975..70cddab29 100644 --- a/build.fsx +++ b/build.fsx @@ -186,7 +186,7 @@ module VerificationTasks = checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously |> fst - |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) + |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) |> Seq.map (fun diag -> diag.ToString()) ) |> Seq.collect id From 8bb9362652c0e88ad724444d671fd36b823a62d7 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 10:36:13 +0300 Subject: [PATCH 29/39] Sorting --- build.fsx | 8 ++++---- src/Plotly.NET/Playground.fsx | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build.fsx b/build.fsx index 70cddab29..feda84ff2 100644 --- a/build.fsx +++ b/build.fsx @@ -186,17 +186,17 @@ module VerificationTasks = checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously |> fst - |> Seq.filter (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) - |> Seq.map (fun diag -> diag.ToString()) + |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) ) |> Seq.collect id + |> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName) + |> Seq.map (fun diag -> diag.ToString()) |> String.concat "\n" |> (fun errorText -> match errorText with | "" -> () - | text -> raise (System.Exception $"Errors:\n{errorText}" ) + | text -> raise (System.Exception $"Errors:\n{text}" ) ) - () } /// Package creation diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index d150e784b..ac9c8f401 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -805,10 +805,11 @@ targets checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) |> Async.RunSynchronously |> fst - |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error -> true | _ -> false) - |> Seq.map (fun diag -> diag.ToString()) + |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) ) |> Seq.collect id +|> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName) +|> Seq.map (fun diag -> diag.ToString()) |> String.concat "\n" |> (fun errorText -> match errorText with From b25d63601e57143953057f5ffcbcfa9b0720bb0a Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 10:45:02 +0300 Subject: [PATCH 30/39] Only counting the numeric part when sorting --- build.fsx | 8 ++++++-- src/Plotly.NET/Playground.fsx | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build.fsx b/build.fsx index feda84ff2..a9b1b74e3 100644 --- a/build.fsx +++ b/build.fsx @@ -189,8 +189,12 @@ module VerificationTasks = |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) ) |> Seq.collect id - |> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName) - |> Seq.map (fun diag -> diag.ToString()) + |> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName.[..6] (* to only count the numeric part *) ) + |> Seq.map (fun diag -> + (match diag.Severity with + | FSharpDiagnosticSeverity.Error -> "--- Error: " + | _ -> "--- Warning: ") + + diag.ToString()) |> String.concat "\n" |> (fun errorText -> match errorText with diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index ac9c8f401..f5ede8ce4 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -808,8 +808,12 @@ targets |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) ) |> Seq.collect id -|> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName) -|> Seq.map (fun diag -> diag.ToString()) +|> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName.[..6] (* to only count the numeric part *) ) +|> Seq.map (fun diag -> + (match diag.Severity with + | FSharpDiagnosticSeverity.Error -> "--- Error: " + | _ -> "--- Warning: ") + + diag.ToString()) |> String.concat "\n" |> (fun errorText -> match errorText with From 8eb0e30b6b4fa3b718e1d26a52c4c436a214c597 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 11:01:13 +0300 Subject: [PATCH 31/39] with*_ -> with* --- docs/0_2_display-options.fsx | 20 +++++----- docs/1_0_axis-styling.fsx | 22 +++++------ docs/1_2_multiple-charts.fsx | 70 +++++++++++++++++------------------ docs/3_0_3d-scatter-plots.fsx | 6 +-- docs/3_1_3d-line-plots.fsx | 6 +-- docs/7_0_candlestick.fsx | 4 +- docs/index.fsx | 20 +++++----- 7 files changed, 74 insertions(+), 74 deletions(-) diff --git a/docs/0_2_display-options.fsx b/docs/0_2_display-options.fsx index 77706c94b..78b115fd8 100644 --- a/docs/0_2_display-options.fsx +++ b/docs/0_2_display-options.fsx @@ -55,8 +55,8 @@ let description1 = (***do-not-eval***) let desc1 = Chart.Point(x,y,Name="desc1") - |> Chart.WithDescription(description1) - |> Chart.Show + |> Chart.withDescription(description1) + |> Chart.show (** @@ -71,8 +71,8 @@ let description2 = (***do-not-eval***) let desc2 = Chart.Point(x,y,Name="desc1") - |> Chart.WithDescription(description2) - |> Chart.Show + |> Chart.withDescription(description2) + |> Chart.show (** @@ -108,10 +108,10 @@ let description3 = (***do-not-eval***) let desc3 = Chart.Point(x,y,Name="desc3") - |> Chart.WithDescription description3 + |> Chart.withDescription description3 // Add reference to the bulma css framework - |> Chart.WithAdditionalHeadTags [""""""] - |> Chart.Show + |> Chart.withAdditionalHeadTags [""""""] + |> Chart.show (** @@ -128,11 +128,11 @@ By popular request, `Chart.WithMathTex` is a prebuilt function to enable MathTeX Chart.Point([(1.,2.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") Chart.Point([(2.,4.)],@"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$") ] -|> Chart.Combine +|> Chart.combine |> Chart.withTitle @"$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" // include mathtex tags in . pass true to append these scripts, false to ONLY include MathTeX. -|> Chart.WithMathTex(true) -|> Chart.Show +|> Chart.withMathTex(true) +|> Chart.show (** diff --git a/docs/1_0_axis-styling.fsx b/docs/1_0_axis-styling.fsx index 9cb52d9fc..796ccdda0 100644 --- a/docs/1_0_axis-styling.fsx +++ b/docs/1_0_axis-styling.fsx @@ -45,8 +45,8 @@ To style a specific axis of a plot, use the respective `Chart.with*_AxisStyle` f let plot1 = Chart.Point(x,y) - |> Chart.withX_AxisStyle ("X axis title", MinMax = (-1.,10.)) - |> Chart.withY_AxisStyle ("Y axis title", MinMax = (-1.,10.)) + |> Chart.withXAxisStyle ("X axis title", MinMax = (-1.,10.)) + |> Chart.withYAxisStyle ("Y axis title", MinMax = (-1.,10.)) (*** condition: ipynb ***) #if IPYNB @@ -83,8 +83,8 @@ let mirroredLogYAxis = let plot2 = Chart.Point(x,y) - |> Chart.withX_Axis mirroredXAxis - |> Chart.withY_Axis mirroredLogYAxis + |> Chart.withXAxis mirroredXAxis + |> Chart.withYAxis mirroredLogYAxis (*** condition: ipynb ***) #if IPYNB @@ -122,13 +122,13 @@ let twoXAxes1 = anchoredAt1 anchoredAt2 ] - |> Chart.Combine - |> Chart.withY_AxisStyle( + |> Chart.combine + |> Chart.withYAxisStyle( "axis 1", Side=StyleParam.Side.Left, Id=1 ) - |> Chart.withY_AxisStyle( + |> Chart.withYAxisStyle( "axis2", Side=StyleParam.Side.Right, Id=2, @@ -156,16 +156,16 @@ let twoXAxes2 = anchoredAt1 anchoredAt2 ] - |> Chart.Combine - |> Chart.withY_AxisStyle( + |> Chart.combine + |> Chart.withYAxisStyle( "first y-axis", Showline=true ) - |> Chart.withX_AxisStyle( + |> Chart.withXAxisStyle( "x-axis", Domain=(0.3, 1.0) // moves the first axis and the whole plot to the right ) - |> Chart.withY_AxisStyle( + |> Chart.withYAxisStyle( "second y-axis", Side=StyleParam.Side.Left, Id=2, diff --git a/docs/1_2_multiple-charts.fsx b/docs/1_2_multiple-charts.fsx index 776532a7c..885e983dc 100644 --- a/docs/1_2_multiple-charts.fsx +++ b/docs/1_2_multiple-charts.fsx @@ -52,7 +52,7 @@ let combinedChart = Chart.Line(x,y,Name="first") Chart.Line(y,x,Name="second") ] - |> Chart.Combine + |> Chart.combine #if IPYNB combinedChart @@ -77,17 +77,17 @@ You can either use Chart.Grid with a 1 dimensional sequence of Charts and specif let grid = [ Chart.Point(x,y,Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Line(x,y,Name="1,2") - |> Chart.withX_AxisStyle "x2" - |> Chart.withY_AxisStyle "y2" + |> Chart.withXAxisStyle "x2" + |> Chart.withYAxisStyle "y2" Chart.Spline(x,y,Name="2,1") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" Chart.Point(x,y,Name="2,2") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" ] |> Chart.Grid(2,2) @@ -109,19 +109,19 @@ let grid2 = [ [ Chart.Point(x,y,Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Line(x,y,Name="1,2") - |> Chart.withX_AxisStyle "x2" - |> Chart.withY_AxisStyle "y2" + |> Chart.withXAxisStyle "x2" + |> Chart.withYAxisStyle "y2" ] [ Chart.Spline(x,y,Name="2,1") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" Chart.Point(x,y,Name="2,2") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" ] ] @@ -146,18 +146,18 @@ to the row with the highest amount of charts, and the other rows will be filled let grid3 = [ Chart.Point(x,y,Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Invisible() Chart.Spline(x,y,Name="2,1") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" Chart.Point(x,y,Name="2,2") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" ] |> Chart.Grid(2,2) @@ -178,17 +178,17 @@ use `Pattern=StyleParam.LayoutGridPatter.Coupled` to use one shared x axis per c let grid4 = [ Chart.Point(x,y,Name="1,1") - |> Chart.withX_AxisStyle "x1" - |> Chart.withY_AxisStyle "y1" + |> Chart.withXAxisStyle "x1" + |> Chart.withYAxisStyle "y1" Chart.Line(x,y,Name="1,2") - |> Chart.withX_AxisStyle "x2" - |> Chart.withY_AxisStyle "y2" + |> Chart.withXAxisStyle "x2" + |> Chart.withYAxisStyle "y2" Chart.Spline(x,y,Name="2,1") - |> Chart.withX_AxisStyle "x3" - |> Chart.withY_AxisStyle "y3" + |> Chart.withXAxisStyle "x3" + |> Chart.withYAxisStyle "y3" Chart.Point(x,y,Name="2,2") - |> Chart.withX_AxisStyle "x4" - |> Chart.withY_AxisStyle "y4" + |> Chart.withXAxisStyle "x4" + |> Chart.withYAxisStyle "y4" ] |> Chart.Grid(2,2,Pattern=StyleParam.LayoutGridPattern.Coupled) @@ -214,19 +214,19 @@ As with all grid charts, you can also use the Chart.withLayoutGridStyle to style let singleStack = [ Chart.Point(x,y) - |> Chart.withY_AxisStyle("This title must") + |> Chart.withYAxisStyle("This title must") Chart.Line(x,y) - |> Chart.withY_AxisStyle("be set on the") + |> Chart.withYAxisStyle("be set on the") Chart.Spline(x,y) - |> Chart.withY_AxisStyle("respective subplots") + |> Chart.withYAxisStyle("respective subplots") ] |> Chart.SingleStack(Pattern= StyleParam.LayoutGridPattern.Coupled) //increase spacing between plots by using the withLayoutGridStyle function |> Chart.withLayoutGridStyle(YGap= 0.1) |> Chart.withTitle("Hi i am the new SingleStackChart") - |> Chart.withX_AxisStyle("im the shared xAxis") + |> Chart.withXAxisStyle("im the shared xAxis") (*** condition: ipynb ***) #if IPYNB diff --git a/docs/3_0_3d-scatter-plots.fsx b/docs/3_0_3d-scatter-plots.fsx index 89c7cd0f8..4912489c6 100644 --- a/docs/3_0_3d-scatter-plots.fsx +++ b/docs/3_0_3d-scatter-plots.fsx @@ -40,9 +40,9 @@ let z = [19; 26; 55;] let scatter3d = Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers) - |> Chart.withX_AxisStyle("my x-axis") - |> Chart.withY_AxisStyle("my y-axis") - |> Chart.withZ_AxisStyle("my z-axis") + |> Chart.withXAxisStyle("my x-axis") + |> Chart.withYAxisStyle("my y-axis") + |> Chart.withZAxisStyle("my z-axis") |> Chart.withSize(800.,800.) (*** condition: ipynb ***) diff --git a/docs/3_1_3d-line-plots.fsx b/docs/3_1_3d-line-plots.fsx index 034bbbe60..ee7620845 100644 --- a/docs/3_1_3d-line-plots.fsx +++ b/docs/3_1_3d-line-plots.fsx @@ -52,9 +52,9 @@ When using `Lines_Markers` as the mode of the chart, you additionally render a l let scatter3dLine = Chart.Scatter3d(x,y,z,StyleParam.Mode.Lines_Markers) - |> Chart.withX_AxisStyle("x-axis") - |> Chart.withY_AxisStyle("y-axis") - |> Chart.withZ_AxisStyle("z-axis") + |> Chart.withXAxisStyle("x-axis") + |> Chart.withYAxisStyle("y-axis") + |> Chart.withZAxisStyle("z-axis") |> Chart.withSize(800.,800.) (*** condition: ipynb ***) diff --git a/docs/7_0_candlestick.fsx b/docs/7_0_candlestick.fsx index d0a9f4365..9c65e3281 100644 --- a/docs/7_0_candlestick.fsx +++ b/docs/7_0_candlestick.fsx @@ -65,13 +65,13 @@ candles1 |> GenericChart.toChartHTML (***include-it-raw***) (** -If you want to hide the rangeslider, use `withX_AxisRangeSlider` and hide it: +If you want to hide the rangeslider, use `withXAxisRangeSlider` and hide it: *) let rangeslider = RangeSlider.init(Visible=false) let candles2 = Chart.Candlestick candles - |> Chart.withX_AxisRangeSlider rangeslider + |> Chart.withXAxisRangeSlider rangeslider (*** condition: ipynb ***) #if IPYNB diff --git a/docs/index.fsx b/docs/index.fsx index 1bf696dc9..ed5b21ca0 100644 --- a/docs/index.fsx +++ b/docs/index.fsx @@ -138,16 +138,16 @@ let myFirstChart = Chart.Point(xData,yData) Styling functions are generally the `Chart.with*` naming convention. The following styling example does: - set the chart title via `Chart.withTitle` - - set the x axis title and removes the gridline from the axis via `Chart.withX_AxisStyle` - - set the y axis title and removes the gridline from the axis via `Chart.withY_AxisStyle` + - set the x axis title and removes the gridline from the axis via `Chart.withXAxisStyle` + - set the y axis title and removes the gridline from the axis via `Chart.withYAxisStyle` *) let myFirstStyledChart = Chart.Point(xData,yData) |> Chart.withTitle "Hello world!" - |> Chart.withX_AxisStyle ("xAxis", Showgrid=false) - |> Chart.withY_AxisStyle ("yAxis", Showgrid=false) + |> Chart.withXAxisStyle ("xAxis", Showgrid=false) + |> Chart.withYAxisStyle ("yAxis", Showgrid=false) (** **Attention:** Styling functions mutate 😈 the input chart, therefore possibly affecting bindings to intermediary results. @@ -196,8 +196,8 @@ Chart.Point(xData',yData') Chart.Point(xData,yData) |> Chart.withTitle "Hello world!" -|> Chart.withX_AxisStyle ("xAxis", Showgrid=false) -|> Chart.withY_AxisStyle ("yAxis", Showgrid=false) +|> Chart.withXAxisStyle ("xAxis", Showgrid=false) +|> Chart.withYAxisStyle ("yAxis", Showgrid=false) (** @@ -211,8 +211,8 @@ One of the main design points of Plotly.NET it is to provide support for multipl [(1,5);(2,10)] |> Chart.Point |> Chart.withTraceName("Hello from F#",Showlegend=true) -|> Chart.withY_AxisStyle("xAxis",Showgrid= false, Showline=true) -|> Chart.withX_AxisStyle("yAxis",Showgrid= false, Showline=true) +|> Chart.withYAxisStyle("xAxis",Showgrid= false, Showline=true) +|> Chart.withXAxisStyle("yAxis",Showgrid= false, Showline=true) (** ### Fluent interface style in C#: @@ -225,8 +225,8 @@ static void Main(string[] args) GenericChart.GenericChart chart = Chart.Point(x: x, y: y); chart .WithTraceName("Hello from C#", true) - .WithX_AxisStyle(title: "xAxis", Showgrid: false, Showline: true) - .WithY_AxisStyle(title: "yAxis", Showgrid: false, Showline: true) + .withXAxisStyle(title: "xAxis", Showgrid: false, Showline: true) + .withYAxisStyle(title: "yAxis", Showgrid: false, Showline: true) .Show(); } ``` From 8ad1bb077f97f28340a3d3b77eb3adb915c44656 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 11:25:40 +0300 Subject: [PATCH 32/39] Many fixes ; ignore unused variable wanring --- build.fsx | 5 +++++ docs/0_0_basics.fsx | 1 + docs/2_1_bar-and-column-charts.fsx | 4 ++-- docs/4_1_box-plots.fsx | 2 +- docs/4_2_violin-plots.fsx | 2 +- docs/4_4_2d-histograms.fsx | 2 +- docs/5_1_geo-plots.fsx | 2 +- docs/6_1_mapbox-plots.fsx | 2 +- docs/8_0_polar-charts.fsx | 2 +- docs/8_1_windrose-charts.fsx | 2 +- docs/index.fsx | 4 ++-- src/Plotly.NET/Playground.fsx | 5 +++++ 12 files changed, 22 insertions(+), 11 deletions(-) diff --git a/build.fsx b/build.fsx index a9b1b74e3..cc292d27d 100644 --- a/build.fsx +++ b/build.fsx @@ -180,6 +180,10 @@ module VerificationTasks = let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () + let ignoredDiagnostics = Set.ofList [ + 1182; // unused variable + ] + targets |> Seq.map ( fun target -> @@ -189,6 +193,7 @@ module VerificationTasks = |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) ) |> Seq.collect id + |> Seq.where (fun c -> not (ignoredDiagnostics.Contains c.ErrorNumber)) |> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName.[..6] (* to only count the numeric part *) ) |> Seq.map (fun diag -> (match diag.Severity with diff --git a/docs/0_0_basics.fsx b/docs/0_0_basics.fsx index 39b86d69c..c2eb28b29 100644 --- a/docs/0_0_basics.fsx +++ b/docs/0_0_basics.fsx @@ -47,6 +47,7 @@ The central type that gets created by all Chart constructors is `GenericChart`, *) (***do-not-eval***) +[] type GenericChart = | Chart of Trace * Layout * Config * DisplayOptions | MultiChart of Trace list * Layout * Config * DisplayOptions diff --git a/docs/2_1_bar-and-column-charts.fsx b/docs/2_1_bar-and-column-charts.fsx index 1fa4ce55b..9be59b3a2 100644 --- a/docs/2_1_bar-and-column-charts.fsx +++ b/docs/2_1_bar-and-column-charts.fsx @@ -84,7 +84,7 @@ let stackedBar = Chart.StackedBar(keys,values,Name="old"); Chart.StackedBar(keys,[8; 21; 13;],Name="new") ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB @@ -104,7 +104,7 @@ let stackedColumn = Chart.StackedColumn(keys,values,Name="old"); Chart.StackedColumn(keys,[8; 21; 13;],Name="new") ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/4_1_box-plots.fsx b/docs/4_1_box-plots.fsx index b695dbcab..fb73b58f5 100644 --- a/docs/4_1_box-plots.fsx +++ b/docs/4_1_box-plots.fsx @@ -81,7 +81,7 @@ let box3 = Chart.BoxPlot("y" ,y,Name="bin1",Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All); Chart.BoxPlot("y'",y',Name="bin2",Jitter=0.1,Boxpoints=StyleParam.Boxpoints.All); ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/4_2_violin-plots.fsx b/docs/4_2_violin-plots.fsx index e5c08ecae..13b22d1f3 100644 --- a/docs/4_2_violin-plots.fsx +++ b/docs/4_2_violin-plots.fsx @@ -90,7 +90,7 @@ let violin3 = Chart.Violin ("y" ,y,Name="bin1",Jitter=0.1,Points=StyleParam.Jitterpoints.All); Chart.Violin ("y'",y',Name="bin2",Jitter=0.1,Points=StyleParam.Jitterpoints.All); ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/4_4_2d-histograms.fsx b/docs/4_4_2d-histograms.fsx index 8d2e2f125..b2a810392 100644 --- a/docs/4_4_2d-histograms.fsx +++ b/docs/4_4_2d-histograms.fsx @@ -64,7 +64,7 @@ let histogramContour = Chart.Histogram2dContour (x,y,Line=Line.init(Width=0.)) Chart.Point(x,y,Opacity=0.3) ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/5_1_geo-plots.fsx b/docs/5_1_geo-plots.fsx index d068a990a..c1df1f873 100644 --- a/docs/5_1_geo-plots.fsx +++ b/docs/5_1_geo-plots.fsx @@ -106,7 +106,7 @@ let flights = Color = "red" ) ) - |> Chart.Combine + |> Chart.combine |> Chart.withLegend(false) |> Chart.withMapStyle( Scope=StyleParam.GeoScope.NorthAmerica, diff --git a/docs/6_1_mapbox-plots.fsx b/docs/6_1_mapbox-plots.fsx index 1c2cffee8..9683bfa7a 100644 --- a/docs/6_1_mapbox-plots.fsx +++ b/docs/6_1_mapbox-plots.fsx @@ -104,7 +104,7 @@ let flights = Color = "red" ) ) - |> Chart.Combine + |> Chart.combine |> Chart.withLegend(false) |> Chart.withMapbox( Mapbox.init( diff --git a/docs/8_0_polar-charts.fsx b/docs/8_0_polar-charts.fsx index 41a1648ab..76229a15c 100644 --- a/docs/8_0_polar-charts.fsx +++ b/docs/8_0_polar-charts.fsx @@ -52,7 +52,7 @@ let polar1 = Chart.Polar(r2,t,StyleParam.Mode.Markers,Name="2") Chart.Polar(r3,t,StyleParam.Mode.Markers,Name="3") ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/8_1_windrose-charts.fsx b/docs/8_1_windrose-charts.fsx index 42656e1bc..e73849a42 100644 --- a/docs/8_1_windrose-charts.fsx +++ b/docs/8_1_windrose-charts.fsx @@ -53,7 +53,7 @@ let windrose1 = Chart.WindRose (r'' ,t,Name="5-8 m/s") Chart.WindRose (r''',t,Name="< 5 m/s") ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/index.fsx b/docs/index.fsx index ed5b21ca0..a5212e465 100644 --- a/docs/index.fsx +++ b/docs/index.fsx @@ -162,7 +162,7 @@ The `Chart.Show` function will open a browser window and render the input chart (***do-not-eval***) myFirstChart -|> Chart.Show +|> Chart.show (**Should render this chart in your brower:*) @@ -172,7 +172,7 @@ myFirstChart |> GenericChart.toChartHTML (***do-not-eval***) myFirstStyledChart -|> Chart.Show +|> Chart.show (**And here is what happened after applying the styles from above:*) diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index f5ede8ce4..315cb9664 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -799,6 +799,10 @@ let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () let targets = [ @"D:\main\vs_prj\plotly.NETFork\Plotly.NET\docs\1_0_axis-styling.fsx" ] +let ignoredDiagnostics = Set.ofList [ + 1182; // unused variable + ] + targets |> Seq.map ( fun target -> @@ -808,6 +812,7 @@ targets |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) ) |> Seq.collect id +|> Seq.where (fun c -> not (ignoredDiagnostics.Contains c.ErrorNumber)) |> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName.[..6] (* to only count the numeric part *) ) |> Seq.map (fun diag -> (match diag.Severity with From 91969229ab20e0210f24df86358366e0214374ca Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 11:32:54 +0300 Subject: [PATCH 33/39] Combine -> combine --- docs/2_2_area-plots.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/2_2_area-plots.fsx b/docs/2_2_area-plots.fsx index 21be24073..54d095745 100644 --- a/docs/2_2_area-plots.fsx +++ b/docs/2_2_area-plots.fsx @@ -80,7 +80,7 @@ let stackedArea = Chart.StackedArea(x,y) Chart.StackedArea(x,y |> Seq.rev) ] - |> Chart.Combine + |> Chart.combine (*** condition: ipynb ***) #if IPYNB From 67cac09707640af9d796991972d3982455e85962 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 11:57:01 +0300 Subject: [PATCH 34/39] Generic chart extensions underscores and a few warnings fixed --- src/Plotly.NET/ChartExtensions.fs | 4 ++-- src/Plotly.NET/GenericChartExtensions.fs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Plotly.NET/ChartExtensions.fs b/src/Plotly.NET/ChartExtensions.fs index f9c6e5724..87a1bcea6 100644 --- a/src/Plotly.NET/ChartExtensions.fs +++ b/src/Plotly.NET/ChartExtensions.fs @@ -892,7 +892,7 @@ module ChartExtensions = gChart |> Chart.withAxisAnchor(xAnchor,yAnchor) // set adapted axis anchors |> Chart.withXAxis(xAxis,i+1) // set previous axis with adapted id (one individual axis for each subplot, wether or not they will be used later) - |> Chart.withY_Axis(yAxis,i+1) // set previous axis with adapted id (one individual axis for each subplot, wether or not they will be used later) + |> Chart.withYAxis(yAxis,i+1) // set previous axis with adapted id (one individual axis for each subplot, wether or not they will be used later) |> GenericChart.mapLayout (fun l -> if i > 0 then // remove default axes from consecutive charts, otherwise they will override the first one @@ -1143,7 +1143,7 @@ module ChartExtensions = |> GenericChart.setLayout layout |> Chart.withAxisAnchor(X=index,Y=index) |> Chart.withXAxis(xaxis,index) - |> Chart.withY_Axis(yaxis,index) + |> Chart.withYAxis(yaxis,index) ) |> Chart.combine diff --git a/src/Plotly.NET/GenericChartExtensions.fs b/src/Plotly.NET/GenericChartExtensions.fs index 91651c020..9008a5f3b 100644 --- a/src/Plotly.NET/GenericChartExtensions.fs +++ b/src/Plotly.NET/GenericChartExtensions.fs @@ -158,9 +158,9 @@ module GenericChartExtensions = // ####################### Apply to layout // Sets x-Axis of 2d and 3d- Charts - [] + [] [] - member this.WithX_Axis(xAxis:Axis.LinearAxis,[] ?Id) = + member this.WithXAxis(xAxis:Axis.LinearAxis,[] ?Id) = let contains3d = this @@ -183,7 +183,7 @@ module GenericChartExtensions = GenericChart.addLayout layout this // Sets x-Axis of 2d and 3d- Charts - [] + [] [] member this.WithX_AxisStyle(title, [] ?MinMax, @@ -203,7 +203,7 @@ module GenericChartExtensions = this |> Chart.withXAxis(xaxis,?Id=Id) /// Sets the range slider for the xAxis - [] + [] [] member this.WithX_AxisRangeSlider(rangeSlider:RangeSlider, [] ?Id) = @@ -211,7 +211,7 @@ module GenericChartExtensions = this |> Chart.withXAxis(xaxis,?Id=Id) // Sets y-Axis of 2d and 3d- Charts - [] + [] [] member this.WithY_Axis(yAxis:Axis.LinearAxis,[] ?Id) = @@ -236,7 +236,7 @@ module GenericChartExtensions = GenericChart.addLayout layout this // Sets y-Axis of 3d- Charts - [] + [] [] member this.WithY_AxisStyle(title, [] ?MinMax, @@ -257,7 +257,7 @@ module GenericChartExtensions = // Sets z-Axis of 3d- Charts - [] + [] [] member this.WithZ_Axis(zAxis:Axis.LinearAxis) = let layout = @@ -268,7 +268,7 @@ module GenericChartExtensions = // Sets z-Axis style with ... - [] + [] [] member this.WithZ_AxisStyle(title, [] ?MinMax, From 1360462d7a7cee022b21680c7a84d5b69a5fd5fb Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 12:22:19 +0300 Subject: [PATCH 35/39] Playground revert ; more underscores removed --- src/Plotly.NET/GenericChartExtensions.fs | 12 ++++---- src/Plotly.NET/Playground.fsx | 37 ------------------------ 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/src/Plotly.NET/GenericChartExtensions.fs b/src/Plotly.NET/GenericChartExtensions.fs index 9008a5f3b..cccaad73e 100644 --- a/src/Plotly.NET/GenericChartExtensions.fs +++ b/src/Plotly.NET/GenericChartExtensions.fs @@ -185,7 +185,7 @@ module GenericChartExtensions = // Sets x-Axis of 2d and 3d- Charts [] [] - member this.WithX_AxisStyle(title, + member this.WithXAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -205,7 +205,7 @@ module GenericChartExtensions = /// Sets the range slider for the xAxis [] [] - member this.WithX_AxisRangeSlider(rangeSlider:RangeSlider, + member this.WithXAxisRangeSlider(rangeSlider:RangeSlider, [] ?Id) = let xaxis = Axis.LinearAxis.init(RangeSlider = rangeSlider) this |> Chart.withXAxis(xaxis,?Id=Id) @@ -213,7 +213,7 @@ module GenericChartExtensions = // Sets y-Axis of 2d and 3d- Charts [] [] - member this.WithY_Axis(yAxis:Axis.LinearAxis,[] ?Id) = + member this.WithYAxis(yAxis:Axis.LinearAxis,[] ?Id) = let contains3d = this @@ -238,7 +238,7 @@ module GenericChartExtensions = // Sets y-Axis of 3d- Charts [] [] - member this.WithY_AxisStyle(title, + member this.WithYAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, @@ -259,7 +259,7 @@ module GenericChartExtensions = // Sets z-Axis of 3d- Charts [] [] - member this.WithZ_Axis(zAxis:Axis.LinearAxis) = + member this.WithZAxis(zAxis:Axis.LinearAxis) = let layout = Layout() |> Layout.style(Scene=Scene.init(zAxis=zAxis)) @@ -270,7 +270,7 @@ module GenericChartExtensions = // Sets z-Axis style with ... [] [] - member this.WithZ_AxisStyle(title, + member this.WithZAxisStyle(title, [] ?MinMax, [] ?Showgrid, [] ?Showline, diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index 315cb9664..12bdbd37f 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -788,40 +788,3 @@ let values,labels = |> Seq.unzip let cols =[|"black";"blue"|] - - -#r "FSharp.Compiler.Service.dll" -open System.IO -open FSharp.Compiler.CodeAnalysis -open FSharp.Compiler.Diagnostics - -let checker = FSharp.Compiler.CodeAnalysis.FSharpChecker.Create () - -let targets = [ @"D:\main\vs_prj\plotly.NETFork\Plotly.NET\docs\1_0_axis-styling.fsx" ] - -let ignoredDiagnostics = Set.ofList [ - 1182; // unused variable - ] - -targets -|> Seq.map ( - fun target -> - checker.Compile ( [| "fsc.exe"; "-o"; @"aaaaaaaaaaa.exe"; "-a"; target |] ) - |> Async.RunSynchronously - |> fst - |> Seq.where (fun diag -> match diag.Severity with FSharpDiagnosticSeverity.Error | FSharpDiagnosticSeverity.Warning -> true | _ -> false) -) -|> Seq.collect id -|> Seq.where (fun c -> not (ignoredDiagnostics.Contains c.ErrorNumber)) -|> Seq.sortBy (fun diag -> (match diag.Severity with FSharpDiagnosticSeverity.Error -> 0 | _ -> 1), diag.FileName.[..6] (* to only count the numeric part *) ) -|> Seq.map (fun diag -> - (match diag.Severity with - | FSharpDiagnosticSeverity.Error -> "--- Error: " - | _ -> "--- Warning: ") - + diag.ToString()) -|> String.concat "\n" -|> (fun errorText -> - match errorText with - | "" -> () - | text -> raise (System.Exception $"Errors:\n{text}" ) - ) \ No newline at end of file From 2335931090af22a120adeec9c78380063ba0f678 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 10 Aug 2021 12:22:45 +0300 Subject: [PATCH 36/39] VS Version revert --- Plotly.NET.sln | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plotly.NET.sln b/Plotly.NET.sln index 9d9883551..c61a4a92e 100644 --- a/Plotly.NET.sln +++ b/Plotly.NET.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31521.260 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}" ProjectSection(SolutionItems) = preProject From 223270d2c8e0af253d1b5566db8a7442cf534778 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 13 Aug 2021 16:59:43 +0300 Subject: [PATCH 37/39] Remaining errors fixed --- src/Plotly.NET/ChartExtensions.fs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Plotly.NET/ChartExtensions.fs b/src/Plotly.NET/ChartExtensions.fs index 50e51d814..60997598e 100644 --- a/src/Plotly.NET/ChartExtensions.fs +++ b/src/Plotly.NET/ChartExtensions.fs @@ -250,6 +250,7 @@ module ChartExtensions = // Sets x-Axis of 2d and 3d- Charts [] static member withXAxisStyle(title, + [] ?TitleFont, [] ?MinMax, [] ?ShowGrid, [] ?ShowLine, @@ -326,28 +327,29 @@ module ChartExtensions = [] ?Anchor) = Chart.withYAxisStyle(title, ?MinMax = MinMax, - ?Showgrid = Showgrid, - ?Showline = Showline, + ?ShowGrid = ShowGrid, + ?ShowLine = ShowLine, ?Side = Side, ?Overlaying = Overlaying, ?Id = Id, ?Domain = Domain, ?Position = Position, - ?Zeroline = Zeroline, + ?ZeroLine = ZeroLine, ?Anchor = Anchor) // Sets y-Axis of 3d- Charts [] static member withYAxisStyle(title, + [] ?TitleFont, [] ?MinMax, - [] ?Showgrid, - [] ?Showline, + [] ?ShowGrid, + [] ?ShowLine, [] ?Side, [] ?Overlaying, [] ?Id, [] ?Domain, [] ?Position, - [] ?Zeroline, + [] ?ZeroLine, [] ?Anchor) = let range = if MinMax.IsSome then Some (StyleParam.Range.MinMax (MinMax.Value)) else None let domain = if Domain.IsSome then Some (StyleParam.Range.MinMax (Domain.Value)) else None From c1aab1be9eeb658ac0e6c454fb6711a31d24f0dc Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 13 Aug 2021 17:07:51 +0300 Subject: [PATCH 38/39] Docs fixed --- docs/8_2_styling_polar_layouts.fsx | 3 ++- docs/index.fsx | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/8_2_styling_polar_layouts.fsx b/docs/8_2_styling_polar_layouts.fsx index 1a5d969e4..496e87dc9 100644 --- a/docs/8_2_styling_polar_layouts.fsx +++ b/docs/8_2_styling_polar_layouts.fsx @@ -48,7 +48,8 @@ let combinedPolar = Chart.LinePolar(r2,t,Name="LinePolar", ShowMarkers = true) Chart.SplinePolar(r3,t,Name="SplinePolar", ShowMarkers = true) ] - |> Chart.Combine + + |> Chart.combine (*** condition: ipynb ***) #if IPYNB diff --git a/docs/index.fsx b/docs/index.fsx index a5212e465..da04d51e2 100644 --- a/docs/index.fsx +++ b/docs/index.fsx @@ -146,8 +146,8 @@ Styling functions are generally the `Chart.with*` naming convention. The followi let myFirstStyledChart = Chart.Point(xData,yData) |> Chart.withTitle "Hello world!" - |> Chart.withXAxisStyle ("xAxis", Showgrid=false) - |> Chart.withYAxisStyle ("yAxis", Showgrid=false) + |> Chart.withXAxisStyle ("xAxis", ShowGrid=false) + |> Chart.withYAxisStyle ("yAxis", ShowGrid=false) (** **Attention:** Styling functions mutate 😈 the input chart, therefore possibly affecting bindings to intermediary results. @@ -196,8 +196,8 @@ Chart.Point(xData',yData') Chart.Point(xData,yData) |> Chart.withTitle "Hello world!" -|> Chart.withXAxisStyle ("xAxis", Showgrid=false) -|> Chart.withYAxisStyle ("yAxis", Showgrid=false) +|> Chart.withXAxisStyle ("xAxis", ShowGrid=false) +|> Chart.withYAxisStyle ("yAxis", ShowGrid=false) (** @@ -210,9 +210,9 @@ One of the main design points of Plotly.NET it is to provide support for multipl [(1,5);(2,10)] |> Chart.Point -|> Chart.withTraceName("Hello from F#",Showlegend=true) -|> Chart.withYAxisStyle("xAxis",Showgrid= false, Showline=true) -|> Chart.withXAxisStyle("yAxis",Showgrid= false, Showline=true) +|> Chart.withTraceName("Hello from F#",ShowLegend=true) +|> Chart.withYAxisStyle("xAxis",ShowGrid= false, ShowLine=true) +|> Chart.withXAxisStyle("yAxis",ShowGrid= false, ShowLine=true) (** ### Fluent interface style in C#: From 726d9dc24d3a299b3cbf18e4c720e4dbeade2ee3 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 13 Aug 2021 17:25:06 +0300 Subject: [PATCH 39/39] One arg reverted --- docs/index.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.fsx b/docs/index.fsx index da04d51e2..56be308d0 100644 --- a/docs/index.fsx +++ b/docs/index.fsx @@ -210,7 +210,7 @@ One of the main design points of Plotly.NET it is to provide support for multipl [(1,5);(2,10)] |> Chart.Point -|> Chart.withTraceName("Hello from F#",ShowLegend=true) +|> Chart.withTraceName("Hello from F#",Showlegend=true) |> Chart.withYAxisStyle("xAxis",ShowGrid= false, ShowLine=true) |> Chart.withXAxisStyle("yAxis",ShowGrid= false, ShowLine=true)