3

我正在使用 TreeChart 制作如图所示的指标。但是我有一个问题,我不能使三色渐变到那个量规。这是我的代码

        Steema.TeeChart.TChart tChart = new Steema.TeeChart.TChart(this);
        tChart.Panel.Transparent = false;
        Steema.TeeChart.Styles.Gauges gauges = new Steema.TeeChart.Styles.Gauges(tChart.Chart);
        Steema.TeeChart.Drawing.Gradient g = new Steema.TeeChart.Drawing.Gradient(gauges.Chart);


        gauges.bBrush.Gradient.Direction = Steema.TeeChart.Drawing.GradientDirection.DiagonalUp;
        gauges.bBrush.Gradient.StartColor = System.Drawing.Color.Red;
        gauges.bBrush.Gradient.MiddleColor = System.Drawing.Color.Black;
        gauges.bBrush.Gradient.EndColor = System.Drawing.Color.Blue;
        gauges.bBrush.Gradient.Visible = true;
        gauges.Pen.Color = System.Drawing.Color.FromArgb(5,56,73);

        gauges.TotalAngle = 180; // circular arc  
        gauges.RotationAngle = 180; // arc rotation angle  
        gauges.HandStyle = Steema.TeeChart.Styles.HandStyle.Triangle; // pointer style  
        gauges.Center.Style = Steema.TeeChart.Styles.PointerStyles.Circle; // SPHERE center circle style  
        gauges.Center.HorizSize = 5; // center circle level size  
        gauges.Center.VertSize = 5; // center circle vertical size 

        gauges.ShowInLegend = false; // display the legend  
        gauges.HandDistance = 23; // pointer length  

        //---------------------------------------------------
        gauges.Value = 80;
        gauges.Minimum = 0; //   minimum;
        gauges.Maximum = 100; // maximum value  
        //----------------------------------------------------

        gauges.MinorTickDistance = 0;

        gauges.Pen.DashWidth = 23;
        gauges.Chart.Axes.Left.AxisPen.Width = 65; //   brush width; 
        gauges.Chart.Axes.Left.AxisPen.Color = System.Drawing.Color.Red;
        gauges.Chart.Axes.Left.MinorTickCount = 5; // the scale value scale line number  
        gauges.Chart.Axes.Left.MinorTicks.Length = 10; // the scale value scale line length of  
        gauges.Chart.Axes.Left.Ticks.Length = 20; // display the value scale line length of  
        gauges.Chart.Axes.Left.Increment = 3000; // the scale value of interval size

        SetContentView(tChart) ;

我还尝试了以下代码行

        gauges.CircleGradient.Direction = Steema.TeeChart.Drawing.GradientDirection.DiagonalUp;
        gauges.CircleGradient.Visible = true;
        gauges.CircleGradient.StartColor = System.Drawing.Color.Green;
        gauges.CircleGradient.EndColor = System.Drawing.Color.Red;
        gauges.CircleGradient.UseStandardGradient = true;

我希望我能帮助

问候

4

1 回答 1

2

您应该使用Steema.TeeChart.Styles.CircularGauge而不是Steema.TeeChart.Styles.Gauges,这是一个更简单的仪表版本。例如,使用下面的代码片段,您将获得与链接中的图像类似的仪表:

带 TeeChart 的圆形仪表

这与您正在寻找的相似吗?

  tChart1.Header.Visible = false;

  Steema.TeeChart.Styles.CircularGauge circularGauge1 = new Steema.TeeChart.Styles.CircularGauge(tChart1.Chart);

  circularGauge1.Frame.Visible = false;
  circularGauge1.FaceBrush.Visible = false;
  circularGauge1.DisplayTotalAngle = 180;
  circularGauge1.TotalAngle = 180;
  circularGauge1.Value = 200;
  circularGauge1.Ticks.Visible = false;
  circularGauge1.Minimum = 0;
  circularGauge1.Maximum = 1000;
  circularGauge1.Axis.AxisPen.Visible = false;
  circularGauge1.Axis.Increment = 500;
  circularGauge1.RedLine.Visible = false;
  circularGauge1.GreenLineStartValue = 0;
  circularGauge1.GreenLineEndValue = 1000;
  circularGauge1.GreenLine.Gradient.Direction = Steema.TeeChart.Drawing.GradientDirection.LeftRight;
  circularGauge1.GreenLine.Gradient.UseMiddle = true;
  circularGauge1.GreenLine.Gradient.StartColor = Color.Orange;
  circularGauge1.GreenLine.Gradient.MiddleColor = Color.Yellow;
  circularGauge1.GreenLine.Gradient.EndColor = Color.Green;
  circularGauge1.GreenLine.Pen.Visible = false;
于 2012-10-15T10:10:37.647 回答