Skip to content

Commit bb11205

Browse files
committed
Add IMapZ interface
1 parent 191a857 commit bb11205

File tree

3 files changed

+358
-322
lines changed

3 files changed

+358
-322
lines changed

src/FSharp.Plotly/Chart.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ type Chart =
264264
static member Heatmap(data:seq<#seq<#IConvertible>>,?ColNames,?RowNames, ?Name,?Showlegend,?Opacity,?Colorscale,?Showscale,?zSmooth,?Colorbar) =
265265
let trace =
266266
Heatmap()
267-
|> Options.IColormap(Z=data,?X=ColNames, ?Y=RowNames,
268-
?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?Colorbar=Colorbar)
267+
|> Options.IMapZ(Z=data,?X=ColNames, ?Y=RowNames)
268+
|> Options.IColormap(?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?Colorbar=Colorbar)
269269
|> Options.ITraceInfo(?Name=Name,?Showlegend=Showlegend,?Opacity=Opacity)
270270
//|> Options.ITextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont)
271271
GenericChart.Chart (trace,None)
@@ -274,8 +274,8 @@ type Chart =
274274
static member Contour(data:seq<#seq<#IConvertible>>,?X,?Y, ?Name,?Showlegend,?Opacity,?Colorscale,?Showscale,?zSmooth,?Colorbar) =
275275
let trace =
276276
Contour()
277-
|> Options.IColormap(Z=data,?X=X, ?Y=Y,
278-
?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?Colorbar=Colorbar)
277+
|> Options.IMapZ(Z=data,?X=X, ?Y=Y)
278+
|> Options.IColormap(?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?Colorbar=Colorbar)
279279
|> Options.ITraceInfo(?Name=Name,?Showlegend=Showlegend,?Opacity=Opacity)
280280
//|> Options.ITextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont)
281281
GenericChart.Chart (trace,None)

src/FSharp.Plotly/Options.fs

Lines changed: 72 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,6 @@ type Options() =
612612
?Label0,
613613
?dLabel,
614614
?Marker,
615-
?Text, //: seq<#IConvertible>,
616-
?Textposition,//: StyleOption.TextPosition,
617615
?Scalegroup,
618616
?Textinfo,
619617
?Textfont: FontOptions,
@@ -627,8 +625,6 @@ type Options() =
627625
?Pull: float,
628626
?Labelssrc: string,
629627
?Valuessrc: string,
630-
?Textsrc: string,
631-
?Textpositionsrc,
632628
?Pullsrc
633629

634630
) =
@@ -638,10 +634,8 @@ type Options() =
638634
Labels |> Option.iter pie.set_labels
639635
Label0 |> Option.iter pie.set_label0
640636
dLabel |> Option.iter pie.set_dlabel//-- temporarily
641-
// Text |> Option.iter pie.set_text
642637
Scalegroup |> Option.iter pie.set_scalegroup
643-
Textinfo |> Option.iter pie.set_textinfo
644-
// Textposition |> Option.iter (StyleOption.TextPosition.toString >> pie.set_textposition) -- temporarily
638+
Textinfo |> Option.iter pie.set_textinfo
645639

646640
Domain |> Option.iter pie.set_domain
647641
Hole |> Option.iter pie.set_hole
@@ -651,8 +645,6 @@ type Options() =
651645
Pull |> Option.iter pie.set_pull
652646
Labelssrc |> Option.iter pie.set_labelssrc
653647
Valuessrc |> Option.iter pie.set_valuessrc
654-
// Textsrc |> Option.iter pie.set_textsrc -- temporarily
655-
// Textpositionsrc |> Option.iter pie.set_textpositionsrc -- temporarily
656648
Pullsrc |> Option.iter pie.set_pullsrc
657649

658650
// Update
@@ -715,29 +707,10 @@ type Options() =
715707
)
716708

717709

