public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer) { LinearGauge linearGauge = (LinearGauge)gaugeContainer.AddGauge(GaugeType.Linear); // Add the default elements (a scale, background layer and level bar). linearGauge.AddDefaultElements(); // Change the background layer's paint style. LinearScaleBackgroundLayer backgroundLinear = linearGauge.BackgroundLayers[0]; backgroundLinear.ShapeType = BackgroundLayerShapeType.Linear_Style3; // Customize the scale's settings. LinearScaleComponent scaleLinear = linearGauge.Scales[0]; BindableComponent = scaleLinear; scaleLinear.MinValue = 0; scaleLinear.MaxValue = 100; scaleLinear.Value = 0; scaleLinear.MajorTickCount = 6; scaleLinear.MajorTickmark.FormatString = "{0:F0}"; scaleLinear.MajorTickmark.ShapeType = TickmarkShapeType.Linear_Style6_3; scaleLinear.MinorTickCount = 3; scaleLinear.MinorTickmark.ShapeType = TickmarkShapeType.Linear_Style5_2; // Shift tick marks to the right. scaleLinear.MajorTickmark.ShapeOffset = 5f; scaleLinear.MinorTickmark.ShapeOffset = 5f; // Change the levelBar's paint style. LinearScaleLevelComponent levelBar = linearGauge.Levels[0]; levelBar.ShapeType = LevelShapeSetType.Style3; // Shift the background layer up and to the left. backgroundLinear.ScaleStartPos = new PointF2D(backgroundLinear.ScaleStartPos.X - 0.005f, backgroundLinear.ScaleStartPos.Y - 0.015f); backgroundLinear.ScaleEndPos = new PointF2D(backgroundLinear.ScaleEndPos.X - 0.005f, backgroundLinear.ScaleEndPos.Y); }
public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer) { CircularGauge circularGauge = (CircularGauge)gaugeContainer.AddGauge(GaugeType.Circular); // Add the default elements (a scale, background layer, needle and spindle cap). circularGauge.AddDefaultElements(); // Change the background layer's paint style. ArcScaleBackgroundLayer backgroundCircular = circularGauge.BackgroundLayers[0]; backgroundCircular.ShapeType = BackgroundLayerShapeType.CircularFull_Style3; // Customize the scale's settings. ArcScaleComponent scaleCircular = circularGauge.Scales[0]; BindableComponent = scaleCircular; scaleCircular.MinValue = 0; scaleCircular.MaxValue = 100; scaleCircular.Value = 0; scaleCircular.MajorTickCount = 6; scaleCircular.MajorTickmark.FormatString = "{0:F0}"; scaleCircular.MajorTickmark.ShapeType = TickmarkShapeType.Circular_Style2_2; scaleCircular.MajorTickmark.ShapeOffset = -9; scaleCircular.MajorTickmark.AllowTickOverlap = true; scaleCircular.MinorTickCount = 3; scaleCircular.MinorTickmark.ShapeType = TickmarkShapeType.Circular_Style2_1; // Change the needle's paint style. ArcScaleNeedleComponent needle = circularGauge.Needles[0]; needle.ShapeType = NeedleShapeType.CircularFull_Style3; }
private Bitmap RenderGaugeControl(ASPxGaugeControl gauge) { using (var stream = new MemoryStream()) { gauge.ExportToImage(stream, System.Drawing.Imaging.ImageFormat.Png); return(new Bitmap(stream)); } }
public BoldGauge(ASPxGaugeControl gauge, string gaugeValue, string gaugeDataType, float gaugeMinValue, float gaugeMaxValue) { Gauge = gauge; GaugeValue = gaugeValue; GaugeDataType = gaugeDataType; GaugeMinValue = gaugeMinValue; GaugeMaxValue = gaugeMaxValue; }
private WebControl CreateGaugeControl() { ASPxGaugeControl gaugeControl = new ASPxGaugeControl(); gaugeControl.BackColor = Color.Transparent; SetupGaugeCore(gaugeControl); return(gaugeControl); }
protected void GaugeLoad(object sender, EventArgs e) { ASPxGaugeControl c = (sender as ASPxGaugeControl); DataViewItemTemplateContainer container = c.NamingContainer as DataViewItemTemplateContainer; bool isDigital = (container.DataItem as DataRowView)["name"].Equals("Circular"); c.Visible = isDigital && c.Gauges[0] is DigitalGauge || !isDigital && c.Gauges[0] is CircularGauge; c.Value = (container.DataItem as DataRowView)["value"].ToString(); }
public Bitmap GetCategory(int score, bool isWeeklyScore) { var control = new ASPxGaugeControl(); var gauge = AddGauge(control, score); control.BackColor = Color.White; AddCategoryScoreLabels(gauge, score, isWeeklyScore); return(RenderGaugeControl(control)); }
private void CreateCircularGauge() { ASPxGaugeControl gaugeControl = new ASPxGaugeControl(); CircularGauge gauge = (CircularGauge)gaugeControl.AddGauge(GaugeType.Circular); gauge.AddDefaultElements(); ArcScaleComponent scale = gauge.Scales[0]; scale.BeginUpdate(); scale.Ranges.AddRange(CreateRanges(scale.MaxValue - scale.MinValue, scale.MinValue)); scale.EndUpdate(); Page.Form.Controls.Add(gaugeControl); }
private void UpdateScaleInternal(ASPxGaugeControl gauge) { float oldValue = ((LinearGauge)gauge.Gauges[0]).Scales[0].Value; //Dennis: use a random value, just for demonstration purposes. //DataView dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; //float newValue = Convert.ToSingle(dv.Table.Rows[0][0]); float newValue = new Random().Next(300); if (oldValue != newValue) { ((LinearGauge)gauge.Gauges[0]).Scales[0].Value = newValue; gauge.DataBind(); } }
public ActionResult RenderGauge(float param) { ASPxGaugeControl ctrl = new ASPxGaugeControl(); ctrl.RestoreLayoutFromXml(Server.MapPath("~/App_Data/gauge.xml")); (ctrl.Gauges["myGauge"] as CircularGauge).Scales["myScale"].Value = param; MemoryStream stream = new MemoryStream(); ctrl.ExportToImage(stream, ImageFormat.Png); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "image/png")); }
public Bitmap GetOverall(int score, bool isWeeklyScore) { var control = new ASPxGaugeControl(); var gauge = AddGauge(control, score); AddCategoryScoreLabels(gauge, score, isWeeklyScore); foreach (var label in ((CircularGauge)gauge).Labels) { label.AppearanceText.TextBrush = new SolidBrushObject { Color = System.Drawing.Color.White }; } control.BackColor = ColorTranslator.FromHtml("#102D4E"); return(RenderGaugeControl(control)); }
public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer) { DigitalGauge digitalGauge = (DigitalGauge)gaugeContainer.AddGauge(GaugeType.Digital); // The number of digits. digitalGauge.DigitCount = 14; // Use 14 segment display mode. digitalGauge.DisplayMode = DigitalGaugeDisplayMode.FourteenSegment; // Add a background layer and set its painting style. DigitalBackgroundLayerComponent backgroundDigital = digitalGauge.AddBackgroundLayer(); BindableComponent = digitalGauge; backgroundDigital.ShapeType = DigitalBackgroundShapeSetType.Style2; // Set the color of digits. digitalGauge.AppearanceOn.ContentBrush = new SolidBrushObject(Color.Red); }
private IGauge AddGauge(ASPxGaugeControl gaugeControl, int score) { var gauge = (CircularGauge)gaugeControl.AddGauge(GaugeType.Circular); var scale = gauge.AddScale(); //Set angles so gauge fills from "North" in the clockwise direction scale.StartAngle = -90; scale.EndAngle = 270; //Set range and current value to scale var scaleValue = (float)Math.Max(score, 0.1); scale.Renderable = false; scale.MinValue = 0; if (scaleValue <= 10) { scale.MaxValue = scaleValue; } else { scale.MaxValue = 100; } scale.Value = scaleValue; //If the score is zero, we still want some red to show scale.DataBind(); //Set colors on ranges var backRange = gauge.AddRangeBar(); backRange.AppearanceRangeBar.ContentBrush = new SolidBrushObject() { Color = _indicatorService.GetColorByScore(-1) }; backRange.Value = 100; backRange.StartOffset = 80; backRange.EndOffset = -12; var frontRange = gauge.AddRangeBar(); frontRange.AppearanceRangeBar.ContentBrush = new SolidBrushObject() { Color = _indicatorService.GetColorByScore(score) }; frontRange.StartOffset = 80; frontRange.EndOffset = -12; return(gauge); }
public override void SetupGaugeCore(ASPxGaugeControl gaugeContainer) { StateIndicatorGauge siGauge = (StateIndicatorGauge)gaugeContainer.AddGauge(GaugeType.StateIndicator); StateIndicatorComponent stateIndicator = siGauge.AddIndicator(); stateIndicator.BeginUpdate(); BindableComponent = stateIndicator; StateIndicatorShapeType[] shapes = new StateIndicatorShapeType[] { StateIndicatorShapeType.TrafficLight2, StateIndicatorShapeType.TrafficLight3, StateIndicatorShapeType.TrafficLight4, }; stateIndicator.States.Clear(); foreach (StateIndicatorShapeType shape in shapes) { IndicatorStateWeb state = new IndicatorStateWeb(shape); stateIndicator.States.Add(state); } stateIndicator.Size = new SizeF(100, 200); }
private void UpdateScaleInternal5(ASPxGaugeControl gauge, float value) { string newValue; DigitalGauge oldValue2 = (DigitalGauge)gauge.Gauges[0]; string oldValue; oldValue = oldValue2.Text; //Dennis: use a random value, just for demonstration purposes. //DataView dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; //float newValue = Convert.ToSingle(dv.Table.Rows[0][0]); newValue = Convert.ToString(value); if (oldValue != newValue) { oldValue2.Text = newValue; ((DigitalGauge)gauge.Gauges[0]).Text = oldValue2.Text; //ASPxGaugeControl2.Value = newValue; //gauge.Gauges[0].ForceUpdateChildren(); } }
private void UpdateScaleInternal7(ASPxGaugeControl gauge, string value) { int oldValue; int newValue = 0; string text = ""; //Dennis: use a random value, just for demonstration purposes. //DataView dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; //float newValue = Convert.ToSingle(dv.Table.Rows[0][0]); if (value == "Charging") { newValue = 0; } else if (value == "Discharging") { newValue = 1; } else if (value == "Standby") { newValue = 2; } else if (value == "Innactive") { newValue = 3; } oldValue = ((StateIndicatorGauge)gauge.Gauges[0]).Indicators[0].StateIndex; if (oldValue != newValue) { ((StateIndicatorGauge)gauge.Gauges[0]).Indicators[0].StateIndex = newValue; ((StateIndicatorGauge)gauge.Gauges[0]).Labels[0].Text = value; //ASPxGaugeControl2.Value = newValue; //gauge.Gauges[0].ForceUpdateChildren(); } }
public abstract void SetupGaugeCore(ASPxGaugeControl gaugeContainer);