Repository navigation
C# Layout Grid Example #187
Copy link
Copy link
Closed
Description
Activity
You'll have to do it manually atm, i am currently working on an updated version of Chart.Grid that does this internally and will be easy to call from C# though.
The necessary steps are:
- Create the charts for your grid with axis anchors that correspond to the grid position
- combine them
- add as many axes to the combined chart as needed (2 X / 2 Y in my example)
Note that Boxplot is really awkward to use because it has no static type annotation for its parameters. This is something we should fix.
using System; using Plotly.NET; using Plotly.NET.TraceObjects; using Plotly.NET.LayoutObjects; using static Plotly.NET.Chart2D; using Microsoft.FSharp.Core; namespace Plotly.NET.Tests.CSharp { class Program { static void Main(string[] args) { GenericChart.GenericChart c11 = Chart2D.Chart.BoxPlot<string, int [], string, int, int, int ,int> ( x: "11", y: new int[] { 1, 2, 3 } ) .WithAxisAnchor(X: 1, Y: 1); GenericChart.GenericChart c12 = Chart2D.Chart.BoxPlot<string, int[], string, int, int, int, int>( x: "12", y: new int[] { 1, 2, 3 } ).WithAxisAnchor(X: 1, Y: 2); GenericChart.GenericChart c21 = Chart2D.Chart.BoxPlot<string, int[], string, int, int, int, int>( x: "21", y: new int[] { 1, 2, 3 } ).WithAxisAnchor(X: 2, Y: 1); GenericChart.GenericChart c22 = Chart2D.Chart.BoxPlot<string, int[], string, int, int, int, int>( x: "22", y: new int[] { 1, 2, 3 } ).WithAxisAnchor(X: 2, Y: 2); Chart.Combine(new GenericChart.GenericChart[] { c11, c12, c21, c22 }) .WithXAxis(LinearAxis.init<string,string,string,string, string, string>(), StyleParam.SubPlotId.NewXAxis(1) ) .WithXAxis(LinearAxis.init<string,string,string,string, string, string>(), StyleParam.SubPlotId.NewXAxis(2) ) .WithYAxis(LinearAxis.init<string,string,string,string, string, string>(), StyleParam.SubPlotId.NewYAxis(1) ) .WithYAxis(LinearAxis.init<string,string,string,string, string, string>(), StyleParam.SubPlotId.NewYAxis(2) ) .WithLayoutGridStyle(Rows: 2, Columns: 2) .Show(); } } }
Reacted by phani423Reacted by phani423Awesome, Thank you for the help!
Metadata
Metadata
Assignees
Labels
No labels

Hi ,
Can anyone help me with example code of performing Grid Layout of Box plot?
Thank you!