Gauge Logarithmic Axis WPF

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Gauge Logarithmic Axis WPF

Post by antoine » Tue Jun 21, 2011 9:42 am

Hi,

I would like to use a logarithmic axis on a gauge but I don't know how to do it.
I have the following code:

Code: Select all

Gauges gauge = new Gauges();
gauge.TotalAngle = 270;
gauge.RotationAngle = 225;
Steema.TeeChart.WPF.Axis logAxis = tc_Chart.Axes.Right;
                    
logAxis.Logarithmic = true;
logAxis.LogarithmicBase = 10;
logAxis.SetMinMax(0, 10000);
this.tc_Chart.Series.Clear();
tc_Chart.Series.Add(gauge);
tc_Chart[0].FillSampleValues();

tc_Chart.Axes.Right.Logarithmic = true;
tc_Chart.Axes.Right.LogarithmicBase =10;

tc_Chart.Axes.Left.Logarithmic = true;
tc_Chart.Axes.Left.LogarithmicBase = 10;

this.displayType = en_DisplayType.gauge;
this.tc_Chart.Axes[1].Logarithmic = true;
I am using the WPF version of Teechart.
Could you help me please?

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Tue Jun 21, 2011 2:38 pm

I have tried to use the logarithmic axis with a Winform Gauge but it gave me the same result.

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

Re: Gauge Logarithmic Axis WPF

Post by Sandra » Wed Jun 22, 2011 10:19 am

Hello antoine,

I have made a simple code but I am not sure if this is as you want:

Code: Select all

        private void InitializeForm()
        {

            Steema.TeeChart.WPF.Styles.Gauges gauge = new Steema.TeeChart.WPF.Styles.Gauges();
            gauge.TotalAngle = 270;
            gauge.RotationAngle = 225;
            tChart1.Series.Clear();
            tChart1.Series.Add(gauge);
            tChart1[0].FillSampleValues();
            gauge.Minimum = 0;
            gauge.Maximum = 10000;
            tChart1.Axes.Left.Increment = 1000;
            tChart1.Axes.Left.Logarithmic = true;
            tChart1.Axes.Left.LogarithmicBase = 10;
}
Can you tell us if previous code works as you want? And also please can you explain exactly what do you want achieve using in gauge a logarithmic scale, we can try to help you to find the best solution for you?


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

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Thu Jun 23, 2011 9:47 am

Thanks, that's what I wanted.
Now I have the following code:

Code: Select all

 CircularGauge gauge = new CircularGauge();
//Gauges gauge = new Gauges();
gauge.TotalAngle = 220;
gauge.RotationAngle = 0;
gauge.DisplayRotationAngle = 0;
//display the numeric value
gauge.NumericGauge.Visible = true;

gauge.FaceBrush.Color = (Color)this.FindResource("CSPMS_Color_BackDark");
gauge.FaceBrush.Gradient.Visible = false;
gauge.Minimum = 0.1;
gauge.Maximum = 1000;

this.tc_Chart.Series.Clear();
tc_Chart.Series.Add(gauge);

tc_Chart[0].FillSampleValues();
             
tc_Chart.Axes.Left.Increment = 10;
tc_Chart.Axes.Left.Logarithmic = true;
tc_Chart.Axes.Left.LogarithmicBase = 10;
If the Increment property is to small, the label on the axis can't be read. Is it possible to autosize the label?
Is it a semi-log or a log? What I mean by semi-log is that the axis is linear decade.

When I use this:

Code: Select all

((CircularGauge)tc_Chart.Series[0]).Value = rand.Next(10000);
If the random number is superior the max value of the gauge(1000), the gauge does not resize.

Regards.

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

Re: Gauge Logarithmic Axis WPF

Post by Sandra » Thu Jun 23, 2011 12:22 pm

Hello antoine,
If the Increment property is to small, the label on the axis can't be read. Is it possible to autosize the label?
You can try to use property separation of axes labels to separate the labels. And also I recommend you to read this thread where almost all possibilities about overlapping labels where discussed and as left axis is the axis that Gauges/CircularGauge series use so those are the labels you should work with.
Is it a semi-log or a log? What I mean by semi-log is that the axis is linear decade.
I have checked it and your are right. I have added it in wish-list with number [TF02015626] to be consider inclusion in next maintenance releases of TeeChart.Net.
When I use this:

