/// <summary> /// Style /// </summary> /// <param name="Colors">List of Colors.</param> /// <param name="Address">Grid Coordinates.</param> /// <param name="Width">Width in pixels.</param> /// <returns name="Style">Style</returns> public static ScatterPlotMatrixStyle Style( [DefaultArgumentAttribute("Charts.MiscNodes.GetNull()")] List <DSCore.Color> Colors, [DefaultArgument("Charts.MiscNodes.GetNull()")] GridAddress Address, int Width = 1000 ) { ScatterPlotMatrixStyle style = new ScatterPlotMatrixStyle(); style.Width = Width; if (Colors != null) { List <string> hexColors = Colors.Select(x => ChartsUtilities.ColorToHexString(sColor.FromArgb(x.Alpha, x.Red, x.Green, x.Blue))).ToList(); style.Colors = hexColors; } else { style.Colors = null; } if (Address != null) { style.GridRow = Address.X; style.GridColumn = Address.Y; } else { style.GridRow = 1; style.GridColumn = 1; } return(style); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { List <Color> colors = new List <Color>(); GridAddress address = new GridAddress(1, 1); int width = 1000; DA.GetData <GridAddress>(1, ref address); DA.GetData <int>(2, ref width); // create style ScatterPlotMatrixStyle style = new ScatterPlotMatrixStyle(); if (DA.GetDataList <Color>(0, colors)) { List <string> hexColors = colors.Select(x => ChartsUtilities.ColorToHexString(Color.FromArgb(x.A, x.R, x.G, x.B))).ToList(); style.Colors = hexColors; } else { style.Colors = null; } style.GridRow = address.X; style.GridColumn = address.Y; style.Width = width; DA.SetData(0, style); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { ScatterPlotMatrixData data = null; ScatterPlotMatrixStyle style = null; if (!DA.GetData <ScatterPlotMatrixData>(0, ref data)) { return; } if (!DA.GetData <ScatterPlotMatrixStyle>(1, ref style)) { return; } D3jsLib.ScatterPlotMatrix.ScatterPlotMatrix chart = new D3jsLib.ScatterPlotMatrix.ScatterPlotMatrix(data, style); DA.SetData(0, chart); }
/// <summary> /// Scatter Plot Matrix Chart /// </summary> /// <param name="Data">Data</param> /// <param name="Style">Style</param> /// <returns name="Chart">Chart.</returns> public static D3jsLib.ScatterPlotMatrix.ScatterPlotMatrix Chart(ScatterPlotMatrixData Data, ScatterPlotMatrixStyle Style) { D3jsLib.ScatterPlotMatrix.ScatterPlotMatrix chart = new D3jsLib.ScatterPlotMatrix.ScatterPlotMatrix(Data, Style); return(chart); }