protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Custom Labels"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.ContentAlignment = ContentAlignment.MiddleCenter; radialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); radialGauge.SweepAngle = 360; radialGauge.BeginAngle = -90; NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle(); advGradient.BackgroundColor = Color.Black; advGradient.Points.Add(new NAdvancedGradientPoint(Color.White, 10, 10, 0, 100, AGPointShape.Circle)); radialGauge.BackgroundFillStyle = advGradient; nChartControl1.Panels.Add(radialGauge); NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; axis.Range = new NRange1DD(0, 60); axis.Anchor.RulerOrientation = RulerOrientation.Right; axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100); NLinearScaleConfigurator scale = (NLinearScaleConfigurator)axis.ScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(20, Color.LightGray)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.Interlaced = true; scale.StripStyles.Add(stripStyle); scale.MinorTickCount = 4; scale.MajorTickMode = MajorTickMode.CustomStep; scale.CustomStep = 5.0f; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Watch); scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Beige); scale.OuterMajorTickStyle.LineStyle = new NStrokeStyle(Color.DarkGray); scale.OuterMajorTickStyle.Length = new NLength(14); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Silver)); scale.RulerStyle.BorderStyle = new NStrokeStyle(Color.Beige); axis.UpdateScale(); axis.SynchronizeScaleWithConfigurator = false; NTextStyle textStyle1 = new NTextStyle(); textStyle1.FillStyle = new NColorFillStyle(Color.White); textStyle1.BorderStyle = new NStrokeStyle(1, Color.Beige); textStyle1.FontStyle.Style = FontStyle.Bold; textStyle1.FontStyle.EmSize = new NLength(22); NScaleLabelAngle angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 0); NTextStyle textStyle2 = new NTextStyle(); textStyle2.FillStyle = new NColorFillStyle(Color.White); textStyle2.BorderStyle = new NStrokeStyle(1, Color.Beige); textStyle2.FontStyle.Style = FontStyle.Bold; textStyle2.FontStyle.EmSize = new NLength(12); NCustomScaleDecorator customDecorator = new NCustomScaleDecorator(); for (int i = 12; i > 0; i--) { string text = NSystem.IntToRoman(i); NValueScaleLabel hourLabel; NValueScaleLabelStyle valueLabelStyle = new NValueScaleLabelStyle(); valueLabelStyle.ContentAlignment = ContentAlignment.MiddleCenter; valueLabelStyle.Angle = angle; if (i % 3 == 0) { valueLabelStyle.TextStyle = (NTextStyle)textStyle1.Clone(); hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, valueLabelStyle); } else { valueLabelStyle.TextStyle = (NTextStyle)textStyle2.Clone(); hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, valueLabelStyle); } customDecorator.Decorations.Add(hourLabel); } NScaleLevel textLevel = (NScaleLevel)axis.Scale.Levels[1]; textLevel.Decorators.Clear(); textLevel.Decorators.Add(customDecorator); m_HoursArrow = new NNeedleValueIndicator(); m_HoursArrow.Value = 79; m_HoursArrow.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_HoursArrow.Shape.StrokeStyle.Color = Color.Red; m_HoursArrow.OffsetFromScale = new NLength(10); m_HoursArrow.Width = new NLength(8); radialGauge.Indicators.Add(m_HoursArrow); m_MinituesArrow = new NNeedleValueIndicator(); m_MinituesArrow.Value = 79; m_MinituesArrow.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_MinituesArrow.Shape.StrokeStyle.Color = Color.Red; m_MinituesArrow.OffsetFromScale = new NLength(5); m_MinituesArrow.Width = new NLength(5); radialGauge.Indicators.Add(m_MinituesArrow); m_SecondsArrow = new NNeedleValueIndicator(); m_SecondsArrow.Value = 79; m_SecondsArrow.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_SecondsArrow.Shape.StrokeStyle.Color = Color.Red; m_SecondsArrow.OffsetFromScale = new NLength(0); m_SecondsArrow.Width = new NLength(1); radialGauge.Indicators.Add(m_SecondsArrow); SynchronizeWithTime(); }
private void CreateScene(NDrawingDocument document) { document.BackgroundStyle.FrameStyle.Visible = false; NFillStyle cpaFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(102, 204, 255), Color.FromArgb(0, 128, 128)); NFillStyle clientFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(255, 102, 0), Color.FromArgb(255, 204, 0)); NFillStyle stripeFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.FromArgb(221, 221, 221)); NTextStyle abcTextStyle = new NTextStyle(new Font("Arial", 12), Color.FromArgb(150, 150, 150)); float abcWidth = 150; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); // configure the document helper.DefaultGridCellSize = new NSizeF(100, 70); helper.DefaultGridSpacing = new NSizeF(30, 30); helper.DefaultGridOrigin = new NPointF(60, 30); document.Bounds = new NRectangleF(0, 0, 1000, (6 * helper.DefaultGridCellSize.Height) + (7 * helper.DefaultGridSpacing.Height)); document.ShadowsZOrder = ShadowsZOrder.BehindLayer; // create the stripes NRectangleShape rect = new NRectangleShape(0, 0, document.Width, document.Height / 3); rect.Style.FillStyle = (NFillStyle)stripeFillStyle.Clone(); rect.Style.StrokeStyle = new NStrokeStyle(0, Color.White); document.ActiveLayer.AddChild(rect); rect = new NRectangleShape(0, document.Height / 3, document.Width, document.Height / 3); rect.Style.FillStyle = (NFillStyle)stripeFillStyle.Clone(); rect.Style.StrokeStyle = new NStrokeStyle(0, Color.White); document.ActiveLayer.AddChild(rect); rect = new NRectangleShape(0, 2 * document.Height / 3, document.Width, document.Height / 3); rect.Style.FillStyle = (NFillStyle)stripeFillStyle.Clone(); rect.Style.StrokeStyle = new NStrokeStyle(0, Color.White); document.ActiveLayer.AddChild(rect); // create A,B,C texts NTextShape text = new NTextShape("A", document.Width - abcWidth, 0, abcWidth, document.Height / 3); text.Mode = BoxTextMode.Stretch; text.Style.TextStyle = (abcTextStyle.Clone() as NTextStyle); document.ActiveLayer.AddChild(text); text = new NTextShape("B", document.Width - abcWidth, document.Height / 3, abcWidth, document.Height / 3); text.Mode = BoxTextMode.Stretch; text.Style.TextStyle = (abcTextStyle.Clone() as NTextStyle); document.ActiveLayer.AddChild(text); text = new NTextShape("C", document.Width - abcWidth, 2 * document.Height / 3, abcWidth, document.Height / 3); text.Mode = BoxTextMode.Stretch; text.Style.TextStyle = (abcTextStyle.Clone() as NTextStyle); document.ActiveLayer.AddChild(text); // add stripe texts text = new NTextShape("Sing up client", document.Width - abcWidth, document.Height / 3 - 50, abcWidth, 50); document.ActiveLayer.AddChild(text); text = new NTextShape("Monthly Accounting Services", document.Width - abcWidth, 2 * document.Height / 3 - 50, abcWidth, 50); document.ActiveLayer.AddChild(text); text = new NTextShape("Additional Services", document.Width - abcWidth, 3 * document.Height / 3 - 50, abcWidth, 50); document.ActiveLayer.AddChild(text); // create a layer for the forground shapes NLayer layer = new NLayer(); document.Layers.AddChild(layer); document.ActiveLayerUniqueId = layer.UniqueId; layer.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.Gray, new Nevron.GraphicsCore.NPointL(5, 5), 1, new NLength(10)); // shapes in row 1 NShape newClient = helper.CreateBasicShape(BasicShapes.Diamond, helper.GetGridCell(0, 0), "New Client", cpaFillStyle); NShape register = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(0, 1), "Register", cpaFillStyle); NShape clientAccountInfo = helper.CreateFlowChartingShape(FlowChartingShapes.Data, helper.GetGridCell(0, 2), "Client account info", cpaFillStyle); NShape explainDataEntryProcedures = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(0, 3), "Explain data entry procedures", cpaFillStyle); // shapes in row 2 NShape dataEntry = helper.CreateFlowChartingShape(FlowChartingShapes.ManualInput, helper.GetGridCell(2, 0), "Data Entry", clientFillStyle); NShape emailCompleted = helper.CreateFlowChartingShape(FlowChartingShapes.Document, helper.GetGridCell(2, 1), "E-mail Completed", clientFillStyle); NShape review = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(2, 2), "Review", cpaFillStyle); NShape needsRevising = helper.CreateBasicShape(BasicShapes.Diamond, helper.GetGridCell(2, 3), "Needs revising", cpaFillStyle); NShape emailRevisions = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(2, 4), "E-mail revisions", cpaFillStyle); NShape evaluateRevisions = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(2, 5), "Evaluate revisions", clientFillStyle); // shapes in row 3 NShape emailApprovedRevisions = helper.CreateFlowChartingShape(FlowChartingShapes.Document, helper.GetGridCell(3, 2), "E-mail Approved Revisions", clientFillStyle); NShape evaluateRevisions2 = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(3, 4), "Evaluate Revisions", clientFillStyle); NShape answerClientEmail = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(3, 5), "Answer Client E-mail", cpaFillStyle); // shapes in row 4 NShape paywoll = helper.CreateFlowChartingShape(FlowChartingShapes.Document, helper.GetGridCell(5, 2), "Payroll", clientFillStyle); NShape taxes = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(5, 3), "Taxes", clientFillStyle); NShape controller = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(5, 4), "Controller", cpaFillStyle); // create the optional ports of the shape evaluateRevisions.CreateShapeElements(ShapeElementsMask.Ports); // some shapes need to have extra ports NRotatedBoundsPort port = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(-25, 50)); port.Name = "BottomLeft"; evaluateRevisions.Ports.AddChild(port); port = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(+25, 50)); port.Name = "BottomRight"; evaluateRevisions.Ports.AddChild(port); // create the optional ports of the shape answerClientEmail.CreateShapeElements(ShapeElementsMask.Ports); port = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(-25, -50)); port.Name = "TopLeft"; answerClientEmail.Ports.AddChild(port); port = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(+25, -50)); port.Name = "TopRight"; answerClientEmail.Ports.AddChild(port); // connect shapes in levels helper.CreateConnector(newClient, "Center", register, "Center", ConnectorType.Line, "YES"); helper.CreateConnector(register, "Center", clientAccountInfo, "Center", ConnectorType.Line, ""); helper.CreateConnector(clientAccountInfo, "Center", explainDataEntryProcedures, "Center", ConnectorType.Line, ""); helper.CreateConnector(dataEntry, "Center", emailCompleted, "Center", ConnectorType.Line, ""); helper.CreateConnector(emailCompleted, "Center", review, "Center", ConnectorType.Line, ""); helper.CreateConnector(review, "Center", needsRevising, "Center", ConnectorType.Line, ""); helper.CreateConnector(needsRevising, "Center", emailRevisions, "Center", ConnectorType.Line, "YES"); helper.CreateConnector(emailRevisions, "Center", evaluateRevisions, "Center", ConnectorType.Line, ""); helper.CreateConnector(evaluateRevisions2, "Center", emailApprovedRevisions, "Center", ConnectorType.Line, ""); // connect accross levels NStep3Connector connector = (helper.CreateConnector(newClient, "Center", dataEntry, "Center", ConnectorType.SideToSide, "NO") as NStep3Connector); connector.UseMiddleControlPointPercent = false; connector.MiddleControlPointOffset = -50; helper.CreateConnector(explainDataEntryProcedures, "Center", dataEntry, "Center", ConnectorType.TopToBottom, ""); helper.CreateConnector(emailApprovedRevisions, "Center", review, "Center", ConnectorType.Line, ""); helper.CreateConnector(emailRevisions, "Center", evaluateRevisions2, "Center", ConnectorType.Line, ""); helper.CreateConnector(evaluateRevisions, "BottomLeft", answerClientEmail, "TopLeft", ConnectorType.Line, ""); helper.CreateConnector(answerClientEmail, "TopRight", evaluateRevisions, "BottomRight", ConnectorType.Line, ""); connector = (helper.CreateConnector(needsRevising, "Center", paywoll, "Center", ConnectorType.TopToBottom, "") as NStep3Connector); connector.MiddleControlPointPercent = 66; connector = (helper.CreateConnector(needsRevising, "Center", taxes, "Center", ConnectorType.TopToBottom, "") as NStep3Connector); connector.MiddleControlPointPercent = 66; connector = (helper.CreateConnector(needsRevising, "Center", controller, "Center", ConnectorType.TopToBottom, "") as NStep3Connector); connector.MiddleControlPointPercent = 66; // create the legend NGroup legend = new NGroup(); NRectangleShape ledendBackground = new NRectangleShape(0, 0, 1, 3); ledendBackground.Style.FillStyle = new NColorFillStyle(Color.White); legend.Shapes.AddChild(ledendBackground); NTextShape legendTitle = new NTextShape("Legend", 0, 0, 1, 1); legend.Shapes.AddChild(legendTitle); NRectangleF bounds = new NRectangleF(0, 1, 1, 1); bounds.Inflate(-0.2f, -0.2f); NShape shape = helper.CreateBasicShape(BasicShapes.Rectangle, bounds, "CPA", (NFillStyle)cpaFillStyle.Clone(), false); legend.Shapes.AddChild(shape); bounds = new NRectangleF(0, 2, 1, 1); bounds.Inflate(-0.2f, -0.2f); shape = helper.CreateBasicShape(BasicShapes.Rectangle, bounds, "Client", (NFillStyle)clientFillStyle.Clone(), false); legend.Shapes.AddChild(shape); legend.UpdateModelBounds(); legend.Bounds = helper.GetGridCell(4, 0, 1, 1); document.ActiveLayer.AddChild(legend); }