diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Bins.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Bins.cs new file mode 100644 index 000000000..3b87d3cef --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Bins.cs @@ -0,0 +1,26 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Bins InitBins + ( + Optional Start = default, + Optional End = default, + Optional Size = default + ) + => + Plotly.NET.TraceObjects.Bins.init( + Start: Start.ToOption(), + End: End.ToOption(), + Size: Size.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Box.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Box.cs new file mode 100644 index 000000000..7eb1fb8ca --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Box.cs @@ -0,0 +1,30 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Box InitBox + ( + Optional Visible = default, + Optional Width = default, + Optional FillColor = default, + Optional LineColor = default, + Optional LineWidth = default + ) + => + Plotly.NET.TraceObjects.Box.init( + Visible: Visible.ToOption(), + Width: Width.ToOption(), + FillColor: FillColor.ToOption(), + LineColor: LineColor.ToOption(), + LineWidth: LineWidth.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Caps.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Caps.cs new file mode 100644 index 000000000..be64cd6f7 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Caps.cs @@ -0,0 +1,39 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.CapFill InitCapFill + ( + Optional Fill = default, + Optional Show = default + ) + => + Plotly.NET.TraceObjects.CapFill.init( + + Fill: Fill.ToOption(), + Show: Show.ToOption() + ); + + public static Plotly.NET.TraceObjects.Caps InitCaps + ( + Optional X = default, + Optional Y = default, + Optional Z = default + ) + => + Plotly.NET.TraceObjects.Caps.init( + + X: X.ToOption(), + Y: Y.ToOption(), + Z: Z.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Contours.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Contours.cs new file mode 100644 index 000000000..e23120f76 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Contours.cs @@ -0,0 +1,88 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.ContourProject InitContourProject + ( + + Optional X = default, + Optional Y = default, + Optional Z = default + ) + + => + Plotly.NET.TraceObjects.ContourProject.init( + + X: X.ToOption(), + Y: Y.ToOption(), + Z: Z.ToOption() + ); + + public static Plotly.NET.TraceObjects.Contour InitContour + ( + Optional Color = default, + Optional End = default, + Optional Highlight = default, + Optional HighlightColor = default, + Optional HighlightWidth = default, + Optional Project = default, + Optional Show = default, + Optional Size = default, + Optional Start = default, + Optional UseColorMap = default, + Optional Width = default + ) + => + Plotly.NET.TraceObjects.Contour.init( + Color: Color.ToOption(), + End: End.ToOption(), + Highlight: Highlight.ToOption(), + HighlightColor: HighlightColor.ToOption(), + HighlightWidth: HighlightWidth.ToOption(), + Project: Project.ToOption(), + Show: Show.ToOption(), + Size: Size.ToOption(), + Start: Start.ToOption(), + UseColorMap: UseColorMap.ToOption(), + Width: Width.ToOption() + ); + + public static Plotly.NET.TraceObjects.Contours InitContours + ( + Optional Coloring = default, + Optional End = default, + Optional LabelFont = default, + Optional LabelFormat = default, + Optional Operation = default, + Optional ShowLabels = default, + Optional ShowLines = default, + Optional Size = default, + Optional Start = default, + Optional Type = default, + Optional Value = default + ) + where ValueType: IConvertible + => + Plotly.NET.TraceObjects.Contours.init( + Coloring: Coloring.ToOption(), + End: End.ToOption(), + LabelFont: LabelFont.ToOption(), + LabelFormat: LabelFormat.ToOption(), + Operation: Operation.ToOption(), + ShowLabels: ShowLabels.ToOption(), + ShowLines: ShowLines.ToOption(), + Size: Size.ToOption(), + Start: Start.ToOption(), + Type: Type.ToOption(), + Value: Value.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Cumulative.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Cumulative.cs new file mode 100644 index 000000000..c3e4ce2b7 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Cumulative.cs @@ -0,0 +1,26 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Cumulative InitCumulative + ( + Optional Enabled = default, + Optional Direction = default, + Optional Currentbin = default + ) + => + Plotly.NET.TraceObjects.Cumulative.init( + Enabled: Enabled.ToOption(), + Direction: Direction.ToOption(), + Currentbin: Currentbin.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Dimensions.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Dimensions.cs new file mode 100644 index 000000000..f197ba9b9 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Dimensions.cs @@ -0,0 +1,70 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection.Emit; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Dimension InitParallelDimension + ( + Optional ConstraintRange = default, + Optional Label = default, + Optional MultiSelect = default, + Optional Name = default, + Optional Range = default, + Optional TemplateItemName = default, + Optional TickFormat = default, + Optional> TickText = default, + Optional> Tickvals = default, + Optional> Values = default, + Optional Visible = default + ) + where LabelType : IConvertible + where TickType : IConvertible + where ValuesType : IConvertible + => + Plotly.NET.TraceObjects.Dimension.initParallel( + ConstraintRange: ConstraintRange.ToOption(), + Label: Label.ToOption(), + MultiSelect: MultiSelect.ToOption(), + Name: Name.ToOption(), + Range: Range.ToOption(), + TemplateItemName: TemplateItemName.ToOption(), + TickFormat: TickFormat.ToOption(), + TickText: TickText.ToOption(), + Tickvals: Tickvals.ToOption(), + Values: Values.ToOption(), + Visible: Visible.ToOption() + ); + + public static Plotly.NET.TraceObjects.Dimension InitSplomDimension + ( + Optional AxisMatches = default, + Optional AxisType = default, + Optional Label = default, + Optional Name = default, + Optional TemplateItemName = default, + Optional> Values = default, + Optional Visible = default + ) + where LabelType : IConvertible + where ValuesType : IConvertible + => + Plotly.NET.TraceObjects.Dimension.initSplom( + AxisMatches: AxisMatches.ToOption(), + AxisType: AxisType.ToOption(), + Label: Label.ToOption(), + Name: Name.ToOption(), + TemplateItemName: TemplateItemName.ToOption(), + Values: Values.ToOption(), + Visible: Visible.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Error.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Error.cs new file mode 100644 index 000000000..90fc52569 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Error.cs @@ -0,0 +1,48 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Error InitError + ( + Optional Visible = default, + Optional Type = default, + Optional Symmetric = default, + Optional> Array = default, + Optional> Arrayminus = default, + Optional Value = default, + Optional Valueminus = default, + Optional Traceref = default, + Optional Tracerefminus = default, + Optional Copy_ystyle = default, + Optional Color = default, + Optional Thickness = default, + Optional Width = default + ) + where ArrayType: IConvertible + where ArrayminusType: IConvertible + => + Plotly.NET.TraceObjects.Error.init( + Visible: Visible.ToOption(), + Type: Type.ToOption(), + Symmetric: Symmetric.ToOption(), + Array: Array.ToOption(), + Arrayminus: Arrayminus.ToOption(), + Value: Value.ToOption(), + Valueminus: Valueminus.ToOption(), + Traceref: Traceref.ToOption(), + Tracerefminus: Tracerefminus.ToOption(), + Copy_ystyle: Copy_ystyle.ToOption(), + Color: Color.ToOption(), + Thickness: Thickness.ToOption(), + Width: Width.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/FinanceMarker.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/FinanceMarker.cs new file mode 100644 index 000000000..d475a8e0f --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/FinanceMarker.cs @@ -0,0 +1,28 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.FinanceMarker InitFinanceMarker + ( + Optional MarkerColor = default, + Optional LineColor = default, + Optional LineWidth = default, + Optional LineDash = default + ) + => + Plotly.NET.TraceObjects.FinanceMarker.init( + MarkerColor: MarkerColor.ToOption(), + LineColor: LineColor.ToOption(), + LineWidth: LineWidth.ToOption(), + LineDash: LineDash.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/FunnelConnector.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/FunnelConnector.cs new file mode 100644 index 000000000..5ac39e987 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/FunnelConnector.cs @@ -0,0 +1,27 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.FunnelConnector InitFunnelConnector + ( + Optional FillColor = default, + Optional Line = default, + Optional Visible = default + ) + => + Plotly.NET.TraceObjects.FunnelConnector.init( + + FillColor: FillColor.ToOption(), + Line: Line.ToOption(), + Visible: Visible.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Gradient.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Gradient.cs new file mode 100644 index 000000000..b30f182f1 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Gradient.cs @@ -0,0 +1,26 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Gradient InitGradient + ( + Optional Color = default, + Optional Type = default, + Optional> MultiTypes = default + ) + => + Plotly.NET.TraceObjects.Gradient.init( + Color: Color.ToOption(), + Type: Type.ToOption(), + MultiTypes: MultiTypes.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Icicle.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Icicle.cs new file mode 100644 index 000000000..d2efb44aa --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Icicle.cs @@ -0,0 +1,47 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.IcicleRoot InitIcicleRoot + ( + Optional Color = default + ) + => + Plotly.NET.TraceObjects.IcicleRoot.init( + Color: Color.ToOption() + ); + + public static Plotly.NET.TraceObjects.IcicleLeaf InitIcicleLeaf + ( + Optional Opacity = default + ) + => + Plotly.NET.TraceObjects.IcicleLeaf.init( + Opacity: Opacity.ToOption() + ); + + public static Plotly.NET.TraceObjects.IcicleTiling InitIcicleTiling + ( + + Optional Flip = default, + Optional Orientation = default, + Optional Pad = default + ) + + => + Plotly.NET.TraceObjects.IcicleTiling.init( + + Flip: Flip.ToOption(), + Orientation: Orientation.ToOption(), + Pad: Pad.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Indicator.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Indicator.cs new file mode 100644 index 000000000..80f33aee6 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Indicator.cs @@ -0,0 +1,125 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.IndicatorSymbol InitIndicatorSymbol + ( + Optional Color = default, + Optional Symbol = default + ) + => + Plotly.NET.TraceObjects.IndicatorSymbol.init( + Color: Color.ToOption(), + Symbol: Symbol.ToOption() + ); + public static Plotly.NET.TraceObjects.IndicatorDelta InitIndicatorDelta + ( + Optional Decreasing = default, + Optional Font = default, + Optional Increasing = default, + Optional Position = default, + Optional Reference = default, + Optional Relative = default, + Optional ValueFormat = default + ) + where ReferenceType: IConvertible + => + Plotly.NET.TraceObjects.IndicatorDelta.init( + Decreasing: Decreasing.ToOption(), + Font: Font.ToOption(), + Increasing: Increasing.ToOption(), + Position: Position.ToOption(), + Reference: Reference.ToOption(), + Relative: Relative.ToOption(), + ValueFormat: ValueFormat.ToOption() + ); + public static Plotly.NET.TraceObjects.IndicatorNumber InitIndicatorNumber + ( + Optional Font = default, + Optional Prefix = default, + Optional Suffix = default, + Optional ValueFormat = default + ) + + => + Plotly.NET.TraceObjects.IndicatorNumber.init( + Font: Font.ToOption(), + Prefix: Prefix.ToOption(), + Suffix: Suffix.ToOption(), + ValueFormat: ValueFormat.ToOption() + ); + public static Plotly.NET.TraceObjects.IndicatorBar InitIndicatorBar + ( + Optional Color = default, + Optional Line = default, + Optional Thickness = default + ) + => + Plotly.NET.TraceObjects.IndicatorBar.init( + Color: Color.ToOption(), + Line: Line.ToOption(), + Thickness: Thickness.ToOption() + ); + public static Plotly.NET.TraceObjects.IndicatorStep InitIndicatorStep + ( + Optional Color = default, + Optional Line = default, + Optional Name = default, + Optional Range = default, + Optional TemplateItemName = default, + Optional Thickness = default + ) + => + Plotly.NET.TraceObjects.IndicatorStep.init( + Color: Color.ToOption(), + Line: Line.ToOption(), + Name: Name.ToOption(), + Range: Range.ToOption(), + TemplateItemName: TemplateItemName.ToOption(), + Thickness: Thickness.ToOption() + ); + public static Plotly.NET.TraceObjects.IndicatorThreshold InitIndicatorThreshold + ( + Optional Line = default, + Optional Thickness = default, + Optional Value = default + ) + where ValueType: IConvertible + => + Plotly.NET.TraceObjects.IndicatorThreshold.init( + Line: Line.ToOption(), + Thickness: Thickness.ToOption(), + Value: Value.ToOption() + ); + public static Plotly.NET.TraceObjects.IndicatorGauge InitIndicatorGauge + ( + Optional Axis = default, + Optional Bar = default, + Optional BGColor = default, + Optional BorderColor = default, + Optional BorderWidth = default, + Optional Shape = default, + Optional> Steps = default, + Optional Threshold = default + ) + => + Plotly.NET.TraceObjects.IndicatorGauge.init( + Axis: Axis.ToOption(), + Bar: Bar.ToOption(), + BGColor: BGColor.ToOption(), + BorderColor: BorderColor.ToOption(), + BorderWidth: BorderWidth.ToOption(), + Shape: Shape.ToOption(), + Steps: Steps.ToOption(), + Threshold: Threshold.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Lighting.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Lighting.cs new file mode 100644 index 000000000..54261950e --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Lighting.cs @@ -0,0 +1,46 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Lighting InitLighting + ( + Optional Ambient = default, + Optional Diffuse = default, + Optional FaceNormalEpsilon = default, + Optional Fresnel = default, + Optional Roughness = default, + Optional Specular = default, + Optional VertexNormalEpsilon = default + ) + => + Plotly.NET.TraceObjects.Lighting.init( + Ambient: Ambient.ToOption(), + Diffuse: Diffuse.ToOption(), + FaceNormalEpsilon: FaceNormalEpsilon.ToOption(), + Fresnel: Fresnel.ToOption(), + Roughness: Roughness.ToOption(), + Specular: Specular.ToOption(), + VertexNormalEpsilon: VertexNormalEpsilon.ToOption() + ); + public static Plotly.NET.TraceObjects.LightPosition InitLightPosition + ( + Optional X = default, + Optional Y = default, + Optional Z = default + ) + => + Plotly.NET.TraceObjects.LightPosition.init( + X: X.ToOption(), + Y: Y.ToOption(), + Z: Z.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Marker.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Marker.cs new file mode 100644 index 000000000..7f162a2fe --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Marker.cs @@ -0,0 +1,78 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Marker InitMarker + ( + Optional AutoColorScale = default, + Optional CAuto = default, + Optional CMax = default, + Optional CMid = default, + Optional CMin = default, + Optional Color = default, + Optional> Colors = default, + Optional ColorAxis = default, + Optional ColorBar = default, + Optional Colorscale = default, + Optional Gradient = default, + Optional Outline = default, + Optional MaxDisplayed = default, + Optional Opacity = default, + Optional> MultiOpacity = default, + Optional Pattern = default, + Optional ReverseScale = default, + Optional ShowScale = default, + Optional Size = default, + Optional> MultiSize = default, + Optional SizeMin = default, + Optional SizeMode = default, + Optional SizeRef = default, + Optional Symbol = default, + Optional> MultiSymbol = default, + Optional Symbol3D = default, + Optional> MultiSymbol3D = default, + Optional OutlierColor = default, + Optional OutlierWidth = default + ) + => + Plotly.NET.TraceObjects.Marker.init( + AutoColorScale: AutoColorScale.ToOption(), + CAuto: CAuto.ToOption(), + CMax: CMax.ToOption(), + CMid: CMid.ToOption(), + CMin: CMin.ToOption(), + Color: Color.ToOption(), + Colors: Colors.ToOption(), + ColorAxis: ColorAxis.ToOption(), + ColorBar: ColorBar.ToOption(), + Colorscale: Colorscale.ToOption(), + Gradient: Gradient.ToOption(), + Outline: Outline.ToOption(), + MaxDisplayed: MaxDisplayed.ToOption(), + Opacity: Opacity.ToOption(), + MultiOpacity: MultiOpacity.ToOption(), + Pattern: Pattern.ToOption(), + ReverseScale: ReverseScale.ToOption(), + ShowScale: ShowScale.ToOption(), + Size: Size.ToOption(), + MultiSize: MultiSize.ToOption(), + SizeMin: SizeMin.ToOption(), + SizeMode: SizeMode.ToOption(), + SizeRef: SizeRef.ToOption(), + Symbol: Symbol.ToOption(), + MultiSymbol: MultiSymbol.ToOption(), + Symbol3D: Symbol3D.ToOption(), + MultiSymbol3D: MultiSymbol3D.ToOption(), + OutlierColor: OutlierColor.ToOption(), + OutlierWidth: OutlierWidth.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/MeanLine.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/MeanLine.cs new file mode 100644 index 000000000..b38711c15 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/MeanLine.cs @@ -0,0 +1,26 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.MeanLine InitMeanLine + ( + Optional Visible = default, + Optional Color = default, + Optional Width = default + ) + => + Plotly.NET.TraceObjects.MeanLine.init( + Visible: Visible.ToOption(), + Color: Color.ToOption(), + Width: Width.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Pathbar.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Pathbar.cs new file mode 100644 index 000000000..933bc47fd --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Pathbar.cs @@ -0,0 +1,30 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Pathbar InitPathbar + ( + Optional Visible = default, + Optional Side = default, + Optional EdgeShape = default, + Optional Thickness = default, + Optional Textfont = default + ) + => + Plotly.NET.TraceObjects.Pathbar.init( + Visible: Visible.ToOption(), + Side: Side.ToOption(), + EdgeShape: EdgeShape.ToOption(), + Thickness: Thickness.ToOption(), + Textfont: Textfont.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Pattern.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Pattern.cs new file mode 100644 index 000000000..987ad8729 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Pattern.cs @@ -0,0 +1,38 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Pattern InitPattern + ( + Optional BGColor = default, + Optional FGColor = default, + Optional FGOpacity = default, + Optional FillMode = default, + Optional Shape = default, + Optional> MultiShape = default, + Optional Size = default, + Optional> MultiSize = default, + Optional Solidity = default + ) + => + Plotly.NET.TraceObjects.Pattern.init( + BGColor: BGColor.ToOption(), + FGColor: FGColor.ToOption(), + FGOpacity: FGOpacity.ToOption(), + FillMode: FillMode.ToOption(), + Shape: Shape.ToOption(), + MultiShape: MultiShape.ToOption(), + Size: Size.ToOption(), + MultiSize: MultiSize.ToOption(), + Solidity: Solidity.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Projection.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Projection.cs new file mode 100644 index 000000000..38cc6f844 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Projection.cs @@ -0,0 +1,38 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.ProjectionDimension InitProjectionDimension + ( + Optional Opacity = default, + Optional Scale = default, + Optional Show = default + ) + => + Plotly.NET.TraceObjects.ProjectionDimension.init( + Opacity: Opacity.ToOption(), + Scale: Scale.ToOption(), + Show: Show.ToOption() + ); + public static Plotly.NET.TraceObjects.Projection InitProjection + ( + Optional X = default, + Optional Y = default, + Optional Z = default + ) + => + Plotly.NET.TraceObjects.Projection.init( + X: X.ToOption(), + Y: Y.ToOption(), + Z: Z.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Sankey.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Sankey.cs new file mode 100644 index 000000000..b06eedea2 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Sankey.cs @@ -0,0 +1,99 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.SankeyNodes InitSankeyNodes + ( + Optional Color = default, + Optional> CustomData = default, + Optional>> Groups = default, + Optional HoverInfo = default, + Optional HoverLabel = default, + Optional HoverTemplate = default, + Optional> MultiHoverTemplate = default, + Optional> Label = default, + Optional Line = default, + Optional Pad = default, + Optional Thickness = default, + Optional> X = default, + Optional> Y = default + ) + where CustomDataType: IConvertible + where XType: IConvertible + where YType: IConvertible + => + Plotly.NET.TraceObjects.SankeyNodes.init( + Color: Color.ToOption(), + CustomData: CustomData.ToOption(), + Groups: Groups.ToOption(), + HoverInfo: HoverInfo.ToOption(), + HoverLabel: HoverLabel.ToOption(), + HoverTemplate: HoverTemplate.ToOption(), + MultiHoverTemplate: MultiHoverTemplate.ToOption(), + Label: Label.ToOption(), + Line: Line.ToOption(), + Pad: Pad.ToOption(), + Thickness: Thickness.ToOption(), + X: X.ToOption(), + Y: Y.ToOption() + ); + public static Plotly.NET.TraceObjects.SankeyLinkColorscale InitSankeyLinkColorscale + ( + Optional CMax = default, + Optional CMin = default, + Optional ColorScale = default, + Optional Label = default, + Optional Name = default, + Optional TemplateItemName = default + ) + => + Plotly.NET.TraceObjects.SankeyLinkColorscale.init( + CMax: CMax.ToOption(), + CMin: CMin.ToOption(), + ColorScale: ColorScale.ToOption(), + Label: Label.ToOption(), + Name: Name.ToOption(), + TemplateItemName: TemplateItemName.ToOption() + ); + public static Plotly.NET.TraceObjects.SankeyLinks InitSankeyLinks + ( + Optional Color = default, + Optional> ColorScales = default, + Optional> CustomData = default, + Optional HoverInfo = default, + Optional HoverLabel = default, + Optional HoverTemplate = default, + Optional> MultiHoverTemplate = default, + Optional> Label = default, + Optional Line = default, + Optional> Source = default, + Optional> Target = default, + Optional> Value = default + ) + where CustomDataType: IConvertible + where ValueType: IConvertible + => + Plotly.NET.TraceObjects.SankeyLinks.init( + Color: Color.ToOption(), + ColorScales: ColorScales.ToOption(), + CustomData: CustomData.ToOption(), + HoverInfo: HoverInfo.ToOption(), + HoverLabel: HoverLabel.ToOption(), + HoverTemplate: HoverTemplate.ToOption(), + MultiHoverTemplate: MultiHoverTemplate.ToOption(), + Label: Label.ToOption(), + Line: Line.ToOption(), + Source: Source.ToOption(), + Target: Target.ToOption(), + Value: Value.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Selection.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Selection.cs new file mode 100644 index 000000000..b587cd01d --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Selection.cs @@ -0,0 +1,44 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.MarkerSelectionStyle InitMarkerSelectionStyle + ( + Optional Opacity = default, + Optional Color = default, + Optional Size = default + ) + => + Plotly.NET.TraceObjects.MarkerSelectionStyle.init( + Opacity: Opacity.ToOption(), + Color: Color.ToOption(), + Size: Size.ToOption() + ); + public static Plotly.NET.TraceObjects.FontSelectionStyle InitFontSelectionStyle + ( + Optional Color = default + ) + => + Plotly.NET.TraceObjects.FontSelectionStyle.init( + Color: Color.ToOption() + ); + public static Plotly.NET.TraceObjects.Selection InitSelection + ( + Optional MarkerSelectionStyle = default, + Optional FontSelectionStyle = default + ) + => + Plotly.NET.TraceObjects.Selection.init( + MarkerSelectionStyle: MarkerSelectionStyle.ToOption(), + FontSelectionStyle: FontSelectionStyle.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Slices.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Slices.cs new file mode 100644 index 000000000..4ff69e162 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Slices.cs @@ -0,0 +1,39 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.SlicesFill InitSlicesFill + ( + Optional Fill = default, + Optional> Locations = default, + Optional Show = default + ) + where LocationsType: IConvertible + => + Plotly.NET.TraceObjects.SlicesFill.init( + Fill: Fill.ToOption(), + Locations: Locations.ToOption(), + Show: Show.ToOption() + ); + public static Plotly.NET.TraceObjects.Slices InitSlices + ( + Optional X = default, + Optional Y = default, + Optional Z = default + ) + => + Plotly.NET.TraceObjects.Slices.init( + X: X.ToOption(), + Y: Y.ToOption(), + Z: Z.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/SpaceFrame.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/SpaceFrame.cs new file mode 100644 index 000000000..d49d53f55 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/SpaceFrame.cs @@ -0,0 +1,24 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Spaceframe InitSpaceframe + ( + Optional Fill = default, + Optional Show = default + ) + => + Plotly.NET.TraceObjects.Spaceframe.init( + Fill: Fill.ToOption(), + Show: Show.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/SplomDiagonal.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/SplomDiagonal.cs new file mode 100644 index 000000000..53a43225d --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/SplomDiagonal.cs @@ -0,0 +1,22 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.SplomDiagonal InitSplomDiagonal + ( + Optional Visible = default + ) + => + Plotly.NET.TraceObjects.SplomDiagonal.init( + Visible: Visible.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/StreamTubeStarts.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/StreamTubeStarts.cs new file mode 100644 index 000000000..c97b12606 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/StreamTubeStarts.cs @@ -0,0 +1,29 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.StreamTubeStarts InitStreamTubeStarts + ( + Optional> X = default, + Optional> Y = default, + Optional> Z = default + ) + where XType: IConvertible + where YType: IConvertible + where ZType: IConvertible + => + Plotly.NET.TraceObjects.StreamTubeStarts.init( + X: X.ToOption(), + Y: Y.ToOption(), + Z: Z.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Sunburst.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Sunburst.cs new file mode 100644 index 000000000..2a7c93927 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Sunburst.cs @@ -0,0 +1,30 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.SunburstRoot InitSunburstRoot + ( + Optional Color = default + ) + => + Plotly.NET.TraceObjects.SunburstRoot.init( + Color: Color.ToOption() + ); + public static Plotly.NET.TraceObjects.SunburstLeaf InitSunburstLeaf + ( + Optional Opacity = default + ) + => + Plotly.NET.TraceObjects.SunburstLeaf.init( + Opacity: Opacity.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Surface.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Surface.cs new file mode 100644 index 000000000..2768099b5 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Surface.cs @@ -0,0 +1,28 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.Surface InitSurface + ( + Optional Count = default, + Optional Fill = default, + Optional Pattern = default, + Optional Show = default + ) + => + Plotly.NET.TraceObjects.Surface.init( + Count: Count.ToOption(), + Fill: Fill.ToOption(), + Pattern: Pattern.ToOption(), + Show: Show.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Table.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Table.cs new file mode 100644 index 000000000..676ebd3d8 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Table.cs @@ -0,0 +1,53 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.TableFill InitTableFill + ( + Optional Color = default + ) + => + Plotly.NET.TraceObjects.TableFill.init( + Color: Color.ToOption() + ); + public static Plotly.NET.TraceObjects.TableCells InitTableCells + ( + Optional Align = default, + Optional> MultiAlign = default, + Optional Fill = default, + Optional Font = default, + Optional> Format = default, + Optional Height = default, + Optional Line = default, + Optional Prefix = default, + Optional> MultiPrefix = default, + Optional Suffix = default, + Optional> MultiSuffix = default, + Optional>> Values = default + ) + where ValuesType: IConvertible + => + Plotly.NET.TraceObjects.TableCells.init, ValuesType>( + Align: Align.ToOption(), + MultiAlign: MultiAlign.ToOption(), + Fill: Fill.ToOption(), + Font: Font.ToOption(), + Format: Format.ToOption(), + Height: Height.ToOption(), + Line: Line.ToOption(), + Prefix: Prefix.ToOption(), + MultiPrefix: MultiPrefix.ToOption(), + Suffix: Suffix.ToOption(), + MultiSuffix: MultiSuffix.ToOption(), + Values: Values.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Treemap.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Treemap.cs new file mode 100644 index 000000000..7de72bf78 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/Treemap.cs @@ -0,0 +1,44 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.TreemapRoot InitTreemapRoot + ( + Optional Color = default + ) + => + Plotly.NET.TraceObjects.TreemapRoot.init( + Color: Color.ToOption() + ); + public static Plotly.NET.TraceObjects.TreemapLeaf InitTreemapLeaf + ( + Optional Opacity = default + ) + => + Plotly.NET.TraceObjects.TreemapLeaf.init( + Opacity: Opacity.ToOption() + ); + public static Plotly.NET.TraceObjects.TreemapTiling InitTreemapTiling + ( + Optional Packing = default, + Optional SquarifyRatio = default, + Optional Flip = default, + Optional Pad = default + ) + => + Plotly.NET.TraceObjects.TreemapTiling.init( + Packing: Packing.ToOption(), + SquarifyRatio: SquarifyRatio.ToOption(), + Flip: Flip.ToOption(), + Pad: Pad.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/WaterfallConnector.cs b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/WaterfallConnector.cs new file mode 100644 index 000000000..d057ca522 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/WaterfallConnector.cs @@ -0,0 +1,26 @@ + +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.WaterfallConnector InitWaterfallConnector + ( + Optional Line = default, + Optional Visible = default, + Optional ConnectorMode = default + ) + => + Plotly.NET.TraceObjects.WaterfallConnector.init( + Line: Line.ToOption(), + Visible: Visible.ToOption(), + ConnectorMode: ConnectorMode.ToOption() + ); +} + diff --git a/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/traceobject-codegen.fsx b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/traceobject-codegen.fsx new file mode 100644 index 000000000..de7f53473 --- /dev/null +++ b/src/Plotly.NET.CSharp/ObjectAbstractions/TraceObjects/traceobject-codegen.fsx @@ -0,0 +1,233 @@ +open System.IO +open System.Text +open System.Text.RegularExpressions + +let mapFSharpType (typeName:string) = + typeName + .Replace("float","double") + .Replace("seq","IEnumerable") + + +let class_template = """public static partial class TraceObjects +{ + public static Plotly.NET.TraceObjects.[OBJECT_NAME] Init[OBJECT_NAME][GENERICS] + ( +[MANDATORY_PARAMS] +[OPTIONAL_PARAMS] + ) +[GENERICS_ANNOTATIONS] + Plotly.NET.TraceObjects.[OBJECT_NAME].init( +[MANDATORY_PARAMS_SETTERS] +[OPTIONAL_PARAMS_SETTERS] + ); +} +""" + +type TraceObjectAbstraction = { + ObjectName: string + MandatoryParams: (string*string) list + OptionalParams: (string*string) list + Generics: string list +} with + static member create name (m: (string*string) list) (o: (string*string) list) = + + let generics = + List.concat [m; o] + |> List.filter (fun (pName, pType) -> pType.Contains("#IConvertible")) + |> List.map fst + |> List.map (fun pName -> pName, $"{pName}Type") + |> Map.ofList + + let csharpMandatoryParams = + m + |> List.map (fun (pName, pType) -> pName, mapFSharpType pType) + |> List.map (fun (pName, pType) -> + pName, + if pType.Contains("#IConvertible") then + pType.Replace("#IConvertible", generics[pName]) + else + pType + ) + let csharpOptionalyParams = + o + |> List.map (fun (pName, pType) -> pName, mapFSharpType pType) + |> List.map (fun (pName, pType) -> + pName, + if pType.Contains("#IConvertible") then + pType.Replace("#IConvertible", generics[pName]) + else + pType + ) + + { + ObjectName = name + MandatoryParams = csharpMandatoryParams + OptionalParams = csharpOptionalyParams + Generics = generics.Values |> List.ofSeq + } + + static member toClassTemplate (tObj: TraceObjectAbstraction) = + + let mParams = + tObj.MandatoryParams + |> List.map (fun (pName, pType) -> $" {pType} {pName}") + |> String.concat $",{System.Environment.NewLine}" + + let mParamSetters = + tObj.MandatoryParams + |> List.map (fun (pName, _) -> $" {pName}: {pName}") + |> String.concat $",{System.Environment.NewLine}" + + let optParams = + tObj.OptionalParams + |> List.map (fun (pName, pType) -> $" Optional<{pType}> {pName} = default") + |> String.concat $",{System.Environment.NewLine}" + + let optParamsSetters = + tObj.OptionalParams + |> List.map (fun (pName, pType) -> $" {pName}: {pName}.ToOption()") + |> String.concat $",{System.Environment.NewLine}" + + let generics = + if tObj.Generics.IsEmpty then + $"" + else + let g = tObj.Generics |> String.concat ", " + $"<{g}>" + + let genericsAnnotations = + if tObj.Generics.IsEmpty then + $"{System.Environment.NewLine} =>" + else + let g = + tObj.Generics + |> List.map (fun generic -> $" where {generic}: IConvertible") + |> String.concat System.Environment.NewLine + $"{g}{System.Environment.NewLine} =>" + + class_template + .Replace("[OBJECT_NAME]", tObj.ObjectName) + .Replace("[MANDATORY_PARAMS]", mParams) + .Replace("[OPTIONAL_PARAMS]", optParams) + .Replace("[MANDATORY_PARAMS_SETTERS]", mParamSetters) + .Replace("[OPTIONAL_PARAMS_SETTERS]", optParamsSetters) + .Replace("[GENERICS]", generics) + .Replace("[GENERICS_ANNOTATIONS]", genericsAnnotations) + +let objectNameRegex = new Regex("type (?[A-Za-z]*)()") + +let getObjectName (str:string) = + let m = objectNameRegex.Match(str) + m.Groups.Item("objectName").Value + +let paramRegex = new Regex("(?\S*):\s*(?[^,]*)") + +let getParam (str:string) = + let m = paramRegex.Match(str) + m.Groups.Item("pName").Value, + m.Groups.Item("pType").Value + +let optParamRegex = new Regex("\?(?\S*):\s*(?[^,]*)") + +let getOptParam (str:string) = + let m = optParamRegex.Match(str) + m.Groups.Item("pName").Value, + m.Groups.Item("pType").Value + +let parseSourceFile (path:string) = + let rec loop (lines: string list) (isFirstObj: bool) (isInit: bool) (currentName: string) (mParams: (string*string) list) (oParams: (string*string) list) (acc: TraceObjectAbstraction list) = + match lines with + | line::rest -> + match line with + | objectName when line.StartsWith("type") -> + let name = getObjectName objectName + if isFirstObj then + loop rest false isInit name mParams oParams acc + else + loop rest isFirstObj isInit name [] [] ((TraceObjectAbstraction.create currentName (List.rev mParams) (List.rev oParams)) :: acc) + + | init when init.Trim() = "static member init" -> + printfn "is init" + loop rest isFirstObj true currentName mParams oParams acc + + | inlineInit when inlineInit.Trim().StartsWith("static member init(") -> + + if inlineInit.Contains("[ + printfn "is other member" + loop rest isFirstObj false currentName mParams oParams acc + + | bodyStart when + bodyStart.Trim().StartsWith("(") -> + printfn "is body start" + loop rest isFirstObj isInit currentName mParams oParams acc + + | bodyEnd when + bodyEnd.Trim().StartsWith(") =") -> + printfn "is body end" + loop rest isFirstObj false currentName mParams oParams acc + + | optParam when isInit && optParam.Trim().StartsWith("[ + printfn "is opt param" + loop rest isFirstObj isInit currentName mParams ((getOptParam optParam) :: oParams) acc + + | param when isInit -> + + printfn "is param" + loop rest isFirstObj isInit currentName ((getParam param) :: mParams) oParams acc + + | _ -> loop rest isFirstObj isInit currentName mParams oParams acc + + | [] -> (TraceObjectAbstraction.create currentName (List.rev mParams) (List.rev oParams))::acc |> List.rev + + loop (File.ReadAllLines path |> List.ofArray) true false "" [] [] [] + + +let file_template = """ +using Microsoft.FSharp.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Plotly.NET.CSharp; + +[CLASSES] +""" + +let createCSharpSourceFile (objectAbstractions: TraceObjectAbstraction list) = + let classes = + objectAbstractions + |> List.map TraceObjectAbstraction.toClassTemplate + |> String.concat System.Environment.NewLine + + file_template.Replace("[CLASSES]",classes) + +let indicator = parseSourceFile @"C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET\Traces\ObjectAbstractions\Indicator.fs" + +createCSharpSourceFile indicator + +let sourceFiles = + Directory.EnumerateFiles @"C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET\Traces\ObjectAbstractions\" + |> Seq.cast + |> Array.ofSeq + +let targetFiles = + sourceFiles + |> Array.map (fun path -> + path + .Replace(@"C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET\Traces\ObjectAbstractions\", @"C:\Users\schne\source\repos\plotly\Plotly.NET\src\Plotly.NET.CSharp\ObjectAbstractions\TraceObjects\") + .Replace(".fs", ".cs") + ) +Array.zip sourceFiles targetFiles +|> Array.iter (fun (source, target) -> + let classes = parseSourceFile source + let targetFile = createCSharpSourceFile classes + File.WriteAllText(target, targetFile) +) \ No newline at end of file diff --git a/tests/Plotly.NET.Tests.CSharpConsole/Program.cs b/tests/Plotly.NET.Tests.CSharpConsole/Program.cs index 6a8fc62f8..5c3a9902d 100644 --- a/tests/Plotly.NET.Tests.CSharpConsole/Program.cs +++ b/tests/Plotly.NET.Tests.CSharpConsole/Program.cs @@ -740,23 +740,23 @@ static void Main(string[] args) ), Chart.ParallelCoord( dimensions: new Plotly.NET.TraceObjects.Dimension [] { - Plotly.NET.TraceObjects.Dimension.initParallel(Label: "A", Values: new int [] {1, 4, 3}), - Plotly.NET.TraceObjects.Dimension.initParallel(Label: "B", Values: new int [] {3, 1, 2}) + TraceObjects.InitParallelDimension(Label: "A", Values: new int [] {1, 4, 3}), + TraceObjects.InitParallelDimension(Label: "B", Values: new int [] {3, 1, 2}) }, Name: "parcoords" ), Chart.ParallelCategories( dimensions: new Plotly.NET.TraceObjects.Dimension [] { - Plotly.NET.TraceObjects.Dimension.initParallel(Label: "A", Values: new int [] {1, 1, 2}), - Plotly.NET.TraceObjects.Dimension.initParallel(Label: "B", Values: new int [] {3, 3, 3}) + TraceObjects.InitParallelDimension(Label: "A", Values: new int [] {1, 1, 2}), + TraceObjects.InitParallelDimension(Label: "B", Values: new int [] {3, 3, 3}) }, Name: "parcats" ), Chart.Sankey( - nodes: Plotly.NET.TraceObjects.SankeyNodes.init( + nodes: TraceObjects.InitSankeyNodes( Label: new string [] {"A", "B", "C", "D"} ), - links: Plotly.NET.TraceObjects.SankeyLinks.init( + links: TraceObjects.InitSankeyLinks( Source: new int [] {0, 1, 1 }, Target: new int [] {2, 2, 3 }, Value: new int [] {1, 2, 5}