Linear Gauge with Zero in center

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Innervations
Newbie
Newbie
Posts: 6
Joined: Wed Apr 16, 2008 12:00 am
Location: Australia
Contact:

Linear Gauge with Zero in center

Post by Innervations » Wed Nov 09, 2011 7:00 am

Hi,

I have a series of linear gauges displaying OK and I can set the range to -50 to +50. However, is it possible when I set the Gauge.value to say -25 that the horizontal bar starts at the zero point and extends left or right to negative or positive values respectively rather than from the far left?

If so then can the colours also be set for certain range i.e. green if between -10 and +10, yellow and then say red if less than -30 and more than +30

Any assistance greatly appreciated.

Cheers
Rob
Attachments
LinearGaugeExample.gif
example of gauge I am trying to reproduce
LinearGaugeExample.gif (8.07 KiB) Viewed 4459 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Linear Gauge with Zero in center

Post by Sandra » Wed Nov 09, 2011 1:17 pm

Hello Innervations,

I have think you can do something as next code, where I change minimum and maximum values of Series because LinerSeries set negative values:

Code: Select all

        private void InitializeChart()
        {
            Steema.TeeChart.Styles.LinearGauge linerGauge = new LinearGauge(tChart1.Chart);
            linerGauge.Add(-50);
            linerGauge.Add(-25);
            linerGauge.Add(0);
            linerGauge.Add(25);
            linerGauge.Add(50);

            linerGauge.Value = 20;
            linerGauge.Maximum = 50;
            linerGauge.Minimum = -50;
            linerGauge.UseValueColorPalette = true;

  
            linerGauge.GreenLineStartValue = -50;
            linerGauge.GreenLineEndValue = 0;
            linerGauge.RedLineStartValue = 0;
            linerGauge.RedLineStartValue = 25;
}
Can you please, tell us if previous code works as you expected? On the other hand, I recommend take a look in Demo Project examples, concretely All Features\Welcome !\Chart styles\Gauges where you can more information how you treat Gauges series.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply