Skip to content

Commit c03cb5e

Browse files
author
bvenn
committed
moved Header, Cells, and Cellcolor to Table.fs
1 parent f6e5695 commit c03cb5e

File tree

7 files changed

+134
-144
lines changed

7 files changed

+134
-144
lines changed

src/FSharp.Plotly/Cellcolor.fs

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/FSharp.Plotly/Cells.fs

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/FSharp.Plotly/Chart.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,17 +579,17 @@ type Chart =
579579

580580
let CellFilling =
581581
match ColorCells with
582-
| Some color -> Some (CellColour.init (?Color=ColorCells))
582+
| Some color -> Some (CellColor.init (?Color=ColorCells))
583583
| Option.None -> Option.None
584584

585585
let HeaderFilling =
586586
match ColorHeader with
587-
| Some color -> Some (CellColour.init (?Color=ColorHeader))
587+
| Some color -> Some (CellColor.init (?Color=ColorHeader))
588588
| Option.None -> Option.None
589589

590590
TraceStyle.Table (
591-
Header = Header.init (headerValues|> Seq.map seq, ?Align=AlignHeader, ?Fill=HeaderFilling, ?Font=FontHeader, ?Height=HeightHeader, ?Line=LineHeader),
592-
Cells = Cells.init(cellValues |> Seq.transpose, ?Align=AlignCells, ?Fill=CellFilling, ?Font=FontCells, ?Height=HeightCells, ?Line=LineCells),
591+
Header = TableHeader.init (headerValues|> Seq.map seq, ?Align=AlignHeader, ?Fill=HeaderFilling, ?Font=FontHeader, ?Height=HeightHeader, ?Line=LineHeader),
592+
Cells = TableCells.init(cellValues |> Seq.transpose, ?Align=AlignCells, ?Fill=CellFilling, ?Font=FontCells, ?Height=HeightCells, ?Line=LineCells),
593593
?ColumnWidth = ColumnWidth,
594594
?ColumnOrder = ColumnOrder
595595
)

src/FSharp.Plotly/FSharp.Plotly.fsproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@
2525
<Compile Include="Line.fs" />
2626
<Compile Include="Marker.fs" />
2727
<Compile Include="Font.fs" />
28-
<Compile Include="Cellcolor.fs" />
29-
<Compile Include="Header.fs" />
30-
<Compile Include="Cells.fs" />
3128
<Compile Include="Axis.fs" />
3229
<Compile Include="Bins.fs" />
3330
<Compile Include="Cumulative.fs" />
3431
<Compile Include="Scene.fs" />
3532
<Compile Include="Shape.fs" />
3633
<Compile Include="Error.fs" />
34+
<Compile Include="Table.fs" />
3735
<Compile Include="Trace.fs" />
3836
<Compile Include="Trace3d.fs" />
3937
<Compile Include="Layout.fs" />

src/FSharp.Plotly/Header.fs

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/FSharp.Plotly/Table.fs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
namespace FSharp.Plotly
2+
3+
open System
4+
5+
/// CellColor type inherits from dynamic object
6+
type CellColor () =
7+
inherit DynamicObj ()
8+
9+
/// Initialized Line object
10+
static member init
11+
(
12+
?Color
13+
) =
14+
CellColor ()
15+
|> CellColor.style
16+
(
17+
?Color = Color
18+
)
19+
// Applies the styles to CellColor()
20+
static member style
21+
(
22+
?Color
23+
) =
24+
(fun (cell:CellColor) ->
25+
Color |> DynObj.setValueOpt cell "color"
26+
// out ->
27+
cell
28+
)
29+
30+
31+
/// Header type inherits from dynamic object
32+
type TableHeader () =
33+
inherit DynamicObj ()
34+
35+
/// Initialized Header object
36+
static member init
37+
(
38+
Values ,
39+
?Align ,
40+
?Height,
41+
?Fill ,
42+
?Font ,
43+
?Line
44+
45+
) =
46+
TableHeader ()
47+
|> TableHeader.style
48+
(
49+
Values = Values,
50+
?Align = Align ,
51+
?Height = Height,
52+
?Fill = Fill ,
53+
?Font = Font ,
54+
?Line = Line
55+
56+
)
57+
58+
/// Applies the styles to TableHeader()
59+
static member style
60+
(
61+
Values : seq<#seq<#IConvertible>> ,
62+
?Align : seq<StyleParam.HorizontalAlign>,
63+
?Height ,
64+
?Fill ,
65+
?Font : Font ,
66+
?Line : Line
67+
68+
) =
69+
(fun (header: TableHeader) ->
70+
71+
Values |> DynObj.setValue header "values"
72+
Align |> DynObj.setValueOptBy header "align" (Seq.map StyleParam.HorizontalAlign.convert)
73+
Height |> DynObj.setValueOpt header "height"
74+
Fill |> DynObj.setValueOpt header "fill"
75+
Line |> DynObj.setValueOpt header "line"
76+
Font |> DynObj.setValueOpt header "font"
77+
header
78+
)
79+
80+
/// Cells type inherits from dynamic object
81+
type TableCells () =
82+
inherit DynamicObj ()
83+
84+
/// Initialized Cells object
85+
static member init
86+
(
87+
Values ,
88+
?Align ,
89+
?Height,
90+
?Fill ,
91+
?Font ,
92+
?Line
93+
94+
) =
95+
TableCells ()
96+
|> TableCells.style
97+
(
98+
Values = Values,
99+
?Align = Align ,
100+
?Height = Height,
101+
?Fill = Fill ,
102+
?Font = Font ,
103+
?Line = Line
104+
105+
)
106+
107+
//Applies the styles to TableCells()
108+
static member style
109+
(
110+
Values : seq<#seq<#IConvertible>> ,
111+
?Align : seq<StyleParam.HorizontalAlign>,
112+
?Height ,
113+
?Fill ,
114+
?Font : Font ,
115+
?Line : Line
116+
117+
) =
118+
(fun (cells: TableCells) ->
119+
120+
Values |> DynObj.setValue cells "values"
121+
Align |> DynObj.setValueOptBy cells "align" (Seq.map StyleParam.HorizontalAlign.convert)
122+
Height |> DynObj.setValueOpt cells "height"
123+
Fill |> DynObj.setValueOpt cells "fill"
124+
Line |> DynObj.setValueOpt cells "line"
125+
Font |> DynObj.setValueOpt cells "font"
126+
cells
127+
)

src/FSharp.Plotly/Trace.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,8 @@ module Trace =
973973
// Applies the styles of table plot to TraceObjects
974974
static member Table
975975
(
976-
Header : Header ,
977-
Cells : Cells ,
976+
Header : TableHeader ,
977+
Cells : TableCells ,
978978
?ColumnWidth : seq<int>,
979979
?ColumnOrder : seq<int>
980980
) =

0 commit comments

Comments
 (0)