public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempHorizontalBar" + counter.ToString(); string colString = ChartsUtilities.EvaluateTemplate(this, "Mandrill_d3.HorizontalBarChart.HorizontalBarChart.html", templateName); return(colString); }
/// <summary> /// Parallel Coordinates Style object. /// </summary> /// <param name="LineColor">Color of the selected Lines/Values.</param> /// <param name="Address">Grid Coordinates.</param> /// <param name="Margins">Margins in pixels.</param> /// <param name="Width">Width of the Chart in pixels.</param> /// <param name="Height">Height of the Chart in pixels.</param> /// <returns name="Style">Parallel Coordinates Style.</returns> /// <search>parallel, coordinates, style</search> public static ParallelCoordinatesStyle Style( [DefaultArgument("DSCore.Color.ByARGB(1,50,130,190)")] DSCore.Color LineColor, [DefaultArgument("Charts.MiscNodes.GetNull()")] GridAddress Address, [DefaultArgument("Charts.MiscNodes.Margins()")] Margins Margins, int Width = 1000, int Height = 500) { ParallelCoordinatesStyle style = new ParallelCoordinatesStyle(); style.Width = Width; style.Height = Height; style.LineColor = ChartsUtilities.ColorToHexString(sColor.FromArgb(LineColor.Alpha, LineColor.Red, LineColor.Green, LineColor.Blue)); style.Margins = Margins; style.SizeX = (int)Math.Ceiling(Width / 100d); style.SizeY = (int)Math.Ceiling(Height / 100d); if (Address != null) { style.GridRow = Address.X; style.GridColumn = Address.Y; } else { style.GridRow = 1; style.GridColumn = 1; } return(style); }
/// <summary> /// Area Chart Style object. /// </summary> /// <param name="Address">Grid Coordinates.</param> /// <param name="Margins">Marings in pixels.</param> /// <param name="Width">Width of the entire chart in pixels.</param> /// <param name="Height">Height of the entire chart in pixels.</param> /// <param name="YAxisLabel">Text used to label Y Axis.</param> /// <param name="AreaColor">Color for Area Chart fill.</param> /// <param name="TickMarksX">Approximate number of tick marks on X Axis.</param> /// <returns name="Style">Area Chart Style.</returns> /// <search>area, chart, style</search> public static AreaChartStyle Style( [DefaultArgument("DSCore.Color.ByARGB(1,50,130,190)")] DSCore.Color AreaColor, [DefaultArgument("Charts.MiscNodes.GetNull()")] GridAddress Address, [DefaultArgument("Charts.MiscNodes.Margins(20,40,20,40)")] Margins Margins, int Width = 1000, int Height = 500, string YAxisLabel = "Label", int TickMarksX = 10) { AreaChartStyle style = new AreaChartStyle(); style.Width = Width; style.Height = Height; style.YAxisLabel = YAxisLabel; style.AreaColor = ChartsUtilities.ColorToHexString(sColor.FromArgb(AreaColor.Alpha, AreaColor.Red, AreaColor.Green, AreaColor.Blue)); style.TickMarksX = TickMarksX; style.Margins = Margins; style.SizeX = (int)Math.Ceiling(Width / 100d); style.SizeY = (int)Math.Ceiling(Height / 100d); if (Address != null) { style.GridRow = Address.X; style.GridColumn = Address.Y; } else { style.GridRow = 1; style.GridColumn = 1; } return(style); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempScatter" + counter.ToString(); string colString = ChartsUtilities.EvaluateTemplate(this, "Mandrill_d3.ScatterPlots.ScatterPlotScript.html", templateName); return(colString); }
/// <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) { Color lineColor = Color.FromArgb(50, 130, 190); GridAddress address = new GridAddress(1, 1); int width = 1000; int height = 500; string yAxisLabel = "Label"; int tickMarks = 2; Margins margins = new Margins(); DA.GetData <Color>(0, ref lineColor); DA.GetData <GridAddress>(1, ref address); DA.GetData <Margins>(2, ref margins); DA.GetData <int>(3, ref width); DA.GetData <int>(4, ref height); DA.GetData <string>(5, ref yAxisLabel); DA.GetData <int>(6, ref tickMarks); // create style LineChartStyle style = new LineChartStyle(); style.LineColor = ChartsUtilities.ColorToHexString(lineColor); style.GridRow = address.X; style.GridColumn = address.Y; style.Width = width; style.Height = height; style.YAxisLabel = yAxisLabel; style.TickMarksX = tickMarks; style.Margins = margins; style.SizeX = (int)Math.Ceiling(width / 100d); style.SizeY = (int)Math.Ceiling(height / 100d); DA.SetData(0, style); }
public override void CreateChartModel(int counter) { NormalizedStackedBarChartModel model = new NormalizedStackedBarChartModel(); model.Width = this.Style.Width; model.Height = this.Style.Height; model.YAxisLabel = this.Style.YAxisLabel; model.BarHover = ChartsUtilities.ColorToHexString(this.Style.BarHoverColor); model.DivId = "div" + counter.ToString(); model.Margins = this.Style.Margins; // set grid address model.GridRow = this.Style.GridRow; model.GridColumn = this.Style.GridColumn; // always round up for the grid size so chart is smaller then container model.SizeX = (int)System.Math.Ceiling(this.Style.Width / 100d); model.SizeY = (int)System.Math.Ceiling(this.Style.Height / 100d); if (this.Style.Colors != null) { string domainColors = new JavaScriptSerializer().Serialize(this.Style.Colors); model.DomainColors = domainColors; model.Colors = true; } else { model.Colors = false; } model.Data = this.Data.ToJsonString(); this.ChartModel = model; }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTextTemp" + counter.ToString(); string colString = ChartsUtilities.EvaluateTemplate(this, "Mandrill_d3.TextNotes.DivTextNote.html", templateName); return(colString); }
/// <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> /// Create Text Style /// </summary> /// <param name="FontColor">Color</param> /// <param name="Address">Grid Coordinates</param> /// <param name="Width">Width of Grid container.</param> /// <param name="Height">Height of Grid Container.</param> /// <param name="FontSize">Size</param> /// <param name="FontWeight">Weight</param> /// <param name="FontStyle">Style</param> /// <param name="FontTransform">Transform</param> /// <returns name="Style">Style for the Text Note object</returns> public static TextStyle Style( [DefaultArgument("DSCore.Color.ByARGB(1,0,0,0)")] Color FontColor, [DefaultArgument("Charts.MiscNodes.GetNull()")] GridAddress Address, int Width = 200, int Height = 100, double FontSize = 20.0, string FontWeight = "normal", string FontStyle = "normal", string FontTransform = "none") { TextStyle style = new TextStyle(); style.FontSize = FontSize; style.FontColor = ChartsUtilities.ColorToHexString(sColor.FromArgb(FontColor.Alpha, FontColor.Red, FontColor.Green, FontColor.Blue)); style.FontWeight = FontWeight; style.FontStyle = FontStyle; style.FontTransform = FontTransform; style.Width = Width; style.Height = Height; style.SizeX = (int)System.Math.Ceiling(Width / 100d); style.SizeY = (int)System.Math.Ceiling(Height / 100d); if (Address != null) { style.GridRow = Address.X; style.GridColumn = Address.Y; } else { style.GridRow = 1; style.GridColumn = 1; } return(style); }
/// <summary> /// Scatter Plot Style. /// </summary> /// <param name="Address">Grid Coordinates.</param> /// <param name="Margins">Margins in pixels.</param> /// <param name="Width">Width in pixels.</param> /// <param name="Height">Height in pixels.</param> /// <param name="YAxisLabel">Label displayed for Y Axis.</param> /// <param name="XAxisLabel">Label displayed for X Axis.</param> /// <param name="DotColor">Color of Scatter Plot dot.</param> /// <returns name="Style">Scatter Plot Style.</returns> /// <search>style, scatter plot</search> public static ScatterPlotStyle Style( [DefaultArgument("DSCore.Color.ByARGB(1,100,100,100)")] DSCore.Color DotColor, [DefaultArgument("Charts.MiscNodes.GetNull()")] GridAddress Address, [DefaultArgument("Charts.MiscNodes.Margins()")] Margins Margins, int Width = 1000, int Height = 500, string YAxisLabel = "Label", string XAxisLabel = "Label") { ScatterPlotStyle style = new ScatterPlotStyle(); style.Width = Width; style.Height = Height; style.YAxisLabel = YAxisLabel; style.XAxisLabel = XAxisLabel; style.DotColor = ChartsUtilities.ColorToHexString(sColor.FromArgb(DotColor.Alpha, DotColor.Red, DotColor.Green, DotColor.Blue)); style.Margins = Margins; style.SizeX = (int)Math.Ceiling(Width / 100d); style.SizeY = (int)Math.Ceiling(Height / 100d); 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) { Color lineColor = Color.FromArgb(50, 130, 190); GridAddress address = new GridAddress(1, 1); Margins margins = new Margins(); int width = 1000; int height = 500; DA.GetData <Color>(0, ref lineColor); DA.GetData <GridAddress>(1, ref address); DA.GetData <Margins>(2, ref margins); DA.GetData <int>(3, ref width); DA.GetData <int>(4, ref height); // create style ParallelCoordinatesStyle style = new ParallelCoordinatesStyle(); style.LineColor = ChartsUtilities.ColorToHexString(lineColor); style.GridRow = address.X; style.GridColumn = address.Y; style.Width = width; style.Height = height; style.Margins = margins; style.SizeX = (int)Math.Ceiling(width / 100d); style.SizeY = (int)Math.Ceiling(height / 100d); DA.SetData(0, style); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempParallelCoordinates" + counter.ToString(); string colString = ChartsUtilities.EvaluateTemplate(this, "Mandrill_d3.ParallelCoordinatesChart.parallelCoordinatesChart.html", templateName); return(colString); }
public string EvaluateDivTemplate(int counter) { string templateName = "chart" + counter.ToString(); //var model = this.ChartModel; string colString = ChartsUtilities.EvaluateTemplate(this, "Mandrill_d3.Gridster.divTemplate.html", templateName); return(colString); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempGroupedBar" + counter.ToString(); GroupedBarChartModel model = this.ChartModel as GroupedBarChartModel; string colString = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.GroupedBarCharts.GroupedBarChartScript.html", templateName); return(colString); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempLegend" + counter.ToString(); LegendModel model = this.ChartModel as LegendModel; string colString = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.Legend.Legend.html", templateName); return(colString); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempNormalizedStackedBar" + counter.ToString(); NormalizedStackedBarChartModel model = this.ChartModel as NormalizedStackedBarChartModel; string colString = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.NormalizedStackedBarChart.NormalizedStackedBarChart.html", templateName); return(colString); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivTempScatterPlotMatrix" + counter.ToString(); ScatterPlotMatrixModel model = this.ChartModel as ScatterPlotMatrixModel; string colString = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.ScatterPlotMatrix.ScatterPlotMatrix.html", templateName); return(colString); }
public override string EvaluateModelTemplate(int counter) { string templateName = "colDivImageTemp" + counter.ToString(); ImageModel model = this.ChartModel as ImageModel; string colString = ChartsUtilities.EvaluateTemplate(model, "Mandrill_d3.Images.DivImage.html", templateName); return(colString); }
/// <summary> /// Data. /// </summary> /// <param name="Headers">Header values.</param> /// <param name="Values">Data values.</param> /// <returns name="Data">Data</returns> public static ScatterPlotMatrixData Data( List <string> Headers, List <List <object> > Values) { ScatterPlotMatrixData data = new ScatterPlotMatrixData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromList(Headers, Values)); return(data); }
/// <summary> /// Normalized Stacked Bar Chart Data object. /// </summary> /// <param name="Headers">Names of all values that will be grouped. First value is always "Name".</param> /// <param name="Values">Nested List of values where first item in a sub-list is Group Name. Following items /// must match number of value names defined in Headers input. </param> /// <returns name="Data">Normalized Stacked Bar Chart Data</returns> /// <search>normalized, data, stacked, bar, chart</search> public static NormalizedStackedBarChartData Data( List <string> Headers, List <List <object> > Values) { NormalizedStackedBarChartData data = new NormalizedStackedBarChartData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromList(Headers, Values)); return(data); }
/// <summary> /// Parallel Coordinates Data. /// </summary> /// <param name="Headers">Names of each Axis.</param> /// <param name="Values">Values for each data point.</param> /// <returns name="Data">Parallel Coordinates Data.</returns> /// <search>parallel, coordinates, data</search> public static ParallelCoordinatesData Data( List <string> Headers, List <List <object> > Values) { ParallelCoordinatesData data = new ParallelCoordinatesData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromList(Headers, Values)); return(data); }
/// <summary> /// Grouped Bar Chart Data. /// </summary> /// <param name="Headers"></param> /// <param name="Values"></param> /// <param name="Domain"></param> /// <returns name="Data">Grouped Bar Chart Data object</returns> public static GroupedBarChartData Data( List <string> Headers, List <List <object> > Values, [DefaultArgumentAttribute("Charts.MiscNodes.GetNull()")] Domain Domain) { GroupedBarChartData data = new GroupedBarChartData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromList(Headers, Values)); data.Domain = Domain; return(data); }
public override void CreateChartModel(int counter) { ScatterPlotModel model = new ScatterPlotModel(); model.Width = this.Style.Width; model.Height = this.Style.Height; model.YAxisLabel = this.Style.YAxisLabel; model.XAxisLabel = this.Style.XAxisLabel; model.DotColor = ChartsUtilities.ColorToHexString(this.Style.DotColor); model.DivId = "div" + counter.ToString(); model.Margins = this.Style.Margins; // set grid address model.GridRow = this.Style.GridRow; model.GridColumn = this.Style.GridColumn; // always round up for the grid size so chart is smaller then container model.SizeX = (int)System.Math.Ceiling(this.Style.Width / 100d); model.SizeY = (int)System.Math.Ceiling(this.Style.Height / 100d); if (this.Data.DomainX == null) { model.DomainX = false; } else { model.DomainX = true; model.DomainXA = this.Data.DomainX.A.ToString(); model.DomainXB = this.Data.DomainX.B.ToString(); } if (this.Data.DomainY == null) { model.DomainY = false; } else { model.DomainY = true; model.DomainYA = this.Data.DomainY.A.ToString(); model.DomainYB = this.Data.DomainY.B.ToString(); } // serialize C# Array into JS Array var serializer = new JavaScriptSerializer(); string jsData = serializer.Serialize(this.Data.Data); model.Data = jsData; this.ChartModel = model; }
/// <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) { string filePath = null; if (!DA.GetData <string>(0, ref filePath)) { return; } PieChartData data = new PieChartData(); data.Data = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCsv(filePath)); DA.SetData(0, data); }
/// <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) { string filePath = null; if (!DA.GetData <string>(0, ref filePath)) { return; } ScatterPlotMatrixData data = new ScatterPlotMatrixData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromCsv(filePath)); DA.SetData(0, data); }
/// <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) { string filePath = null; if (!DA.GetData <string>(0, ref filePath)) { return; } NormalizedStackedBarChartData data = new NormalizedStackedBarChartData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromCsv(filePath)); DA.SetData(0, data); }
/// <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) { string filePath = null; if (!DA.GetData <string>(0, ref filePath)) { return; } ParallelCoordinatesData data = new ParallelCoordinatesData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromCSV(filePath)); DA.SetData(0, data); }
/// <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) { string filePath = null; Domain domain = null; if (!DA.GetData <string>(0, ref filePath)) { return; } DA.GetData <Domain>(1, ref domain); GroupedBarChartData data = new GroupedBarChartData(); data.Data = ChartsUtilities.DataToJsonString(ChartsUtilities.Data2FromCsv(filePath)); data.Domain = domain; DA.SetData(0, data); }
/// <summary> /// Legend Style /// </summary> /// <param name="Colors">List of colors for each rectangle.</param> /// <param name="Address">Grid Coordinates.</param> /// <param name="Width">Width in pixels.</param> /// <param name="Height">Height in pixels.</param> /// <param name="Title">Title below legend.</param> /// <param name="RectangleSize">Rectangle size in pixels.</param> /// <returns name="Style">Style</returns> public static LegendStyle Style( [DefaultArgumentAttribute("Charts.MiscNodes.GetNull()")] List <DSCore.Color> Colors, [DefaultArgument("Charts.MiscNodes.GetNull()")] GridAddress Address, int Width = 200, int Height = 400, string Title = "Title", int RectangleSize = 20 ) { LegendStyle style = new LegendStyle(); style.Width = Width; style.Height = Height; style.Title = Title; style.RectangleSize = RectangleSize; if (Colors != null) { List <string> hexColors = new List <string>(); foreach (DSCore.Color color in Colors) { string col = ChartsUtilities.ColorToHexString(sColor.FromArgb(color.Alpha, color.Red, color.Green, color.Blue)); hexColors.Add(col); } 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); }