|
1 | 1 | @using Plotly.Blazor.LayoutLib |
2 | | -@using Plotly.Blazor.LayoutLib.SceneLib |
3 | | -@using XAxis = Plotly.Blazor.LayoutLib.SceneLib.XAxis |
4 | | -@using YAxis = Plotly.Blazor.LayoutLib.SceneLib.YAxis |
5 | | -@using Newtonsoft.Json.Linq |
6 | | -@using System.Globalization |
7 | | -@using System.ComponentModel |
8 | | -@using Plotly.Blazor.LayoutLib.LegendLib |
9 | | -@using Plotly.Blazor.LayoutLib.PolarLib |
10 | | -@using Plotly.Blazor.LayoutLib.PolarLib.RadialAxisLib |
11 | 2 | @using Plotly.Blazor.Traces.ScatterPolarLib |
12 | | -@using Font = Plotly.Blazor.LayoutLib.Font |
13 | 3 | @inject NavigationManager MyNavigationManager |
14 | 4 |
|
15 | 5 | <PlotlyChart style="height: 60vh; min-height: 350px" @bind-Layout="layout" @bind-Data="data" @ref="chart"/> |
16 | 6 |
|
17 | 7 | @code |
18 | 8 | { |
19 | | - [CascadingParameter] |
20 | | - private MudTheme Theme { get; set; } |
| 9 | + [CascadingParameter] private MudTheme Theme { get; set; } |
21 | 10 |
|
22 | 11 | private PlotlyChart chart; |
23 | 12 | private Layout layout; |
24 | 13 | private IList<ITrace> data; |
25 | 14 |
|
26 | 15 | private bool IsInitialized { get; set; } |
27 | | - |
| 16 | + |
28 | 17 | protected override void OnInitialized() |
29 | 18 | { |
30 | | - layout = new Layout |
| 19 | + layout = new() |
31 | 20 | { |
32 | | - Title = new Title |
| 21 | + Title = new() |
33 | 22 | { |
34 | 23 | Text = "Line Polar Plot" |
35 | 24 | }, |
36 | 25 | PaperBgColor = Theme.PaletteDark.Surface.ToString(), |
37 | 26 | PlotBgColor = Theme.PaletteDark.Surface.ToString(), |
38 | | - Font = new Font |
| 27 | + Font = new() |
39 | 28 | { |
40 | 29 | Color = Theme.PaletteDark.TextPrimary.ToString() |
41 | 30 | }, |
42 | 31 | ShowLegend = true, |
43 | | - Polar = new List<Polar>() |
| 32 | + Polar = new List<Polar> |
44 | 33 | { |
45 | | - new Polar() |
| 34 | + new() |
46 | 35 | { |
47 | 36 | BgColor = Theme.PaletteDark.Surface.ToString(), |
48 | | - RadialAxis = new RadialAxis() |
| 37 | + RadialAxis = new() |
49 | 38 | { |
50 | 39 | Visible = true, |
51 | 40 | Color = Theme.PaletteDark.TextPrimary.ToString(), |
52 | | - Range = new []{0.0,1.0}.OfType<object>().ToList() |
| 41 | + Range = new[] { 0.0, 1.0 }.OfType<object>().ToList() |
53 | 42 | } |
54 | 43 | } |
55 | 44 | }, |
56 | | - Legend = new List<Legend>() |
| 45 | + Legend = new List<Legend> |
57 | 46 | { |
58 | | - new Legend() |
| 47 | + new() |
59 | 48 | { |
60 | | - Title = new LayoutLib.LegendLib.Title() |
| 49 | + Title = new() |
61 | 50 | { |
62 | 51 | Text = "Mic Patterns" |
63 | 52 | } |
|
72 | 61 | 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360 |
73 | 62 | }; |
74 | 63 |
|
75 | | - var trace1 = new ScatterPolar() |
| 64 | + var trace1 = new ScatterPolar |
76 | 65 | { |
77 | 66 | R = new[] |
78 | 67 | { |
|
84 | 73 | Theta = theta.OfType<object>().ToList(), |
85 | 74 | Mode = ModeFlag.Lines, |
86 | 75 | Name = "Figure 8", |
87 | | - Line = new Line() { Color = "Peru" } |
| 76 | + Line = new() { Color = "Peru" } |
88 | 77 | }; |
89 | | - var trace2 = new ScatterPolar() |
| 78 | + var trace2 = new ScatterPolar |
90 | 79 | { |
91 | | - R = new [] |
| 80 | + R = new[] |
92 | 81 | { |
93 | | - 1, 0.997, 0.989, 0.976, 0.957, 0.933, 0.905, 0.872, 0.835, 0.794, 0.75, 0.703, 0.655, 0.604, 0.552, 0.5, 0.448, |
94 | | - 0.396, 0.345, 0.297, 0.25, 0.206, 0.165, 0.128, 0.095, 0.067, 0.043, 0.024, 0.011, 0.003, 0, 0.003, 0.011, 0.024, |
95 | | - 0.043, 0.067, 0.095, 0.128, 0.165, 0.206, 0.25, 0.297, 0.345, 0.396, 0.448, 0.5, 0.552, 0.604, 0.655, 0.703, 0.75, |
| 82 | + 1, 0.997, 0.989, 0.976, 0.957, 0.933, 0.905, 0.872, 0.835, 0.794, 0.75, 0.703, 0.655, 0.604, 0.552, 0.5, 0.448, |
| 83 | + 0.396, 0.345, 0.297, 0.25, 0.206, 0.165, 0.128, 0.095, 0.067, 0.043, 0.024, 0.011, 0.003, 0, 0.003, 0.011, 0.024, |
| 84 | + 0.043, 0.067, 0.095, 0.128, 0.165, 0.206, 0.25, 0.297, 0.345, 0.396, 0.448, 0.5, 0.552, 0.604, 0.655, 0.703, 0.75, |
96 | 85 | 0.794, 0.835, 0.872, 0.905, 0.933, 0.957, 0.976, 0.989, 0.997, 1 |
97 | 86 | }.OfType<object>().ToList(), |
98 | 87 | Theta = theta.OfType<object>().ToList(), |
99 | 88 | Mode = ModeFlag.Lines, |
100 | 89 | Name = "Cardioid", |
101 | | - Line = new Line(){Color = "darkviolet"} |
| 90 | + Line = new() { Color = "darkviolet" } |
102 | 91 | }; |
103 | | - var trace3 = new ScatterPolar() |
| 92 | + var trace3 = new ScatterPolar |
104 | 93 | { |
105 | | - R = new [] |
| 94 | + R = new[] |
106 | 95 | { |
107 | 96 | 1, 0.996, 0.984, 0.963, 0.935, 0.9, 0.857, 0.807, 0.752, 0.691, 0.625, 0.555, 0.482, 0.406, 0.328, 0.25, 0.172, 0.094, |
108 | 97 | 0.018, 0.055, 0.125, 0.191, 0.252, 0.307, 0.357, 0.4, 0.435, 0.463, 0.484, 0.496, 0.5, 0.496, 0.484, 0.463, 0.435, 0.4, |
|
112 | 101 | Theta = theta.OfType<object>().ToList(), |
113 | 102 | Mode = ModeFlag.Lines, |
114 | 103 | Name = "Hypercardioid", |
115 | | - Line = new Line(){Color = "deepskyblue"} |
| 104 | + Line = new() { Color = "deepskyblue" } |
116 | 105 | }; |
117 | | - var trace4 = new ScatterPolar() |
| 106 | + var trace4 = new ScatterPolar |
118 | 107 | { |
119 | | - R = new [] |
| 108 | + R = new[] |
120 | 109 | { |
121 | | - 1, 0.998, 0.993, 0.985, 0.974, 0.96, 0.943, 0.923, 0.901, 0.876, 0.85, 0.822, 0.793, 0.762, 0.731, 0.7, 0.669, 0.638, 0.607, |
122 | | - 0.578, 0.55, 0.524, 0.499, 0.477, 0.457, 0.44, 0.426, 0.415, 0.407, 0.402, 0.4, 0.402, 0.407, 0.415, 0.426, 0.44, 0.457, 0.477, |
| 110 | + 1, 0.998, 0.993, 0.985, 0.974, 0.96, 0.943, 0.923, 0.901, 0.876, 0.85, 0.822, 0.793, 0.762, 0.731, 0.7, 0.669, 0.638, 0.607, |
| 111 | + 0.578, 0.55, 0.524, 0.499, 0.477, 0.457, 0.44, 0.426, 0.415, 0.407, 0.402, 0.4, 0.402, 0.407, 0.415, 0.426, 0.44, 0.457, 0.477, |
123 | 112 | 0.499, 0.524, 0.55, 0.578, 0.607, 0.638, 0.669, 0.7, 0.731, 0.762, 0.793, 0.822, 0.85, 0.876, 0.901, 0.923, 0.943, 0.96, 0.974, |
124 | 113 | 0.985, 0.993, 0.998, 1 |
125 | 114 | }.OfType<object>().ToList(), |
126 | 115 | Theta = theta.OfType<object>().ToList(), |
127 | 116 | Mode = ModeFlag.Lines, |
128 | 117 | Name = "Subcardioid", |
129 | | - Line = new Line(){Color = "orangered"} |
| 118 | + Line = new() { Color = "orangered" } |
130 | 119 | }; |
131 | | - var trace5 = new ScatterPolar() |
| 120 | + var trace5 = new ScatterPolar |
132 | 121 | { |
133 | | - R = new [] |
| 122 | + R = new[] |
134 | 123 | { |
135 | 124 | 1, 0.997, 0.986, 0.969, 0.946, 0.916, 0.88, 0.838, 0.792, 0.74, 0.685, 0.626, 0.565, 0.501, 0.436, 0.37, 0.304, 0.239, 0.175, 0.114, 0.055, |
136 | 125 | 0, 0.052, 0.098, 0.14, 0.176, 0.206, 0.229, 0.246, 0.257, 0.26, 0.257, 0.246, 0.229, 0.206, 0.176, 0.14, 0.098, 0.052, 0, 0.055, 0.114, 0.175, |
|
139 | 128 | Theta = theta.OfType<object>().ToList(), |
140 | 129 | Mode = ModeFlag.Lines, |
141 | 130 | Name = "Supercardioid", |
142 | | - Marker = new Marker() |
| 131 | + Marker = new() |
143 | 132 | { |
144 | 133 | Color = "none", |
145 | | - Line = new Traces.ScatterPolarLib.MarkerLib.Line() |
| 134 | + Line = new() |
146 | 135 | { |
147 | 136 | Color = "green" |
148 | 137 | } |
149 | 138 | } |
150 | 139 | }; |
151 | 140 |
|
152 | | - data = new List<ITrace>() { trace1 , trace2, trace3, trace4, trace5 }; |
| 141 | + data = new List<ITrace> { trace1, trace2, trace3, trace4, trace5 }; |
153 | 142 |
|
154 | 143 | base.OnInitialized(); |
155 | 144 | } |
|
0 commit comments