@@ -336,7 +336,7 @@ let additionalHeadTagsChart =
336
336
// Add reference to the bulma css framework
337
337
|> Chart.withAdditionalHeadTags
[ """ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected] /css/bulma.min.css">""" ]
338
338
339
- let mathtexChart =
339
+ let mathtexv3Chart =
340
340
[
341
341
Chart.Point([( 1. , 2. )], @" $\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" , UseDefaults = false )
342
342
Chart.Point([( 2. , 4. )], @" $\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" , UseDefaults = false )
@@ -346,6 +346,16 @@ let mathtexChart =
346
346
// include mathtex tags in <head>. pass true to append these scripts, false to ONLY include MathTeX.
347
347
|> Chart.withMathTex( true )
348
348
349
+ let mathtexv2Chart =
350
+ [
351
+ Chart.Point([( 1. , 2. )], @" $\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" , UseDefaults = false )
352
+ Chart.Point([( 2. , 4. )], @" $\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$" , UseDefaults = false )
353
+ ]
354
+ |> Chart.combine
355
+ |> Chart.withTitle @" $\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$"
356
+ // include mathtex tags in <head>. pass true to append these scripts, false to ONLY include MathTeX.
357
+ |> Chart.withMathTex( true , MathJaxVersion = 2 )
358
+
349
359
[<Tests>]
350
360
let ``Display options`` =
351
361
testList " ChartLayout.Display options" [
@@ -376,16 +386,28 @@ let ``Display options`` =
376
386
]
377
387
|> substringListIsInChart additionalHeadTagsChart toEmbeddedHTML
378
388
);
379
- testCase " MathTex data" ( fun () ->
389
+ testCase " MathTex v2 data" ( fun () ->
380
390
""" var data = [{"type":"scatter","name":"$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$","mode":"markers","x":[1.0],"y":[2.0],"marker":{},"line":{}},{"type":"scatter","name":"$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$","mode":"markers","x":[2.0],"y":[4.0],"marker":{},"line":{}}];"""
381
- |> chartGeneratedContains mathtexChart
391
+ |> chartGeneratedContains mathtexv2Chart
382
392
);
383
- testCase " MathTex layout" ( fun () ->
393
+ testCase " MathTex v2 layout" ( fun () ->
384
394
" var layout = {\" title\" :{\" text\" :\" $\\\\ beta_{1c} = 25 \\\\ pm 11 \\\\ text{ km s}^{-1}$\" }};"
385
- |> chartGeneratedContains mathtexChart
395
+ |> chartGeneratedContains mathtexv2Chart
386
396
);
387
- testCase " MathTex include mathjax" ( fun () ->
397
+ testCase " MathTex v2 include mathjax" ( fun () ->
388
398
" https://cdnjs.cloudflare.com/ajax/libs/mathjax/"
389
- |> substringIsInChart mathtexChart toEmbeddedHTML
399
+ |> substringIsInChart mathtexv2Chart toEmbeddedHTML
400
+ )
401
+ testCase " MathTex v3 data" ( fun () ->
402
+ """ var data = [{"type":"scatter","name":"$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$","mode":"markers","x":[1.0],"y":[2.0],"marker":{},"line":{}},{"type":"scatter","name":"$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$","mode":"markers","x":[2.0],"y":[4.0],"marker":{},"line":{}}];"""
403
+ |> chartGeneratedContains mathtexv3Chart
404
+ );
405
+ testCase " MathTex v3 layout" ( fun () ->
406
+ " var layout = {\" title\" :{\" text\" :\" $\\\\ beta_{1c} = 25 \\\\ pm 11 \\\\ text{ km s}^{-1}$\" }};"
407
+ |> chartGeneratedContains mathtexv3Chart
408
+ );
409
+ testCase " MathTex v3 include mathjax" ( fun () ->
410
+ " https://cdn.jsdelivr.net/npm/mathjax@3"
411
+ |> substringIsInChart mathtexv3Chart toEmbeddedHTML
390
412
)
391
413
]
0 commit comments