private NLinearGaugePanel CreateVerticalLinearGauge() { NLinearGaugePanel linearGauge = new NLinearGaugePanel(); linearGauge.Orientation = LinearGaugeOrientation.Vertical; linearGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage)); linearGauge.Size = new NSizeL(new NLength(60, NGraphicsUnit.Point), new NLength(50, NRelativeUnit.ParentPercentage)); linearGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); linearGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // add indicators m_VertLinearIndicator1 = new NRangeIndicator(); m_VertLinearIndicator1.Value = 10; m_VertLinearIndicator1.FillStyle = new NGradientFillStyle(Color.LightBlue, Color.DarkBlue); m_VertLinearIndicator1.StrokeStyle.Color = Color.DarkBlue; linearGauge.Indicators.Add(m_VertLinearIndicator1); m_VertLinearIndicator2 = new NMarkerValueIndicator(); m_VertLinearIndicator2.Value = 50; linearGauge.Indicators.Add(m_VertLinearIndicator2); NGaugeAxis axis = (NGaugeAxis)linearGauge.Axes[0]; axis.Anchor = new NModelGaugeAxisAnchor(); ConfigureAxis(axis); return(linearGauge); }
private void CreateRadialGauge() { // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); nChartControl1.Panels.Add(m_RadialGauge); // create the radial gauge m_RadialGauge.SweepAngle = 270; m_RadialGauge.BeginAngle = -90; // set some background NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle(); advGradient.BackgroundColor = Color.Black; advGradient.Points.Add(new NAdvancedGradientPoint(Color.LightGray, 10, 10, 0, 100, AGPointShape.Circle)); m_RadialGauge.BackgroundFillStyle = advGradient; // configure the axis NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; axis.Range = new NRange1DD(0, 100); axis.Anchor.RulerOrientation = RulerOrientation.Right; axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100); ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator); // add some indicators NNeedleValueIndicator needle = new NNeedleValueIndicator(60); needle.OffsetFromScale = new NLength(0); m_RadialGauge.Indicators.Add(needle); }
private NRadialGaugePanel CreateGauge() { NRadialGaugePanel radialGauge = new NRadialGaugePanel(); // create gauge panel radialGauge.AutoBorder = RadialGaugeAutoBorder.Circle; radialGauge.BeginAngle = 130; radialGauge.SweepAngle = 280; radialGauge.DockMode = PanelDockMode.Fill; // apply paint effects radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); // Configure the axis NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelFitModes = new LabelFitMode[0]; scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0, false); scale.MinorTickCount = 2; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.LightGray)); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); // add needle value indicator radialGauge.Indicators.Add(new NNeedleValueIndicator()); return(radialGauge); }
private void CreateRadialGauge() { // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); nChartControl1.Panels.Add(m_RadialGauge); // create the radial gauge m_RadialGauge.BeginAngle = -225; m_RadialGauge.SweepAngle = 270; // set some background m_RadialGauge.BackgroundFillStyle = new NColorFillStyle(Color.Black);; m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); // configure the axis NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; axis.Range = new NRange1DD(0, 100); axis.Anchor.RulerOrientation = RulerOrientation.Right; axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100); ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator); // add some indicators AddRangeIndicatorToGauge(m_RadialGauge); NNeedleValueIndicator needle = new NNeedleValueIndicator(60); needle.OffsetFromScale = new NLength(15); m_RadialGauge.Indicators.Add(needle); LinearGaugeOrientationComboBox.SelectedIndex = 0; }
private void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark) { NGaugeAxis axis = (NGaugeAxis)panel.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; // create a range indicator NRangeIndicator rangeIndicator = new NRangeIndicator(); rangeIndicator.OriginMode = OriginMode.Custom; rangeIndicator.Value = range.Begin; rangeIndicator.Origin = range.End; rangeIndicator.BeginWidth = new NLength(10); rangeIndicator.EndWidth = new NLength(10); rangeIndicator.FillStyle = new NColorFillStyle(Color.FromArgb(100, colorLight)); rangeIndicator.StrokeStyle.Color = colorLight; panel.Indicators.Add(rangeIndicator); // create a scale section NScaleSectionStyle scaleSection = new NScaleSectionStyle(); scaleSection.Range = range; scaleSection.MajorTickStrokeStyle = new NStrokeStyle(colorLight); scaleSection.MinorTickStrokeStyle = new NStrokeStyle(1, colorLight, LinePattern.Dot, 0, 2); NTextStyle labelStyle = new NTextStyle(); labelStyle.FillStyle = new NGradientFillStyle(colorLight, colorDark); labelStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); scaleSection.LabelTextStyle = labelStyle; scale.Sections.Add(scaleSection); }
private NRadialGaugePanel CreateRadialGauge(NKnobIndicator knobIndicator) { // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.Size = new NSizeL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage)); radialGauge.ContentAlignment = ContentAlignment.MiddleCenter; radialGauge.DockMode = PanelDockMode.Fill; radialGauge.SweepAngle = 270; radialGauge.BeginAngle = -225; radialGauge.CapStyle.Visible = false; radialGauge.Indicators.Add(knobIndicator); // configure scale NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Italic); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.Black); 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); return(radialGauge); }
public override void Initialize() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Tooltips"); 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 NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.BackgroundFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.WhiteOnBlack, 0); // configure scale NLinearScaleConfigurator scale = ((NGaugeAxis)radialGauge.Axes[0]).ScaleConfigurator as NLinearScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke); scale.LabelFitModes = new LabelFitMode[0]; scale.MinorTickCount = 3; scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.White)); scale.OuterMajorTickStyle.FillStyle = new NColorFillStyle(Color.Orange); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Bold | FontStyle.Italic); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); m_Axis = (NGaugeAxis)radialGauge.Axes[0]; nChartControl1.Panels.Add(radialGauge); m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 50; m_Indicator1.FillStyle = new NColorFillStyle(Color.LightBlue); m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.EndWidth = new NLength(20); 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; radialGauge.Indicators.Add(m_Indicator2); radialGauge.SweepAngle = 270; m_Indicator3 = new NMarkerValueIndicator(); m_Indicator3.Value = 90; radialGauge.Indicators.Add(m_Indicator3); nChartControl1.Controller.Tools.Add(new NTooltipTool()); // init form controls UpdateTooltips(); }
private void CreateRadialGauge() { // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); nChartControl1.Panels.Add(m_RadialGauge); // create the radial gauge m_RadialGauge.SweepAngle = 270; m_RadialGauge.BeginAngle = -90; // set some background m_RadialGauge.BackgroundFillStyle = new NColorFillStyle(Color.Black);; // configure the axis NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; axis.Range = new NRange1DD(0, 100); axis.Anchor.RulerOrientation = RulerOrientation.Right; axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100); ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator); // add some indicators AddRangeIndicatorToGauge(m_RadialGauge); NNeedleValueIndicator needle = new NNeedleValueIndicator(60); needle.OffsetOriginMode = IndicatorOffsetOriginMode.ScaleMiddle; m_RadialGauge.Indicators.Add(needle); }
protected NRadialGaugePanel CreateGaugePanel() { // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.ContentAlignment = ContentAlignment.BottomRight; radialGauge.BackgroundFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.WhiteOnBlack, 0); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.PaintEffect = new NGlassEffectStyle(); NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100); axis.Range = new NRange1DD(0, 400); NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke); scale.LabelFitModes = new LabelFitMode[0]; scale.MinorTickCount = 4; scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.WhiteSmoke)); scale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(6); scale.MinTickDistance = new NLength(15); radialGauge.BeginAngle = -240; radialGauge.SweepAngle = 300; return(radialGauge); }
protected void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark) { NGaugeAxis axis = (NGaugeAxis)panel.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; NRangeIndicator rangeIndicator = new NRangeIndicator(); rangeIndicator.OriginMode = OriginMode.Custom; rangeIndicator.OffsetFromScale = new NLength(10); rangeIndicator.Value = range.Begin; rangeIndicator.Origin = range.End; rangeIndicator.FillStyle = new NColorFillStyle(Color.FromArgb(30, colorLight)); rangeIndicator.StrokeStyle.Width = new NLength(0); panel.Indicators.Add(rangeIndicator); NScaleSectionStyle scaleSection = new NScaleSectionStyle(); scaleSection.Range = range; scaleSection.MajorTickFillStyle = new NColorFillStyle(colorLight); scaleSection.MinorTickFillStyle = new NColorFillStyle(colorLight); NTextStyle labelStyle = new NTextStyle(); labelStyle.FillStyle = new NColorFillStyle(colorDark); labelStyle.FontStyle.Style = FontStyle.Bold; labelStyle.FontStyle.EmSize = new NLength(6); scaleSection.LabelTextStyle = labelStyle; scale.Sections.Add(scaleSection); }
private void ChartControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { NHitTestResult hitTestResult = nChartControl1.HitTest(e.X, e.Y); switch (hitTestResult.ChartElement) { case ChartElement.GaugeAxis: NGaugeAxis gaugeAxis = hitTestResult.GaugeAxis; CurrentElementTextBox.Text = "Gauge Axis Range: [" + gaugeAxis.Range.Begin.ToString() + ", " + gaugeAxis.Range.End.ToString() + "]"; break; case ChartElement.GaugeMarker: NMarkerValueIndicator markerValueIndicator = hitTestResult.MarkerValueIndicator; CurrentElementTextBox.Text = "Gauge Marker Value: " + markerValueIndicator.Value.ToString(); break; case ChartElement.GaugeNeedle: NNeedleValueIndicator needleIndicator = hitTestResult.NeedleValueIndicator; CurrentElementTextBox.Text = "Gauge Needle Value: " + needleIndicator.Value.ToString(); break; case ChartElement.GaugeRange: NRangeIndicator rangeIndicator = hitTestResult.RangeIndicator; CurrentElementTextBox.Text = "Gauge range: [" + rangeIndicator.Range.Begin.ToString() + ", " + rangeIndicator.Range.End.ToString() + "]"; break; default: CurrentElementTextBox.Text = ""; break; } }
void nChartControl1_PreviewMouseMove(object sender, MouseEventArgs e) { System.Windows.Point p = e.GetPosition(nChartControl1); NHitTestResult hitTestResult = (NHitTestResult)nChartControl1.HitTest((int)p.X, (int)p.Y); switch (hitTestResult.ChartElement) { case ChartElement.GaugeAxis: NGaugeAxis gaugeAxis = hitTestResult.GaugeAxis; CurrentElementTextBox.Text = "Gauge Axis Range: [" + gaugeAxis.Range.Begin.ToString() + ", " + gaugeAxis.Range.End.ToString() + "]"; break; case ChartElement.GaugeMarker: NMarkerValueIndicator markerValueIndicator = hitTestResult.MarkerValueIndicator; CurrentElementTextBox.Text = "Gauge Marker Value: " + markerValueIndicator.Value.ToString(); break; case ChartElement.GaugeNeedle: NNeedleValueIndicator needleIndicator = hitTestResult.NeedleValueIndicator; CurrentElementTextBox.Text = "Gauge Needle Value: " + needleIndicator.Value.ToString(); break; case ChartElement.GaugeRange: NRangeIndicator rangeIndicator = hitTestResult.RangeIndicator; CurrentElementTextBox.Text = "Gauge range: [" + rangeIndicator.Range.Begin.ToString() + ", " + rangeIndicator.Range.End.ToString() + "]"; break; default: CurrentElementTextBox.Text = ""; break; } }
void OnScrollBarValueChanged(NValueChangeEventArgs arg) { NGaugeAxis axis1 = (NGaugeAxis)m_RadialGauge.Axes[0]; NGaugeAxis axis2 = (NGaugeAxis)m_RadialGauge.Axes[1]; axis1.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, 0, (float)(m_ScrollBar.Value - 5)); axis2.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, false, (float)m_ScrollBar.Value, 95); // RedAxisTextBox.Text = m_ScrollBar.Value.ToString(); }
public override void Initialize() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Axis Scale Appearance"); 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 NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); radialGauge.BackgroundFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Gray); radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.PositionChildPanelsInContentBounds = true; nChartControl1.Panels.Add(radialGauge); m_Axis = (NGaugeAxis)radialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)m_Axis.ScaleConfigurator; scale.MinorTickCount = 3; NRangeIndicator indicator1 = new NRangeIndicator(); indicator1.Value = 80; indicator1.OriginMode = OriginMode.ScaleMax; indicator1.FillStyle = new NColorFillStyle(Color.Red); indicator1.StrokeStyle.Color = Color.DarkRed; radialGauge.Indicators.Add(indicator1); NNeedleValueIndicator indicator2 = new NNeedleValueIndicator(); indicator2.Value = 79; indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); indicator2.Shape.StrokeStyle.Color = Color.Red; radialGauge.Indicators.Add(indicator2); radialGauge.SweepAngle = 270; m_Updating = true; MinorTickShapeComboBox.FillFromEnum(typeof(ScaleTickShape)); MajorTickShapeComboBox.FillFromEnum(typeof(ScaleTickShape)); PredefinedScaleStyleComboBox.FillFromEnum(typeof(PredefinedScaleStyle)); PredefinedScaleStyleComboBox.SelectedIndex = (int)PredefinedScaleStyle.Standard; m_Updating = false; InitFormControls(); }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); NStackPanel controlStack = new NStackPanel(); stack.Add(controlStack); NRadialGauge radialGauge = new NRadialGauge(); radialGauge.PreferredSize = defaultRadialGaugeSize; radialGauge.CapEffect = new NGlassCapEffect(); radialGauge.Dial = new NDial(ENDialShape.Circle, new NEdgeDialRim()); radialGauge.Dial.BackgroundFill = NAdvancedGradientFill.Create(ENAdvancedGradientColorScheme.Ocean2, 0); // configure scale NGaugeAxis axis = new NGaugeAxis(); radialGauge.Axes.Add(axis); NLinearScale scale = axis.Scale as NLinearScale; scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke); scale.Labels.OverlapResolveLayouts = new NDomArray <ENLevelLabelsLayout>(); scale.MinorTickCount = 3; scale.Ruler.Fill = new NColorFill(NColor.FromColor(NColor.White, 0.4f)); scale.OuterMajorTicks.Fill = new NColorFill(NColor.Orange); scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 12.0, ENFontStyle.Bold | ENFontStyle.Italic); scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White); m_Axis = (NGaugeAxis)radialGauge.Axes[0]; controlStack.Add(radialGauge); m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 50; m_Indicator1.Fill = new NColorFill(NColor.LightBlue); m_Indicator1.Stroke.Color = NColor.DarkBlue; m_Indicator1.EndWidth = 20; m_Indicator1.AllowDragging = true; radialGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NNeedleValueIndicator(); m_Indicator2.Value = 79; m_Indicator2.Fill = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red); m_Indicator2.Stroke.Color = NColor.Red; m_Indicator2.AllowDragging = true; radialGauge.Indicators.Add(m_Indicator2); m_Indicator3 = new NMarkerValueIndicator(); m_Indicator3.Value = 90; m_Indicator3.AllowDragging = true; radialGauge.Indicators.Add(m_Indicator3); radialGauge.SweepAngle = new NAngle(270.0, NUnit.Degree); return(stack); }
private void CreateSpeedGauge() { // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.BackgroundFillStyle = CreateAdvancedGradient(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.ContentAlignment = ContentAlignment.BottomRight; radialGauge.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(45, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); NLabel label = new NLabel("km/h"); label.ContentAlignment = ContentAlignment.BottomCenter; label.TextStyle.FontStyle = new NFontStyle("Times New Roman", 20, FontStyle.Italic); label.TextStyle.FontStyle.Style = FontStyle.Italic; label.TextStyle.FillStyle = new NColorFillStyle(Color.White); label.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; label.BoundsMode = BoundsMode.Fit; label.UseAutomaticSize = false; label.Size = new NSizeL( new NLength(60, NRelativeUnit.ParentPercentage), new NLength(7, NRelativeUnit.ParentPercentage)); label.Location = new NPointL( new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage)); label.Cache = true; radialGauge.ChildPanels.Add(label); nChartControl1.Panels.Add(radialGauge); NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; axis.Range = new NRange1DD(0, 250); NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; ConfigureScale(scale, new NRange1DD(220, 260)); radialGauge.Indicators.Add(CreateRangeIndicator(220)); NMarkerValueIndicator indicator3 = new NMarkerValueIndicator(); indicator3.Value = 90; radialGauge.Indicators.Add(indicator3); m_SpeedIndicator = new NNeedleValueIndicator(); m_SpeedIndicator.Value = 0; m_SpeedIndicator.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_SpeedIndicator.Shape.StrokeStyle.Color = Color.Red; radialGauge.Indicators.Add(m_SpeedIndicator); radialGauge.BeginAngle = -240; radialGauge.SweepAngle = 300; }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left; NStackPanel controlStack = new NStackPanel(); stack.Add(controlStack); // create the radial gauge m_RadialGauge = new NRadialGauge(); m_RadialGauge.PreferredSize = defaultRadialGaugeSize; m_RadialGauge.CapEffect = new NGlassCapEffect(); m_RadialGauge.Dial = new NDial(ENDialShape.CutCircle, new NEdgeDialRim()); m_RadialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black); // configure scale NGaugeAxis axis = new NGaugeAxis(); m_RadialGauge.Axes.Add(axis); NLinearScale scale = (NLinearScale)axis.Scale; scale.SetPredefinedScale(ENPredefinedScaleStyle.Presentation); scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold); scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White); scale.Labels.Style.Angle = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90.0); scale.MinorTickCount = 4; scale.Ruler.Stroke.Width = 0; scale.Ruler.Fill = new NColorFill(NColor.DarkGray); // add radial gauge indicators m_RangeIndicator = new NRangeIndicator(); m_RangeIndicator.Value = 20; m_RangeIndicator.Palette = new NTwoColorPalette(NColor.Green, NColor.Red); m_RangeIndicator.Stroke = null; m_RangeIndicator.EndWidth = 20; m_RadialGauge.Indicators.Add(m_RangeIndicator); m_ValueIndicator = new NNeedleValueIndicator(); m_ValueIndicator.Value = 79; m_ValueIndicator.Fill = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red); m_ValueIndicator.Stroke.Color = NColor.Red; m_ValueIndicator.OffsetFromCenter = -20; m_RadialGauge.Indicators.Add(m_ValueIndicator); m_RadialGauge.SweepAngle = new NAngle(270.0, NUnit.Degree); // add radial gauge controlStack.Add(m_RadialGauge); return(stack); }
private NGaugeAxis CreateGaugeAxis() { NGaugeAxis axis = new NGaugeAxis(); axis.Range = m_AxisRange; axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Left, 0, 100); axis.Scale.SetColor(NColor.White); ((NLinearScale)axis.Scale).Labels.Style.TextStyle.Font.Style = ENFontStyle.Bold; return(axis); }
/// <summary> /// /// </summary> /// <param name="gauge"></param> private void InitSections(NGauge gauge) { gauge.Axes.Clear(); NGaugeAxis axis = new NGaugeAxis(); gauge.Axes.Add(axis); axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top); NStandardScale scale = (NStandardScale)axis.Scale; // init text style for regular labels scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White); scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold); // init ticks scale.MajorGridLines.Visible = true; scale.MinTickDistance = 25; scale.MinorTickCount = 1; scale.SetPredefinedScale(ENPredefinedScaleStyle.Scientific); // create sections NScaleSection blueSection = new NScaleSection(); blueSection.Range = new NRange(0, 20); blueSection.RangeFill = new NColorFill(NColor.FromColor(NColor.Blue, 0.5f)); blueSection.MajorGridStroke = new NStroke(NColor.Blue); blueSection.MajorTickStroke = new NStroke(NColor.DarkBlue); blueSection.MinorTickStroke = new NStroke(1, NColor.Blue, ENDashStyle.Dot); NTextStyle labelStyle = new NTextStyle(); labelStyle.Fill = new NColorFill(NColor.Blue); labelStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold); blueSection.LabelTextStyle = labelStyle; scale.Sections.Add(blueSection); NScaleSection redSection = new NScaleSection(); redSection.Range = new NRange(80, 100); redSection.RangeFill = new NColorFill(NColor.FromColor(NColor.Red, 0.5f)); redSection.MajorGridStroke = new NStroke(NColor.Red); redSection.MajorTickStroke = new NStroke(NColor.DarkRed); redSection.MinorTickStroke = new NStroke(1, NColor.Red, ENDashStyle.Dot); labelStyle = new NTextStyle(); labelStyle.Fill = new NColorFill(NColor.Red); labelStyle.Font = new NFont("Arimo", 10.0, ENFontStyle.Bold); redSection.LabelTextStyle = labelStyle; scale.Sections.Add(redSection); }
private void RedAxisPercentScrollBar_ValueChanged(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e) { NGaugeAxis axis1 = (NGaugeAxis)m_RadialGauge.Axes[0]; NGaugeAxis axis2 = (NGaugeAxis)m_RadialGauge.Axes[1]; axis1.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, 0, RedAxisPercentScrollBar.Value - 5); axis2.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false, RedAxisPercentScrollBar.Value, 95); RedAxisTextBox.Text = RedAxisPercentScrollBar.Value.ToString(); nChartControl1.Refresh(); }
private void ConfigureAxis(NGaugeAxis axis) { NStandardScaleConfigurator configurator = (NStandardScaleConfigurator)axis.ScaleConfigurator; configurator.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); configurator.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); configurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Times New Roman", 10, System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold); configurator.OuterMajorTickStyle.LineStyle.Color = Color.White; configurator.OuterMinorTickStyle.LineStyle.Color = Color.White; configurator.RulerStyle.BorderStyle.Color = Color.White; configurator.MinorTickCount = 4; }
private void InitSections(NGaugePanel gaugePanel) { NGaugeAxis axis = (NGaugeAxis)gaugePanel.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; // init text style for regular labels scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); // init ticks scale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); scale.MinTickDistance = new NLength(20); scale.MinorTickCount = 1; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); // create sections NScaleSectionStyle blueSection = new NScaleSectionStyle(); blueSection.Range = new NRange1DD(0, 20); blueSection.SetShowAtWall(ChartWallType.Back, true); blueSection.RangeFillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue)); blueSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue); blueSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue); blueSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2); NTextStyle labelStyle = new NTextStyle(); labelStyle.FillStyle = new NColorFillStyle(Color.Blue); labelStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); blueSection.LabelTextStyle = labelStyle; scale.Sections.Add(blueSection); NScaleSectionStyle redSection = new NScaleSectionStyle(); redSection.Range = new NRange1DD(80, 100); redSection.SetShowAtWall(ChartWallType.Back, true); redSection.RangeFillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Red)); redSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red); redSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed); redSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2); labelStyle = new NTextStyle(); labelStyle.FillStyle = new NColorFillStyle(Color.Red); labelStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); redSection.LabelTextStyle = labelStyle; scale.Sections.Add(redSection); }
private NRadialGaugePanel CreateGaugePanel(string labelText) { // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.Size = new NSizeL(new NLength(32, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage)); radialGauge.BoundsMode = BoundsMode.Fit; radialGauge.BeginAngle = -180; radialGauge.SweepAngle = 180; radialGauge.ContentAlignment = ContentAlignment.BottomRight; radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.AutoBorder = RadialGaugeAutoBorder.CutCircle; radialGauge.BackgroundFillStyle = new NColorFillStyle(Color.FromArgb(125, Color.White)); // apply effects NGelEffectStyle gelEffect = new NGelEffectStyle(PaintEffectShape.RoundedRect); gelEffect.CornerRounding = new NLength(10); gelEffect.Margins = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(60, NRelativeUnit.ParentPercentage)); radialGauge.PaintEffect = gelEffect; // apply margins in order to leave room for the label radialGauge.Margins = new NMarginsL(2, 2, 2, 20); NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; // apply anchor NDockGaugeAxisAnchor anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false); anchor.RulerOrientation = RulerOrientation.Right; anchor.SynchronizeRulerOrientation = false; axis.Anchor = anchor; axis.Range = new NRange1DD(0, 400); NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelFitModes = new LabelFitMode[0]; scale.MinorTickCount = 2; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.LightGray)); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 6, FontStyle.Bold); radialGauge.ChildPanels.Add(CreateGaugeLabel(labelText)); return(radialGauge); }
private NBackgroundDecoratorPanel CreateStatusMeterPanel(string labelText, NPointL location, NRangeIndicator rangeIndicator) { NBackgroundDecoratorPanel backgroundPanel = new NBackgroundDecoratorPanel(); backgroundPanel.Location = location; backgroundPanel.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); NImageFrameStyle imageFrameStyle = new NImageFrameStyle(PredefinedImageFrame.Embed); imageFrameStyle.BackgroundColor = Color.Transparent; imageFrameStyle.ShadowStyle.Type = ShadowType.None; imageFrameStyle.FillStyle = new NColorFillStyle(Color.Transparent); backgroundPanel.BackgroundStyle.FillStyle = new NColorFillStyle(Color.White); backgroundPanel.BackgroundStyle.FrameStyle = imageFrameStyle; NDockPanel contentPanel = new NDockPanel(); contentPanel.DockMargins = new NMarginsL(new NLength(15), new NLength(3), new NLength(15), new NLength(3)); contentPanel.DockMode = PanelDockMode.Fill; backgroundPanel.ChildPanels.Add(contentPanel); NLabel label = new NLabel(); label.DockMode = PanelDockMode.Bottom; label.Text = labelText; label.ContentAlignment = ContentAlignment.MiddleLeft; label.DockMargins = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(0)); label.BoundsMode = BoundsMode.Fit; contentPanel.ChildPanels.Add(label); NLinearGaugePanel linearGauge = new NLinearGaugePanel(); linearGauge.Indicators.Add(rangeIndicator); linearGauge.DockMode = PanelDockMode.Fill; linearGauge.DockMargins = new NMarginsL(new NLength(15), new NLength(0), new NLength(15), new NLength(0)); NGaugeAxis axis = (NGaugeAxis)linearGauge.Axes[0]; axis.Anchor = new NModelGaugeAxisAnchor(); NStandardScaleConfigurator configurator = (NStandardScaleConfigurator)axis.ScaleConfigurator; configurator.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); contentPanel.ChildPanels.Add(linearGauge); return(backgroundPanel); }
private void RedAxisPercentScrollBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (m_RadialGauge == null) { return; } NGaugeAxis axis1 = (NGaugeAxis)m_RadialGauge.Axes[0]; NGaugeAxis axis2 = (NGaugeAxis)m_RadialGauge.Axes[1]; axis1.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, 0, (float)RedAxisPercentScrollBar.Value - 5); axis2.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false, (float)RedAxisPercentScrollBar.Value, 95); RedAxisTextBox.Text = RedAxisPercentScrollBar.Value.ToString(); nChartControl1.Refresh(); }
private void UpdateScaleLabelAngle(NValueChangeEventArgs arg) { NScaleLabelAngle angle = new NScaleLabelAngle((ENScaleLabelAngleMode)m_AngleModeComboBox.SelectedIndex, (float)m_CustomAngleNumericUpDown.Value, m_AllowTextFlipCheckBox.Checked); // apply angle to radial gauge axis NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NLinearScale scale = (NLinearScale)axis.Scale; scale.Labels.Style.Angle = angle; // apply angle to linear gauge axis axis = (NGaugeAxis)m_LinearGauge.Axes[0]; scale = (NLinearScale)axis.Scale; scale.Labels.Style.Angle = angle; }
private void CreateLinearGauge() { m_LinearGauge = new NLinearGaugePanel(); nChartControl1.Panels.Add(m_LinearGauge); // create the background panel m_LinearGauge.BackgroundFillStyle = new NColorFillStyle(Color.Black); m_LinearGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); NGaugeAxis axis = (NGaugeAxis)m_LinearGauge.Axes[0]; axis.Anchor = new NModelGaugeAxisAnchor(new NLength(10, NGraphicsUnit.Point), VertAlign.Center, RulerOrientation.Left); ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator); // add some indicators AddRangeIndicatorToGauge(m_LinearGauge); m_LinearGauge.Indicators.Add(new NMarkerValueIndicator(60)); }
private void UpdateScaleLabelAngle() { NScaleLabelAngle angle = new NScaleLabelAngle((ScaleLabelAngleMode)AngleModeComboBox.SelectedIndex, (int)CustomAngleNumericComboBox.SelectedItem, AllowTextFlipCheckBox.IsChecked.Value); // apply angle to radial gauge axis NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NLinearScaleConfigurator scale = (NLinearScaleConfigurator)axis.ScaleConfigurator; scale.LabelStyle.Angle = angle; // apply angle to linear gauge axis axis = (NGaugeAxis)m_LinearGauge.Axes[0]; scale = (NLinearScaleConfigurator)axis.ScaleConfigurator; scale.LabelStyle.Angle = angle; nChartControl1.Refresh(); }
/// <summary> /// /// </summary> /// <param name="arg"></param> void UpdateSections(NValueChangeEventArgs arg) { NGauge[] gauges = new NGauge[] { m_RadialGauge, m_LinearGauge }; for (int i = 0; i < gauges.Length; i++) { NGauge gauge = gauges[i]; NGaugeAxis axis = (NGaugeAxis)gauge.Axes[0]; NStandardScale scale = (NStandardScale)axis.Scale; if (scale.Sections.Count == 2) { NScaleSection blueSection = (NScaleSection)scale.Sections[0]; blueSection.Range = new NRange(m_BlueSectionBeginUpDown.Value, m_BlueSectionEndUpDown.Value); NScaleSection redSection = (NScaleSection)scale.Sections[1]; redSection.Range = new NRange(m_RedSectionBeginUpDown.Value, m_RedSectionEndUpDown.Value); } } }
private void CreateLinearGauge() { m_LinearGauge = new NLinearGaugePanel(); nChartControl1.Panels.Add(m_LinearGauge); // create the background panel NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle(); advGradient.BackgroundColor = Color.Black; advGradient.Points.Add(new NAdvancedGradientPoint(Color.LightGray, 10, 10, 0, 100, AGPointShape.Circle)); m_LinearGauge.BackgroundFillStyle = advGradient; m_LinearGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); NGaugeAxis axis = (NGaugeAxis)m_LinearGauge.Axes[0]; axis.Anchor = new NModelGaugeAxisAnchor(new NLength(20, NGraphicsUnit.Point), VertAlign.Center, RulerOrientation.Left); ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator); // add some indicators m_LinearGauge.Indicators.Add(new NMarkerValueIndicator(60)); }