private NNumericDisplayPanel CreateNumericDisplay() { NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel(); numericDisplay.Size = new NSizeL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage)); numericDisplay.DockMode = PanelDockMode.Bottom; numericDisplay.BoundsMode = BoundsMode.Fit; numericDisplay.Margins = new NMarginsL(10, 10, 10, 10); numericDisplay.ContentAlignment = ContentAlignment.MiddleCenter; return(numericDisplay); }
public override void Initialize() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Numeric Display Panel"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); header.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); NDockPanel dockPanel = new NDockPanel(); dockPanel.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage)); dockPanel.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); dockPanel.ContentAlignment = ContentAlignment.MiddleCenter; nChartControl1.Panels.Add(dockPanel); m_NumericDisplay1 = CreateDisplayPanel(); m_NumericDisplay2 = CreateDisplayPanel(); m_NumericDisplay3 = CreateDisplayPanel(); dockPanel.ChildPanels.Add(m_NumericDisplay1); dockPanel.ChildPanels.Add(m_NumericDisplay2); dockPanel.ChildPanels.Add(m_NumericDisplay3); nChartControl1.Refresh(); // init form controls CellSizeComboBox.Items.Add("Small"); CellSizeComboBox.Items.Add("Normal"); CellSizeComboBox.Items.Add("Large"); CellSizeComboBox.SelectedIndex = 1; DisplayStyleComboBox.FillFromEnum(typeof(DisplayStyle)); DisplayStyleComboBox.SelectedIndex = (int)DisplayStyle.SevenSegmentRounded; SignModeComboBox.FillFromEnum(typeof(DisplaySignMode)); SignModeComboBox.SelectedIndex = (int)DisplaySignMode.Never; DataFeedTimer.Start(); }
private NNumericDisplayPanel CreateDisplayPanel() { NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel(); numericDisplay.UseAutomaticSize = true; numericDisplay.DockMode = PanelDockMode.Top; numericDisplay.Value = 0; numericDisplay.CellCountMode = DisplayCellCountMode.Fixed; numericDisplay.CellCount = 7; numericDisplay.Margins = new NMarginsL(10, 10, 10, 10); numericDisplay.Padding = new NMarginsL(10, 10, 10, 10); numericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.Black); // adjust cell fill styles numericDisplay.LitFillStyle = new NColorFillStyle(Color.GreenYellow); numericDisplay.DimFillStyle.SetTransparencyPercent(50); numericDisplay.DecimalLitFillStyle = new NColorFillStyle(Color.Red); numericDisplay.DecimalDimFillStyle.SetTransparencyPercent(50); numericDisplay.BorderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); numericDisplay.PaintEffect = new NGelEffectStyle(); return(numericDisplay); }
private NNumericDisplayPanel CreateDisplayPanel() { NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel(); numericDisplay.UseAutomaticSize = true; numericDisplay.DockMode = PanelDockMode.Top; numericDisplay.Value = 0; numericDisplay.CellCountMode = DisplayCellCountMode.Fixed; numericDisplay.CellCount = 8; numericDisplay.Margins = new NMarginsL(10, 5, 10, 5); numericDisplay.Padding = new NMarginsL(7, 7, 7, 7); // apply border, background and paint effect numericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.Black); NEdgeBorderStyle border = new NEdgeBorderStyle(BorderShape.RoundedRect); border.InnerBevelWidth = new NLength(1); border.OuterBevelWidth = new NLength(1); border.MiddleBevelWidth = new NLength(1); numericDisplay.BorderStyle = border; numericDisplay.PaintEffect = new NGelEffectStyle(); // adjust cell fill styles numericDisplay.LitFillStyle = new NColorFillStyle(Color.GreenYellow); numericDisplay.DimFillStyle.SetTransparencyPercent(50); numericDisplay.DecimalLitFillStyle = new NColorFillStyle(Color.Red); numericDisplay.DecimalDimFillStyle.SetTransparencyPercent(50); // adjust cell sizes numericDisplay.CellSize = new NSizeL(new NLength(15), new NLength(30)); numericDisplay.DecimalCellSize = new NSizeL(new NLength(15), new NLength(30)); numericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); numericDisplay.SegmentWidth = new NLength(2.4f, NGraphicsUnit.Point); return(numericDisplay); }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Radial Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 20; m_Indicator1.FillStyle = new NGradientFillStyle(GradientStyle.StartToEnd, GradientVariant.Variant1, Color.Yellow, Color.Red); m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.EndWidth = new NLength(20); m_RadialGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NNeedleValueIndicator(); m_Indicator2.Value = 79; m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_Indicator2.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(m_Indicator2); m_RadialGauge.SweepAngle = 270; // add radial gauge nChartControl1.Panels.Add(m_RadialGauge); // create and configure a numeric display attached to the radial gauge m_NumericDisplay = new NNumericDisplayPanel(); m_NumericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); m_NumericDisplay.ContentAlignment = ContentAlignment.TopCenter; m_NumericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); m_NumericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); m_NumericDisplay.CellSize = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point)); m_NumericDisplay.DecimalCellSize = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point)); m_NumericDisplay.ShowDecimalSeparator = false; m_NumericDisplay.CellAlignment = VertAlign.Top; m_NumericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); m_NumericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); m_NumericDisplay.CellCountMode = DisplayCellCountMode.Fixed; m_NumericDisplay.CellCount = 6; m_NumericDisplay.Padding = new NMarginsL(6, 3, 6, 3); m_RadialGauge.ChildPanels.Add(m_NumericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); m_NumericDisplay.BorderStyle = borderStyle; // init form controls NExampleHelpers.BindComboToItemSource(SweepAngleComboBox, -360, 360, 10); SweepAngleComboBox.SelectedItem = (int)m_RadialGauge.SweepAngle; NExampleHelpers.BindComboToItemSource(BeginAngleComboBox, -360, 360, 10); BeginAngleComboBox.SelectedItem = (int)m_RadialGauge.BeginAngle; NExampleHelpers.FillComboWithEnumValues(ValueIndicatorShapeComboBox, typeof(SmartShape1D)); ValueIndicatorShapeComboBox.SelectedIndex = (int)SmartShape1D.Arrow2; NExampleHelpers.BindComboToItemSource(ValueIndicatorComboBox, 0, 100, 1); ValueIndicatorComboBox.SelectedItem = (int)m_Indicator2.Value; NExampleHelpers.BindComboToItemSource(RangeIndicatorValueComboBox, 0, 100, 5); RangeIndicatorValueComboBox.SelectedItem = (int)m_Indicator1.Value; NExampleHelpers.FillComboWithEnumValues(RangeIndicatorOriginModeComboBox, typeof(OriginMode)); RangeIndicatorOriginModeComboBox.SelectedIndex = 0; NExampleHelpers.BindComboToItemSource(NeedleWidthComboBox, -20, 60, 5); NeedleWidthComboBox.SelectedItem = (int)m_Indicator2.Width.Value; NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, 0, 100, 5); RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin; }
public override void Initialize() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Indicator Value Dampening"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 20; m_Indicator1.FillStyle = new NGradientFillStyle(Color.Yellow, Color.Red); m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.EndWidth = new NLength(20); m_RadialGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NNeedleValueIndicator(); m_Indicator2.Value = 79; m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_Indicator2.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(m_Indicator2); m_RadialGauge.SweepAngle = 270; // add radial gauge nChartControl1.Panels.Add(m_RadialGauge); // create and configure a numeric display attached to the radial gauge m_NumericDisplay = new NNumericDisplayPanel(); m_NumericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); m_NumericDisplay.ContentAlignment = ContentAlignment.TopCenter; m_NumericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); m_NumericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); m_NumericDisplay.CellSize = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point)); m_NumericDisplay.DecimalCellSize = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point)); m_NumericDisplay.ShowDecimalSeparator = false; m_NumericDisplay.CellAlignment = VertAlign.Top; m_NumericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); m_NumericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); m_NumericDisplay.CellCountMode = DisplayCellCountMode.Fixed; m_NumericDisplay.CellCount = 6; m_NumericDisplay.Padding = new NMarginsL(6, 3, 6, 3); m_RadialGauge.ChildPanels.Add(m_NumericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); m_NumericDisplay.BorderStyle = borderStyle; // init form controls EnableValueDampeningCheckBox.Checked = true; DampeningIntervalUpDown.Value = 50; DampeningStepsUpDown.Value = 10; m_Timer.Interval = 200; m_Timer.Start(); }
public override void Initialize(NThinChartControl control) { control.BackgroundStyle.FrameStyle.Visible = false; control.Panels.Clear(); // set a chart title NLabel header = new NLabel("Indicator Drag Tool"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); control.Panels.Add(header); // create the radial gauge NRadialGaugePanel m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators NRangeIndicator rangeIndicator = new NRangeIndicator(); rangeIndicator.Value = 20; rangeIndicator.FillStyle = new NGradientFillStyle(Color.Yellow, Color.Red); rangeIndicator.StrokeStyle.Color = Color.DarkBlue; rangeIndicator.EndWidth = new NLength(20); NInteractivityStyle interactivityStyle1 = new NInteractivityStyle(); interactivityStyle1.Tooltip.Text = "Drag Me"; // interactivityStyle1.ClientMouseEventAttribute.Tag = "Indicator[" + m_Indicator1.UniqueId.ToString() + "]"; rangeIndicator.InteractivityStyle = interactivityStyle1; m_RadialGauge.Indicators.Add(rangeIndicator); NNeedleValueIndicator needleIndicator = new NNeedleValueIndicator(); needleIndicator.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); needleIndicator.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(needleIndicator); m_RadialGauge.SweepAngle = 270; // add radial gauge control.Panels.Add(m_RadialGauge); // create and config ure a numeric display attached to the radial gauge NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel(); numericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); numericDisplay.ContentAlignment = ContentAlignment.TopCenter; numericDisplay.DisplayStyle = DisplayStyle.SevenSegmentRounded; numericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); numericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); numericDisplay.CellSize = new NSizeL(new NLength(9, NGraphicsUnit.Point), new NLength(19, NGraphicsUnit.Point)); numericDisplay.ShowDecimalSeparator = true; numericDisplay.ShowLeadingZeros = true; numericDisplay.EnableDecimalFormatting = false; numericDisplay.CellCountMode = DisplayCellCountMode.Auto; numericDisplay.CellCount = 6; numericDisplay.ValueFormatter = new NNumericValueFormatter("00.00"); numericDisplay.CellAlignment = VertAlign.Top; numericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); numericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); numericDisplay.CellCountMode = DisplayCellCountMode.Fixed; numericDisplay.CellCount = 6; numericDisplay.Padding = new NMarginsL(3, 2, 3, 2); m_RadialGauge.ChildPanels.Add(numericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); numericDisplay.BorderStyle = borderStyle; NIndicatorDragTool indicatorDragTool = new NIndicatorDragTool(); indicatorDragTool.IndicatorDragCallback = new IndicatorDragCallback(); control.Controller.Tools.Add(indicatorDragTool); control.Controller.Tools.Add(new NTooltipTool()); NRangeIndicator range = (NRangeIndicator)control.Gauges[0].Indicators[0]; range.AllowDragging = true; if (range.AllowDragging) { range.InteractivityStyle.Tooltip.Text = "Drag Me"; } else { range.InteractivityStyle.Tooltip.Text = range.Range.End.ToString(); } NNeedleValueIndicator needle = (NNeedleValueIndicator)control.Gauges[0].Indicators[1]; needle.AllowDragging = true; if (needle.AllowDragging) { needle.InteractivityStyle.Tooltip.Text = "Drag Me"; } else { needle.InteractivityStyle.Tooltip.Text = needle.Value.ToString(); } }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Radial Gauge Knob Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.DockMode = PanelDockMode.Top; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); header.Margins = new NMarginsL(5, 5, 5, 5); nChartControl1.Panels.Add(header); NDockPanel panelContainer = new NDockPanel(); panelContainer.DockMode = PanelDockMode.Fill; // create the knob indicator NKnobIndicator knobIndicator = new NKnobIndicator(); knobIndicator.OffsetFromScale = new NLength(-5); knobIndicator.OuterRimStyle.PatternRepeatCount = 5; knobIndicator.InnerRimStyle.PatternRepeatCount = 5; //knobIndicator.InnerRimStyle.Offset = new NLength(10); // apply fill style to the marker NAdvancedGradientFillStyle advancedGradientFill = new NAdvancedGradientFillStyle(); advancedGradientFill.BackgroundColor = Color.Red; advancedGradientFill.Points.Add(new NAdvancedGradientPoint(Color.White, 20, 20, 0, 100, AGPointShape.Circle)); knobIndicator.MarkerShape.FillStyle = advancedGradientFill; knobIndicator.ValueChanged += knobIndicator_ValueChanged; m_RadialGauge = CreateRadialGauge(knobIndicator); m_NumericDisplay = CreateNumericDisplay(); panelContainer.ChildPanels.Add(m_NumericDisplay); panelContainer.ChildPanels.Add(m_RadialGauge); panelContainer.Margins = new NMarginsL(10, 10, 10, 10); nChartControl1.Panels.Add(panelContainer); nChartControl1.Controller.Tools.Add(new NSelectorTool()); nChartControl1.Controller.Tools.Add(new NIndicatorDragTool()); m_Updating = true; // Init form controls NExampleHelpers.FillComboWithEnumValues(MarkerShapeComboBox, typeof(SmartShape2D)); MarkerShapeComboBox.SelectedIndex = (int)SmartShape2D.Ellipse; NExampleHelpers.BindComboToItemSource(MarkerOffsetComboBox, -100, 100, 5); MarkerOffsetComboBox.SelectedItem = (int)knobIndicator.OffsetFromScale.Value; NExampleHelpers.FillComboWithEnumValues(MarkerPaintOrderComboBox, typeof(KnobMarkerPaintOrder)); MarkerPaintOrderComboBox.SelectedIndex = (int)knobIndicator.MarkerPaintOrder; // outer rim NExampleHelpers.FillComboWithEnumValues(OuterRimPatternComboBox, typeof(CircularRimPattern)); OuterRimPatternComboBox.SelectedIndex = (int)knobIndicator.OuterRimStyle.Pattern; NExampleHelpers.BindComboToItemSource(OuterRimPatternRepeatCountComboBox, 0, 100, 5); OuterRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.PatternRepeatCount; NExampleHelpers.BindComboToItemSource(OuterRimRadiusOffsetComboBox, 0, 100, 5); OuterRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.Offset.Value; // inner rim NExampleHelpers.FillComboWithEnumValues(InnerRimPatternComboBox, typeof(CircularRimPattern)); InnerRimPatternComboBox.SelectedIndex = (int)knobIndicator.InnerRimStyle.Pattern; NExampleHelpers.BindComboToItemSource(InnerRimPatternRepeatCountComboBox, 0, 100, 5); InnerRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.PatternRepeatCount; NExampleHelpers.BindComboToItemSource(InnerRimRadiusOffsetComboBox, 0, 100, 5); InnerRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.Offset.Value; m_Updating = false; OuterRimPatternRepeatCountComboBox.SelectedItem = 6; }
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("Radial Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 20; m_Indicator1.FillStyle = new NGradientFillStyle(Color.Yellow, Color.Red); m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.EndWidth = new NLength(20); m_RadialGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NNeedleValueIndicator(); m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_Indicator2.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(m_Indicator2); m_RadialGauge.SweepAngle = 270; // add radial gauge nChartControl1.Panels.Add(m_RadialGauge); // create and configure a numeric display attached to the radial gauge m_NumericDisplay = new NNumericDisplayPanel(); m_NumericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); m_NumericDisplay.ContentAlignment = ContentAlignment.TopCenter; m_NumericDisplay.DisplayStyle = DisplayStyle.SevenSegmentRounded; m_NumericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); m_NumericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); m_NumericDisplay.CellSize = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point)); m_NumericDisplay.DecimalCellSize = new NSizeL(new NLength(7, NGraphicsUnit.Point), new NLength(15, NGraphicsUnit.Point)); m_NumericDisplay.ShowDecimalSeparator = false; m_NumericDisplay.CellAlignment = VertAlign.Top; m_NumericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); m_NumericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); m_NumericDisplay.CellCountMode = DisplayCellCountMode.Fixed; m_NumericDisplay.CellCount = 6; m_NumericDisplay.Padding = new NMarginsL(3, 2, 3, 2); m_RadialGauge.ChildPanels.Add(m_NumericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); m_NumericDisplay.BorderStyle = borderStyle; // init form controls if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithValues(ValueIndicatorDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(RangeIndicatorValueDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(RangeIndicatorOriginDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(SweepAngleDropDownList, -360, 360, 45); WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, -360, 360, 45); SweepAngleDropDownList.SelectedValue = m_RadialGauge.SweepAngle.ToString(); BeginAngleDropDownList.SelectedValue = m_RadialGauge.BeginAngle.ToString(); WebExamplesUtilities.FillComboWithEnumValues(ValueIndicatorShapeDropDownList, typeof(SmartShape1D)); ValueIndicatorShapeDropDownList.SelectedIndex = (int)SmartShape1D.Triangle; ValueIndicatorDropDownList.SelectedValue = "20"; RangeIndicatorValueDropDownList.SelectedValue = m_Indicator1.Value.ToString(); WebExamplesUtilities.FillComboWithEnumValues(RangeIndicatorOriginModeDropDownList, typeof(OriginMode)); RangeIndicatorOriginModeDropDownList.SelectedIndex = 0; RangeIndicatorOriginDropDownList.SelectedIndex = 0; } m_Indicator1.Value = Convert.ToDouble(RangeIndicatorValueDropDownList.SelectedValue); m_Indicator1.Origin = Convert.ToDouble(RangeIndicatorOriginDropDownList.SelectedValue); m_Indicator1.OriginMode = (OriginMode)RangeIndicatorOriginModeDropDownList.SelectedIndex; m_RadialGauge.BeginAngle = (float)Convert.ToDecimal(BeginAngleDropDownList.SelectedValue); m_RadialGauge.SweepAngle = (float)Convert.ToDecimal(SweepAngleDropDownList.SelectedValue); N1DSmartShapeFactory factory = new N1DSmartShapeFactory(m_Indicator2.Shape.FillStyle, m_Indicator2.Shape.StrokeStyle, m_Indicator2.Shape.ShadowStyle); m_Indicator2.Shape = factory.CreateShape((SmartShape1D)ValueIndicatorShapeDropDownList.SelectedIndex); m_Indicator2.Value = Convert.ToDouble(ValueIndicatorDropDownList.SelectedValue); m_NumericDisplay.Value = m_Indicator2.Value; if (m_Indicator1.OriginMode != OriginMode.Custom) { RangeIndicatorOriginDropDownList.Enabled = false; } else { RangeIndicatorOriginDropDownList.Enabled = true; } }
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("Numeric Display"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); NDockPanel displayContainer = new NDockPanel(); displayContainer.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); displayContainer.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage)); Random rand = new Random(); m_NumericDisplay1 = CreateDisplayPanel(); m_NumericDisplay1.Value = rand.Next(100) - 50; m_NumericDisplay2 = CreateDisplayPanel(); m_NumericDisplay2.Value = rand.Next(1000) - 500; m_NumericDisplay3 = CreateDisplayPanel(); m_NumericDisplay3.Value = rand.Next(10000) - 5000; displayContainer.ChildPanels.Add(m_NumericDisplay1); displayContainer.ChildPanels.Add(m_NumericDisplay2); displayContainer.ChildPanels.Add(m_NumericDisplay3); nChartControl1.Panels.Add(displayContainer); if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(DisplayStyleDropDownList, typeof(DisplayStyle)); DisplayStyleDropDownList.SelectedIndex = (int)DisplayStyle.SevenSegmentRounded; WebExamplesUtilities.FillComboWithEnumValues(SignModeDropDownList, typeof(DisplaySignMode)); SignModeDropDownList.SelectedIndex = (int)DisplaySignMode.Always; } m_NumericDisplay1.DisplayStyle = (DisplayStyle)DisplayStyleDropDownList.SelectedIndex; m_NumericDisplay2.DisplayStyle = (DisplayStyle)DisplayStyleDropDownList.SelectedIndex; m_NumericDisplay3.DisplayStyle = (DisplayStyle)DisplayStyleDropDownList.SelectedIndex; m_NumericDisplay1.SignMode = (DisplaySignMode)SignModeDropDownList.SelectedIndex; m_NumericDisplay2.SignMode = (DisplaySignMode)SignModeDropDownList.SelectedIndex; m_NumericDisplay3.SignMode = (DisplaySignMode)SignModeDropDownList.SelectedIndex; m_NumericDisplay1.ShowLeadingZeros = ShowLeadingZerosCheckBox.Checked; m_NumericDisplay2.ShowLeadingZeros = ShowLeadingZerosCheckBox.Checked; m_NumericDisplay3.ShowLeadingZeros = ShowLeadingZerosCheckBox.Checked; m_NumericDisplay1.AttachSignToNumber = AttachSignToNumberCheckBox.Checked; m_NumericDisplay2.AttachSignToNumber = AttachSignToNumberCheckBox.Checked; m_NumericDisplay3.AttachSignToNumber = AttachSignToNumberCheckBox.Checked; }