|
| 1 | +module CoreTests.HTMLCodegen.ChartComposite |
| 2 | + |
| 3 | +open Expecto |
| 4 | +open Plotly.NET |
| 5 | +open Plotly.NET.LayoutObjects |
| 6 | +open Plotly.NET.TraceObjects |
| 7 | + |
| 8 | + |
| 9 | +open TestUtils |
| 10 | +open TestUtils.HtmlCodegen |
| 11 | +open ChartCompositeTestCharts |
| 12 | + |
| 13 | +module Venn = |
| 14 | + [<Tests>] |
| 15 | + let ``Venn chart HTML codegeneration tests`` = |
| 16 | + testList "HTMLCodegen.ChartComposite" [ |
| 17 | + testList "Venn" [ |
| 18 | + testCase "Two set data" ( fun () -> |
| 19 | + """var data = [{"type":"scatter","mode":"text","x":[1.0,2.5,1.75],"y":[1.0,1.0,1.0],"text":["A<br>2","B<br>2","2"],"textfont":{"family":"Arial","size":18.0,"color":"rgba(0, 0, 0, 1.0)"}}];""" |
| 20 | + |> chartGeneratedContains Venn.``Two set venn diagram`` |
| 21 | + ); |
| 22 | + testCase "Two set layout" ( fun () -> |
| 23 | + """var layout = {"margin":{"l":20,"r":20,"b":100},"shapes":[{"fillcolor":"rgba(0, 0, 255, 1.0)","line":{"color":"rgba(0, 0, 255, 1.0)"},"opacity":0.3,"type":"circle","x0":0.0,"x1":2.0,"xref":"x","y0":0.0,"y1":2.0,"yref":"y"},{"fillcolor":"rgba(255, 0, 0, 1.0)","line":{"color":"rgba(255, 0, 0, 1.0)"},"opacity":0.3,"type":"circle","x0":1.5,"x1":3.5,"xref":"x","y0":0.0,"y1":2.0,"yref":"y"}],"xaxis":{"showticklabels":false,"showgrid":false,"zeroline":false},"yaxis":{"scaleanchor":"x","scaleratio":1.0,"showticklabels":false,"showgrid":false,"zeroline":false}};""" |
| 24 | + |> chartGeneratedContains Venn.``Two set venn diagram`` |
| 25 | + ); |
| 26 | + testCase "Three set data" ( fun () -> |
| 27 | + """var data = [{"type":"scatter","mode":"text","x":[1.0,2.5,1.75,1.75,1.325,2.125,1.75],"y":[1.0,1.0,2.25,1.0,1.6625,1.6625,1.45],"text":["A<br>1","B<br>2","C<br>3","2","3","4","1"],"textfont":{"family":"Arial","size":18.0,"color":"rgba(0, 0, 0, 1.0)"}}];""" |
| 28 | + |> chartGeneratedContains Venn.``Three set venn diagram`` |
| 29 | + ); |
| 30 | + testCase "Three set layout" ( fun () -> |
| 31 | + """var layout = {"margin":{"l":20,"r":20,"b":100},"shapes":[{"fillcolor":"rgba(0, 0, 255, 1.0)","line":{"color":"rgba(0, 0, 255, 1.0)"},"opacity":0.3,"type":"circle","x0":0.0,"x1":2.0,"xref":"x","y0":0.0,"y1":2.0,"yref":"y"},{"fillcolor":"rgba(255, 0, 0, 1.0)","line":{"color":"rgba(255, 0, 0, 1.0)"},"opacity":0.3,"type":"circle","x0":1.5,"x1":3.5,"xref":"x","y0":0.0,"y1":2.0,"yref":"y"},{"fillcolor":"rgba(0, 128, 0, 1.0)","line":{"color":"rgba(0, 128, 0, 1.0)"},"opacity":0.3,"type":"circle","x0":0.75,"x1":2.75,"xref":"x","y0":1.3,"y1":3.3,"yref":"y"}],"xaxis":{"showticklabels":false,"showgrid":false,"zeroline":false},"yaxis":{"scaleanchor":"x","scaleratio":1.0,"showticklabels":false,"showgrid":false,"zeroline":false}};""" |
| 32 | + |> chartGeneratedContains Venn.``Three set venn diagram`` |
| 33 | + ); |
| 34 | + testCase "Styled two set data" ( fun () -> |
| 35 | + """var data = [{"type":"scatter","mode":"text","x":[1.0,2.5,1.75],"y":[1.0,1.0,1.0],"text":["A<br>2","B<br>2","2"],"textfont":{"family":"Courier New","size":20.0,"color":"rgba(128, 0, 128, 1.0)"}}];""" |
| 36 | + |> chartGeneratedContains Venn.``Styled two set venn diagram`` |
| 37 | + ); |
| 38 | + testCase "Styled two set layout" ( fun () -> |
| 39 | + """var layout = {"margin":{"l":20,"r":20,"b":100},"shapes":[{"fillcolor":"rgba(0, 255, 255, 1.0)","line":{"color":"rgba(0, 255, 255, 1.0)"},"opacity":0.3,"type":"circle","x0":0.0,"x1":2.0,"xref":"x","y0":0.0,"y1":2.0,"yref":"y"},{"fillcolor":"rgba(250, 128, 114, 1.0)","line":{"color":"rgba(250, 128, 114, 1.0)"},"opacity":0.3,"type":"circle","x0":1.5,"x1":3.5,"xref":"x","y0":0.0,"y1":2.0,"yref":"y"}],"xaxis":{"showticklabels":false,"showgrid":false,"zeroline":false},"yaxis":{"scaleanchor":"x","scaleratio":1.0,"showticklabels":false,"showgrid":false,"zeroline":false}};""" |
| 40 | + |> chartGeneratedContains Venn.``Styled two set venn diagram`` |
| 41 | + ); |
| 42 | + ] |
| 43 | + ] |
0 commit comments