Code: Select all
((CircularGauge)tc_Chart.Series[0]).Value = rand.Next(10000);

If the random number is superior the max value of the gauge(1000), the gauge does not resize.
Using this code and last version of TeeChart.Net WPF the gauge resize for me.

Code: Select all

 Random rnd;
        private void InitializeChart()
        {
            rnd = new Random();
            Steema.TeeChart.WPF.Styles.CircularGauge gauge = new Steema.TeeChart.WPF.Styles.CircularGauge();
            gauge.TotalAngle = 270;
            gauge.RotationAngle = 225;

            tChart1.Series.Clear();
            tChart1.Series.Add(gauge);
            tChart1[0].FillSampleValues();
            tChart1.Invalidate();

            gauge.Minimum = 0;
            gauge.Maximum = 1000;
            gauge.Value = rnd.Next(10000);

            tChart1.Axes.Left.Increment = 100;
            tChart1.Axes.Left.Logarithmic = true;
            tChart1.Axes.Left.LogarithmicBase = 10;

        }
        private void button1_Click(object sender, EventArgs e)
        {
            rnd = new Random();
            (tChart1[0] as Steema.TeeChart.WPF.Styles.CircularGauge).Value = rnd.Next(10000);
        }
Could you please, check if previous code works for you? On the other hand, you can tell us which version of TeeChart are you using, now?

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

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Thu Jun 23, 2011 2:40 pm

Hi Sandra,

I am using the 4.1.2011.4193 version of teechart.
I'm using the WPF component.

I have tried to display the NumericGauge in the CircularGauge but nothing is displayed in it as you can see on the image below:
Image
I have set the AutoValueNumericGauge attribut to true.
I took the exemple from "Welcome !\Chart styles\Gauges\Numeric Gauge".

Another point: I did not manage to change the color of the RedLine and GreenLine, only the border (as you can see on the picture).

I have the following code:

Code: Select all

CircularGauge gauge = new CircularGauge();
//Gauges gauge = new Gauges();
gauge.TotalAngle = 220;
gauge.RotationAngle = 0;
gauge.DisplayRotationAngle = 0;
//display the numeric value
gauge.NumericGauge.Visible = true;
gauge.AutoValueNumericGauge = true;

gauge.FaceBrush.Color = (Color)this.FindResource("CSPMS_Color_BackDark"); //color from a xaml file
gauge.FaceBrush.Gradient.Visible = false;
gauge.Minimum = 0;
gauge.Maximum = 1000;

//alarm level
gauge.RedLineStartValue = Double.Parse(device.CSPProbe.channel1.alarm);  //800
gauge.RedLineEndValue = gauge.Maximum;
gauge.RedLine.Pen.Color = (Color)this.FindResource("CSPMS_color_alarmBright");

//alert level
gauge.GreenLineStartValue = Double.Parse(device.CSPProbe.channel1.alert); //500
gauge.GreenLineEndValue = Double.Parse(device.CSPProbe.channel1.alarm); //800
gauge.GreenLine.Pen.Color = (Color)this.FindResource("CSPMS_color_alertBright");

this.tc_Chart.Series.Clear();
tc_Chart.Series.Add(gauge);
             
tc_Chart.Axes.Left.Increment = 100;
tc_Chart.Axes.Left.Logarithmic = true;
tc_Chart.Axes.Left.LogarithmicBase = 10;
Thanks.

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Thu Jun 23, 2011 2:45 pm

Oh, and has you can see, the axis is not Logarithmic.

In the timer_tick, i'm using this to update the value:

Code: Select all

Random rand = new Random();
            if (tc_Chart.Series[0].GetType() == typeof(CircularGauge))
            {
                ((CircularGauge)tc_Chart.Series[0]).Value = rand.Next(1000);
                tc_Chart.Invalidate();
             }

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

Re: Gauge Logarithmic Axis WPF

Post by Sandra » Mon Jun 27, 2011 9:54 am

