Skip to content

Commit b29a51b

Browse files
committed
Add layoutimage docs
1 parent acb3b9c commit b29a51b

4 files changed

Lines changed: 80 additions & 3 deletions

File tree

Plotly.NET.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{7B09CC0A-F
4949
docs\01_2_multiple-charts.fsx = docs\01_2_multiple-charts.fsx
5050
docs\01_3_shapes.fsx = docs\01_3_shapes.fsx
5151
docs\01_4_annotations.fsx = docs\01_4_annotations.fsx
52+
docs\01_5_layout_images.fsx = docs\01_5_layout_images.fsx
5253
docs\02_0_line-scatter-plots.fsx = docs\02_0_line-scatter-plots.fsx
5354
docs\02_1_bar-and-column-charts.fsx = docs\02_1_bar-and-column-charts.fsx
5455
docs\02_2_area-plots.fsx = docs\02_2_area-plots.fsx

docs/01_5_layout_images.fsx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
(**
2+
---
3+
title: Layout images
4+
category: Chart Layout
5+
categoryindex: 2
6+
index: 6
7+
---
8+
*)
9+
10+
(*** hide ***)
11+
12+
(*** condition: prepare ***)
13+
#r "nuget: Newtonsoft.JSON, 12.0.3"
14+
#r "nuget: DynamicObj"
15+
#r "../bin/Plotly.NET/netstandard2.0/Plotly.NET.dll"
16+
17+
(*** condition: ipynb ***)
18+
#if IPYNB
19+
#r "nuget: Plotly.NET, {{fsdocs-package-version}}"
20+
#r "nuget: Plotly.NET.Interactive, {{fsdocs-package-version}}"
21+
#endif // IPYNB
22+
23+
(**
24+
# Annotations
25+
26+
[![Binder]({{root}}img/badge-binder.svg)](https://mybinder.org/v2/gh/plotly/Plotly.NET/gh-pages?filepath={{fsdocs-source-basename}}.ipynb) 
27+
[![Script]({{root}}img/badge-script.svg)]({{root}}{{fsdocs-source-basename}}.fsx) 
28+
[![Notebook]({{root}}img/badge-notebook.svg)]({{root}}{{fsdocs-source-basename}}.ipynb)
29+
30+
31+
*Summary:* This example shows how to create Images and add them to the Charts in F#.
32+
33+
let's first create some data for the purpose of creating example charts:
34+
35+
*)
36+
37+
open Plotly.NET
38+
39+
let x = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
40+
let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]
41+
42+
(**
43+
use the `LayoutImage.init` function to generate an image, and either the `Chart.withLayoutImage` or the `Chart.withLayoutImages` function to add
44+
multiple annotations at once.
45+
46+
*)
47+
48+
open Plotly.NET.LayoutObjects
49+
50+
let image =
51+
LayoutImage.init(
52+
Source="https://fsharp.org/img/logo/fsharp.svg",
53+
XRef="x",
54+
YRef="y",
55+
X=0,
56+
Y=3,
57+
SizeX=2,
58+
SizeY=2,
59+
Sizing=StyleParam.LayoutImageSizing.Stretch,
60+
Opacity=0.5,
61+
Layer=StyleParam.Layer.Below
62+
)
63+
64+
let imageChart =
65+
Chart.Line(x,y',Name="line")
66+
|> Chart.withLayoutImage(image)
67+
68+
(*** condition: ipynb ***)
69+
#if IPYNB
70+
imageChart
71+
#endif // IPYNB
72+
73+
(***hide***)
74+
imageChart |> GenericChart.toChartHTML
75+
(***include-it-raw***)
76+

docs/10_0_ternary_line_scatter_plots.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
title: Ternary line and scatter plots
44
category: Ternary Plots
5-
categoryindex: 10
5+
categoryindex: 11
66
index: 1
77
---
88
*)

docs/10_1_styling_ternary_layouts.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
---
33
title: Styling ternary layouts
44
category: Ternary Plots
5-
categoryindex: 9
6-
index: 3
5+
categoryindex: 11
6+
index: 2
77
---
88
*)
99

0 commit comments

Comments
 (0)