/// <summary> /// Creates a new layer with right y axis, which is linked to the same position with top x axis and right y axis. /// </summary> public static void CreateNewLayerLinkedRightY(this GraphDocument doc, IEnumerable <int> linklayernumber) { var context = doc.GetPropertyHierarchy(); var newlayer = CreateNewLayerAtSamePosition(doc, linklayernumber); newlayer.AxisStyles.CreateDefault(new CSLineID(1, 1), context); }
/// <summary> /// Creates a new layer with bottom x axis and left y axis, which is not linked. /// </summary> public static void CreateNewLayerNormalBottomXLeftY(this GraphDocument doc) { var context = doc.GetPropertyHierarchy(); var location = new ItemLocationDirect { PositionX = RADouble.NewRel(HostLayer.DefaultChildLayerRelativePosition.X), PositionY = RADouble.NewRel(HostLayer.DefaultChildLayerRelativePosition.Y), SizeX = RADouble.NewRel(HostLayer.DefaultChildLayerRelativeSize.X), SizeY = RADouble.NewRel(HostLayer.DefaultChildLayerRelativeSize.Y) }; var newlayer = new XYPlotLayer(doc.RootLayer, location); doc.RootLayer.Layers.Add(newlayer); newlayer.CreateDefaultAxes(context); }
/// <summary> /// Creates a new layer with bottom x axis and left y axis, which is linked to the same position with top x axis and right y axis. The x axis is linked straight to the x axis of the linked layer. /// </summary> public static void CreateNewLayerLinkedTopXRightY_XAxisStraight(this GraphDocument doc, IEnumerable <int> linklayernumber) { var context = doc.GetPropertyHierarchy(); var newlayer = CreateNewLayerAtSamePosition(doc, linklayernumber); var isValidIndex = doc.RootLayer.IsValidIndex(linklayernumber, out var oldLayer); var linkedLayerAsXYPlotLayer = oldLayer as XYPlotLayer; if (null != linkedLayerAsXYPlotLayer) { // create a linked x axis of the same type than in the linked layer var scaleLinkedTo = linkedLayerAsXYPlotLayer.Scales.X; var xScale = new Scales.LinkedScale((Scales.Scale)scaleLinkedTo.Clone()); newlayer.Scales[0] = xScale; xScale.ScaleLinkedTo = scaleLinkedTo; // only now can we set the ScaleLinkedTo, because by now xScale should have a parent object } // set enabling of axis newlayer.AxisStyles.CreateDefault(new CSLineID(0, 1), context); newlayer.AxisStyles.CreateDefault(new CSLineID(1, 1), context); }