Hello antonie,
I have tried to display the NumericGauge in the CircularGauge but nothing is displayed in it as you can see on the image below:
You are right. I have checked your request and I have added it in bug list report with number [TW16015628]. We will try to fix it for next maintenance releases of TeeChart.Net.
Another point: I did not manage to change the color of the RedLine and GreenLine, only the border (as you can see on the picture).
If you want change color of the RedLine and GreenLine you need disable gradient of both as do in next code:

Code: Select all

Private void InitializeChart()
{
            Steema.TeeChart.WPF.Styles.CircularGauge Cgauge = new Steema.TeeChart.WPF.Styles.CircularGauge(tChart1.Chart);
            Cgauge.GreenLine.Gradient.Visible = false;
            Cgauge.GreenLine.Brush.Color = Colors.Blue;
            Cgauge.GreenLine.Pen.Color = Colors.Red;

            Cgauge.RedLine.Gradient.Visible = false;
            Cgauge.RedLine.Brush.Color = Colors.Yellow;
            Cgauge.RedLine.Pen.Color = Colors.GreenYellow;

        }
Could you tell us if previous code works as you want?
Oh, and has you can see, the axis is not Logarithmic.

In the timer_tick, i'm using this to update the value:
How I have told in previous post this behavior is in wish list with number(TF02015626) to be considered its inclusion for next versions of TeeChart.Net WPF. On the other hand, the value is updated well for me so you can try to arrange for us a simple project because we can reproduce exactly your problem here?

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

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Tue Jun 28, 2011 8:15 am

Hi Sandra,

I enclosed a test project with a simple CircularGauge with the NumericGauge wich does not update.
It seems that the NumericGauge does not work at all (even without the CircularGauge) in WPF.

The code you provide me to change the color of the RedLine and GreenLine works great.

Regards,
Antoine.
Attachments
TestGauge.rar
(31.24 KiB) Downloaded 391 times

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

Re: Gauge Logarithmic Axis WPF

Post by Sandra » Tue Jun 28, 2011 3:17 pm

Hello antoine,

Thank you for your project. I have added your information in the bug (TW16015628).

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

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Tue Aug 02, 2011 6:41 am

Hi Sandra,

I am have some difficulties to deal with the Axis of my gauge.
Has you can see on the picture, the labels on the Axis are all "0". At the bottom left you have the current value of the gauge.
gauge.PNG
gauge
gauge.PNG (29.13 KiB) Viewed 10942 times
I am using the following code to display the axis:

Code: Select all

CircularGauge gauge = new CircularGauge();

gauge.Minimum = 0;
gauge.Maximum = 1e-9;

Steema.TeeChart.WPF.Axis leftAxis = in_TChart.Axes.Left;
leftAxis.Automatic = true;
leftAxis.AutomaticMaximum = true;
leftAxis.Increment = gauge.Maximum / 10;

leftAxis.Labels.ValueFormat = "#.#E+0";

in_TChart.Series.Clear();
in_TChart.Series.Add(gauge);
Thank you for your help,

Antoine.

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

Re: Gauge Logarithmic Axis WPF

Post by Sandra » Tue Aug 02, 2011 9:25 am

Hello antoine,

I think that your problem is, that you doesn't change the correct ValueFormat, so you are changing ValueFormat of labels of Axis and you need change ValueFormat of Value of gauge, as do in next example:

Code: Select all

        Steema.TeeChart.WPF.TChart tChart1;
        private void InitializeChart()
        {
            tChart1 = new Steema.TeeChart.WPF.TChart();
            this.Content = tChart1;
            CircularGauge gauge = new CircularGauge(tChart1.Chart);
            gauge.Minimum = 0;
            gauge.Maximum = 1e-9;
            gauge.Axis.Automatic = false;
            gauge.Axis.Increment = gauge.Maximum / 10;
            gauge.ValueFormat = "#.0x10E+0";

        }
Could you confirm us if previous code works as you expected?

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

antoine
Newbie
Newbie
Posts: 15
Joined: Fri Jun 17, 2011 12:00 am

Re: Gauge Logarithmic Axis WPF

Post by antoine » Tue Aug 02, 2011 9:50 am

Thanks, it works!

Post Reply