void RemoveElements(DashboardGauge gaugeControl) { gaugeControl.BeginUpdate(); gaugeControl.Model.Composite.Remove(gaugeControl.Elements[2] as IRenderableElement); gaugeControl.Elements.Remove(gaugeControl.Elements[2]); gaugeControl.Model.Composite.Remove(gaugeControl.Elements[1] as IRenderableElement); gaugeControl.Elements.Remove(gaugeControl.Elements[1]); gaugeControl.EndUpdate(); }
private void ModifyGauge(XRGauge gauge) { DashboardGauge gaugeControl = gauge.Gauge as DashboardGauge; RemoveElements(gaugeControl); ArcScaleRangeBar rangeBar = new ArcScaleRangeBar() { ArcScale = gaugeControl.Elements[0] as ArcScale }; SetupArcScale(gaugeControl.Elements[0] as ArcScale); SetupRangeBar(gaugeControl, rangeBar); }
static void AddMarker(DashboardGauge gauge, float value) { LinearScaleProvider linearScaleComponent1 = gauge.Scale as LinearScaleProvider; LinearScaleMarker marker = new LinearScaleMarker("marker"); marker.ShapeType = MarkerPointerShapeType.Diamond; marker.Shader = new StyleShader() { StyleColor1 = Color.Blue, StyleColor2 = Color.Blue }; marker.ShapeOffset = -20.0f; marker.Value = value; marker.LinearScale = linearScaleComponent1; ModelRoot root = gauge.Model.Composite[PredefinedCoreNames.LinearGaugeRotationNode] as ModelRoot; root.Composite.Add(marker); }
void SetupRangeBar(DashboardGauge gaugeControl, ArcScaleRangeBar rangeBar) { gaugeControl.BeginUpdate(); rangeBar.Name = "arcScaleRangeBarComponent2"; rangeBar.RoundedCaps = true; rangeBar.ShowBackground = true; rangeBar.StartOffset = 100F; rangeBar.EndOffset = 17F; rangeBar.ZOrder = -10; rangeBar.Appearance.BackgroundBrush = new SolidBrushObject("Color:#E0E0E0"); rangeBar.Appearance.ContentBrush = new SolidBrushObject("Color:#4D82B8"); gaugeControl.Model.Composite.Add(rangeBar); gaugeControl.Elements.Add(rangeBar); gaugeControl.EndUpdate(); }