/// <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 ID = this.Attributes.InstanceGuid.ToString(); string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text; int C = this.RunCount; wObject WindObject = new wObject(); pElement Element = new pElement(); bool Active = Elements.ContainsKey(C); var pControl = new pPointChart(name); if (Elements.ContainsKey(C)) { Active = true; } //Check if control already exists if (Active) { if (Elements[C] != null) { WindObject = Elements[C]; Element = (pElement)WindObject.Element; pControl = (pPointChart)Element.PollenControl; } } else { Elements.Add(C, WindObject); } //Set Unique Control Properties IGH_Goo D = null; int M = 0; int P = 0; int T = 0; int L = 0; if (!DA.GetData(0, ref D)) { return; } if (!DA.GetData(1, ref M)) { return; } if (!DA.GetData(2, ref P)) { return; } if (!DA.GetData(3, ref T)) { return; } if (!DA.GetData(4, ref L)) { return; } wObject W = new wObject(); D.CastTo(out W); bool LineMode = ((M > 2) & (M < 6)); bool TagMode = ((M == 1) || (M == 2)); bool LabelMode = ((M == 0) || (LineMode)); DataSetCollection DC = (DataSetCollection)W.Element; if (DC.TotalCustomFill == 0) { DC.SetDefaultPallet(Wind.Presets.wGradients.Metro, false, DC.Sets.Count > 1); } if (DC.TotalCustomStroke == 0) { if (LineMode) { DC.SetDefaultStrokes(wStrokes.StrokeTypes.LineChart, wGradients.Metro, false, DC.Sets.Count > 1); } else { DC.SetDefaultStrokes(wStrokes.StrokeTypes.OffWhiteSolid); } } if (DC.TotalCustomMarker == 0) { if (M == 0) { DC.SetDefaultMarkers(wGradients.Metro, wMarker.MarkerType.Circle, false, DC.Sets.Count > 1); } else { DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, DC.Sets.Count > 1); } } if (DC.TotalCustomFont == 0) { DC.SetDefaultFonts(wFonts.ChartPointDark); } if (DC.TotalCustomLabel == 0) { if (LabelMode) { DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.None, new wGraphic(wColors.Transparent))); } else { DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent))); } } if (DC.TotalCustomTitles == 0) { DC.Graphics.FontObject = wFonts.AxisLabel; } List <pPointSeries> PointSeriesList = new List <pPointSeries>(); pControl.SetProperties(DC); for (int i = 0; i < DC.Sets.Count; i++) { pPointSeries pSeriesSet = new pPointSeries(DC.Sets[i].Title); pSeriesSet.SetProperties(DC.Sets[i]); pSeriesSet.SetNumberChartType(M, ModeStack, LineMode); pSeriesSet.SetChartLabels(DC.Label); pSeriesSet.SetNumericData(0); PointSeriesList.Add(pSeriesSet); } pControl.View = new Pollen.Utilities.p3D(P, T, L, (Pollen.Utilities.p3D.LightingMode)ModeLighting); pControl.SetSeries(PointSeriesList); pControl.SetThreeDView(); pControl.SetAxisScale(); pControl.SetAxisAppearance(); //Set Parrot Element and Wind Object properties if (!Active) { Element = new pElement(pControl.Element, pControl, pControl.Type); } WindObject = new wObject(Element, "Pollen", Element.Type); WindObject.GUID = this.InstanceGuid; WindObject.Instance = C; Elements[this.RunCount] = WindObject; DA.SetData(0, WindObject); }
/// <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 ID = this.Attributes.InstanceGuid.ToString(); string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text; int C = this.RunCount; wObject WindObject = new wObject(); pElement Element = new pElement(); bool Active = Elements.ContainsKey(C); var pControl = new pPointChart(name); if (Elements.ContainsKey(C)) { Active = true; } //Check if control already exists if (Active) { if (Elements[C] != null) { WindObject = Elements[C]; Element = (pElement)WindObject.Element; pControl = (pPointChart)Element.PollenControl; } } else { Elements.Add(C, WindObject); } //Set Unique Control Properties IGH_Goo D = null; int M = 0; if (!DA.GetData(0, ref D)) { return; } if (!DA.GetData(1, ref M)) { return; } wObject W = new wObject(); D.CastTo(out W); DataSetCollection DC = (DataSetCollection)W.Element; if (DC.TotalCustomFill == 0) { DC.SetDefaultPallet(wGradients.Metro, false, DC.Sets.Count > 1); } if (DC.TotalCustomStroke == 0) { DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent); } if (DC.TotalCustomFont == 0) { DC.SetDefaultFonts(wFonts.ChartPoint); } if (DC.TotalCustomMarker == 0) { if (M == 2) { DC.SetDefaultMarkers(wGradients.Metro, wMarker.MarkerType.Circle, false, DC.Sets.Count > 1); } else { DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, DC.Sets.Count > 1); } } if (DC.TotalCustomLabel == 0) { DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent))); } List <pPointSeries> PointSeriesList = new List <pPointSeries>(); if (!DC.Axes.Enabled) { DC.Axes.AxisX.Enabled = true; DC.Axes.AxisY.Enabled = true; } pControl.SetProperties(DC); for (int i = 0; i < DC.Sets.Count; i++) { pPointSeries pSeriesSet = new pPointSeries(Convert.ToString(name + i)); pSeriesSet.SetProperties(DC.Sets[i]); pSeriesSet.SetRangeChartType(M); pSeriesSet.SetChartLabels(DC.Label); pSeriesSet.SetNumericData(1); PointSeriesList.Add(pSeriesSet); } pControl.SetSeries(PointSeriesList); pControl.SetAxisScale(); pControl.SetAxisAppearance(); pControl.SetXaxis(new wDomain(0, PointSeriesList[0].DataList.Count - 1)); //Set Parrot Element and Wind Object properties if (!Active) { Element = new pElement(pControl.Element, pControl, pControl.Type); } WindObject = new wObject(Element, "Pollen", Element.Type); WindObject.GUID = this.InstanceGuid; WindObject.Instance = C; Elements[this.RunCount] = WindObject; DA.SetData(0, WindObject); }
/// <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 ID = this.Attributes.InstanceGuid.ToString(); string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text; int C = this.RunCount; wObject WindObject = new wObject(); pElement Element = new pElement(); bool Active = Elements.ContainsKey(C); var pControl = new pPointChart(name); if (Elements.ContainsKey(C)) { Active = true; } //Check if control already exists if (Active) { if (Elements[C] != null) { WindObject = Elements[C]; Element = (pElement)WindObject.Element; pControl = (pPointChart)Element.PollenControl; } } else { Elements.Add(C, WindObject); } //Set Unique Control Properties IGH_Goo D = null; int M = 0; int J = 0; if (!DA.GetData(0, ref D)) { return; } if (!DA.GetData(1, ref M)) { return; } if (!DA.GetData(2, ref J)) { return; } wObject W = new wObject(); D.CastTo(out W); DataSetCollection DC = (DataSetCollection)W.Element; if (DC.TotalCustomFill == 0) { DC.SetDefaultPallet(wGradients.GradientTypes.Metro, false, DC.Sets.Count > 1); } if (DC.TotalCustomFont == 0) { DC.SetDefaultFonts(new wFonts(wFonts.FontTypes.ChartPoint).Font); } if (DC.TotalCustomMarker == 0) { DC.SetDefaultMarkers(wGradients.GradientTypes.SolidDarkGray, false, DC.Sets.Count > 1); } List <pPointSeries> PointSeriesList = new List <pPointSeries>(); for (int i = 0; i < DC.Sets.Count; i++) { pPointSeries pSeriesSet = new pPointSeries(Convert.ToString(name + i)); pSeriesSet.SetProperties(DC.Sets[i]); pSeriesSet.SetStackChartType(M, J); pSeriesSet.SetChartLabels(DC.Labels.Position, DC.Labels.HasLeader); pSeriesSet.SetNumericData(2); PointSeriesList.Add(pSeriesSet); } pControl.SetProperties(DC); pControl.SetSeries(PointSeriesList); pControl.SetAxisAppearance(); pControl.SetPyramidThreeDView(M); //Set Parrot Element and Wind Object properties if (!Active) { Element = new pElement(pControl.Element, pControl, pControl.Type); } WindObject = new wObject(Element, "Pollen", Element.Type); WindObject.GUID = this.InstanceGuid; WindObject.Instance = C; Elements[this.RunCount] = WindObject; DA.SetData(0, WindObject); }