@@ -219,17 +219,28 @@ One of the main design points of Plotly.NET it is to provide support for multipl
219219### Fluent interface style in C#:
220220
221221```
222- static void Main(string[] args)
222+ using System;
223+ using Plotly.NET;
224+ using Microsoft.FSharp.Core; // use this for less verbose and more helpful intellisense
225+
226+ namespace Plotly.NET.Tests.CSharp
223227{
224- double[] x = new double[] { 1, 2 };
225- double[] y = new double[] { 5, 10 };
226- GenericChart.GenericChart chart = Chart.Point(x: x, y: y);
227- chart
228- .WithTraceName("Hello from C#", true)
229- .withXAxisStyle(title: "xAxis", Showgrid: false, Showline: true)
230- .withYAxisStyle(title: "yAxis", Showgrid: false, Showline: true)
231- .Show();
228+ class Program
229+ {
230+ static void Main(string[] args)
231+ {
232+ double[] x = new double[] { 1, 2 };
233+ double[] y = new double[] { 5, 10 };
234+ GenericChart.GenericChart chart = Chart2D.Chart.Point<double, double, string>(x: x, y: y);
235+ chart
236+ .WithTraceName("Hello from C#", true)
237+ .WithXAxisStyle(title: Title.init("xAxis"), ShowGrid: false, ShowLine: true)
238+ .WithYAxisStyle(title: Title.init("yAxis"), ShowGrid: false, ShowLine: true)
239+ .Show();
240+ }
241+ }
232242}
243+
233244```
234245
235246### Declarative style in F# using the underlying `DynamicObj`:
@@ -273,36 +284,47 @@ GenericChart.ofTraceObject(trace)
273284### Declarative style in C# using the underlying `DynamicObj`:
274285
275286```
276- static void Main(string[] args)
287+ using System;
288+ using Plotly.NET;
289+ using Microsoft.FSharp.Core; // use this for less verbose and more helpful intellisense
290+ using Plotly.NET.LayoutObjects;
291+
292+ namespace Plotly.NET.Tests.CSharp
277293{
278- double[] x = new double[] { 1, 2 };
279- double[] y = new double[] { 5, 10 };
280-
281- Axis.LinearAxis xAxis = new Axis.LinearAxis();
282- xAxis.SetValue("title", "xAxis");
283- xAxis.SetValue("showgrid", false);
284- xAxis.SetValue("showline", true);
285-
286- Axis.LinearAxis yAxis = new Axis.LinearAxis();
287- yAxis.SetValue("title", "yAxis");
288- yAxis.SetValue("showgrid", false);
289- yAxis.SetValue("showline", true);
290-
291- Layout layout = new Layout();
292- layout.SetValue("xaxis", xAxis);
293- layout.SetValue("yaxis", yAxis);
294- layout.SetValue("showlegend", true);
295-
296- Trace trace = new Trace("scatter");
297- trace.SetValue("x", x);
298- trace.SetValue("y", y);
299- trace.SetValue("mode", "markers");
300- trace.SetValue("name", "Hello from C#");
301-
302- GenericChart
303- .ofTraceObject(trace)
304- .WithLayout(layout)
305- .Show();
294+ class Program
295+ {
296+ static void Main(string[] args)
297+ {
298+ double[] x = new double[] { 1, 2 };
299+ double[] y = new double[] { 5, 10 };
300+
301+ LinearAxis xAxis = new LinearAxis();
302+ xAxis.SetValue("title", "xAxis");
303+ xAxis.SetValue("showgrid", false);
304+ xAxis.SetValue("showline", true);
305+
306+ LinearAxis yAxis = new LinearAxis();
307+ yAxis.SetValue("title", "yAxis");
308+ yAxis.SetValue("showgrid", false);
309+ yAxis.SetValue("showline", true);
310+
311+ Layout layout = new Layout();
312+ layout.SetValue("xaxis", xAxis);
313+ layout.SetValue("yaxis", yAxis);
314+ layout.SetValue("showlegend", true);
315+
316+ Trace trace = new Trace("scatter");
317+ trace.SetValue("x", x);
318+ trace.SetValue("y", y);
319+ trace.SetValue("mode", "markers");
320+ trace.SetValue("name", "Hello from C#");
321+
322+ GenericChart
323+ .ofTraceObject(trace)
324+ .WithLayout(layout)
325+ .Show();
326+ }
327+ }
306328}
307329```
308330
0 commit comments