718-
// let mutable _z : seq<#seq<#System.IConvertible>> option = None
719-
// let mutable _x : seq<#System.IConvertible> option = None
720-
// let mutable _y : seq<#System.IConvertible> option = None
721-
// let mutable _transpose : bool option = None
722-
// let mutable _zauto : bool option = None
723-
// let mutable _zmin : float option = None
724-
// let mutable _zmax : float option = None
725-
// let mutable _colorscale : _ option = None
726-
// let mutable _autocolorscale : bool option = None
727-
// let mutable _reversescale : bool option = None
728-
// let mutable _showscale : bool option = None
729-
// let mutable _zsmooth : _ option = None
730-
// let mutable _colorbar : Colorbar option = None
731-
// let mutable _zsrc : string option = None
732-
// let mutable _xsrc : string option = None
733-
// let mutable _ysrc : string option = None
734-
735-
// // Applies the styles to TraceObjects with IColormap interface
710+
// Applies the styles to TraceObjects with IColormap interface
736711
static member IColormap
737712
(
738-
?Z : seq<#seq<#IConvertible>>,
739-
?X : seq<#IConvertible>,
740-
?Y : seq<#IConvertible>,
713+
741714
?Transpose ,
742715
?zAuto ,
743716
?zMin ,
@@ -747,16 +720,11 @@ type Options() =
747720
?Reversescale ,
748721
?Showscale ,
749722
?zSmooth ,
750-
?Colorbar ,
751-
?Zsrc ,
752-
?Xsrc ,
753-
?Ysrc
723+
?Colorbar
724+
754725
) =
755726
(fun (colorMap:('T :> IColormap)) ->
756-
757-
Z |> Option.iter colorMap.set_z
758-
X |> Option.iter colorMap.set_x
759-
Y |> Option.iter colorMap.set_y
727+
760728
Transpose |> Option.iter colorMap.set_transpose
761729
zAuto |> Option.iter colorMap.set_zauto
762730
zMin |> Option.iter colorMap.set_zmin
@@ -766,94 +734,99 @@ type Options() =
766734
Reversescale |> Option.iter colorMap.set_reversescale
767735
Showscale |> Option.iter colorMap.set_showscale
768736
zSmooth |> Option.iter (StyleOption.SmoothAlg.convert >> colorMap.set_zsmooth)
769-
Colorbar |> Option.iter colorMap.set_colorbar
770-
Zsrc |> Option.iter colorMap.set_zsrc
771-
Xsrc |> Option.iter colorMap.set_xsrc
772-
Ysrc |> Option.iter colorMap.set_ysrc
737+
Colorbar |> Option.iter colorMap.set_colorbar
773738

774739
// out ->
775740
colorMap
776741
)
777-
778-
779-
780-
// Applies the styles to Heatmap() and Contour()
781-
static member Colormap
742+
743+
// Applies the styles to TraceObjects with IMapZ interface
744+
static member IMapZ
782745
(
746+
?Z : seq<#seq<#IConvertible>>,
747+
?X : seq<#IConvertible>,
748+
?Y : seq<#IConvertible>,
783749
?X0 ,
784750
?dX ,
785751
?Y0 ,
786752
?dY ,
787753
?xType ,
788754
?yType ,
789-
?Connectgaps ,
790755
?xAxis ,
791-
?yAxis
756+
?yAxis ,
757+
?Zsrc ,
758+
?Xsrc ,
759+
?Ysrc
792760
) =
793761
(fun (colorMap:('T :> Colormap)) ->
794-
762+
763+
Z |> Option.iter colorMap.set_z
764+
X |> Option.iter colorMap.set_x
765+
Y |> Option.iter colorMap.set_y
795766
X0 |> Option.iter colorMap.set_x0
796767
dX |> Option.iter colorMap.set_dx
797768
Y0 |> Option.iter colorMap.set_y0
798769
dY |> Option.iter colorMap.set_dy
799770
xType |> Option.iter colorMap.set_xtype
800-
yType |> Option.iter colorMap.set_ytype
801-
Connectgaps |> Option.iter colorMap.set_connectgaps
771+
yType |> Option.iter colorMap.set_ytype
802772
xAxis |> Option.iter colorMap.set_xaxis
803773
yAxis |> Option.iter colorMap.set_yaxis
774+
Zsrc |> Option.iter colorMap.set_zsrc
775+
Xsrc |> Option.iter colorMap.set_xsrc
776+
Ysrc |> Option.iter colorMap.set_ysrc
804777

805778
// out ->
806779
colorMap
807780
)
808781

809782

810-
// Applies the styles to Histogram2d()
811-
static member Histogram2d
812-
(
813-
?TraceOptions:TraceOptions<_>,
814-
?Y,
815-
?X,
816-
?X0,
817-
?Y0,
818-
?Whiskerwidth,
819-
?Boxpoints,
820-
?Boxmean,
821-
?Jitter,
822-
?Pointpos,
823-
?Orientation,
824-
?Line : LineOptions,
825-
?Marker : MarkerOptions,
826-
?Fillcolor,
827-
?xAxis,
828-
?yAxis,
829-
?Ysrc,
830-
?Xsrc
831-
832-
) =
833-
(fun (boxPlot:('T :> Box)) ->
834-
835-
Y |> Option.iter boxPlot.set_y
836-
X |> Option.iter boxPlot.set_x
837-
X0 |> Option.iter boxPlot.set_x0
838-
Y0 |> Option.iter boxPlot.set_y0
839-
Whiskerwidth |> Option.iter boxPlot.set_whiskerwidth
840-
Boxpoints |> Option.iter (StyleOption.Boxpoints.convert >> boxPlot.set_boxpoints)
841-
Boxmean |> Option.iter (StyleOption.BoxMean.convert >> boxPlot.set_boxmean)
842-
Jitter |> Option.iter boxPlot.set_jitter
843-
Pointpos |> Option.iter boxPlot.set_pointpos
844-
Orientation |> Option.iter (StyleOption.Orientation.convert >> boxPlot.set_orientation)
845-
Fillcolor |> Option.iter boxPlot.set_fillcolor
846-
xAxis |> Option.iter boxPlot.set_xaxis
847-
yAxis |> Option.iter boxPlot.set_yaxis
848-
Ysrc |> Option.iter boxPlot.set_ysrc
849-
Xsrc |> Option.iter boxPlot.set_xsrc
850-
// Update
851-
Line |> Option.iter (updatePropertyValueAndIgnore boxPlot <@ boxPlot.line @>)
852-
Marker |> Option.iter (updatePropertyValueAndIgnore boxPlot <@ boxPlot.marker @>)
853-
854-
// out ->
855-
boxPlot |> (optApply TraceOptions)
856-
)
783+
// // Applies the styles to Histogram2d()
784+
// static member Histogram2d
785+
// (
786+
// ?TraceOptions:TraceOptions<_>,
787+
// ?Y,
788+
// ?X,
789+
// ?X0,
790+
// ?Y0,
791+
// ?Whiskerwidth,
792+
// ?Boxpoints,
793+
// ?Boxmean,
794+
// ?Jitter,
795+
// ?Pointpos,
796+
// ?Orientation,
797+
// ?Line : LineOptions,
798+
// ?Marker : MarkerOptions,
799+
// ?Fillcolor,
800+
// ?xAxis,
801+
// ?yAxis,
802+
// ?Ysrc,
803+
// ?Xsrc
804+
//
805+
// ) =
806+
// (fun (boxPlot:('T :> Box)) ->
807+
//
808+
// Y |> Option.iter boxPlot.set_y
809+
// X |> Option.iter boxPlot.set_x
810+
// X0 |> Option.iter boxPlot.set_x0
811+
// Y0 |> Option.iter boxPlot.set_y0
812+
// Whiskerwidth |> Option.iter boxPlot.set_whiskerwidth
813+
// Boxpoints |> Option.iter (StyleOption.Boxpoints.convert >> boxPlot.set_boxpoints)
814+
// Boxmean |> Option.iter (StyleOption.BoxMean.convert >> boxPlot.set_boxmean)
815+
// Jitter |> Option.iter boxPlot.set_jitter
816+
// Pointpos |> Option.iter boxPlot.set_pointpos
817+
// Orientation |> Option.iter (StyleOption.Orientation.convert >> boxPlot.set_orientation)
818+
// Fillcolor |> Option.iter boxPlot.set_fillcolor
819+
// xAxis |> Option.iter boxPlot.set_xaxis
820+
// yAxis |> Option.iter boxPlot.set_yaxis
821+
// Ysrc |> Option.iter boxPlot.set_ysrc
822+
// Xsrc |> Option.iter boxPlot.set_xsrc
823+
// // Update
824+
// Line |> Option.iter (updatePropertyValueAndIgnore boxPlot <@ boxPlot.line @>)
825+
// Marker |> Option.iter (updatePropertyValueAndIgnore boxPlot <@ boxPlot.marker @>)
826+
//
827+
// // out ->
828+
// boxPlot |> (optApply TraceOptions)
829+
// )
857830

858831

859832
// ######################## 3d-Charts

0 commit comments

Comments
 (0)