Page 1 of 1
Gauge Logarithmic Axis WPF
Posted: Tue Jun 21, 2011 9:42 am
by 15659642
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?
Re: Gauge Logarithmic Axis WPF
Posted: Tue Jun 21, 2011 2:38 pm
by 15659642
I have tried to use the logarithmic axis with a Winform Gauge but it gave me the same result.
Re: Gauge Logarithmic Axis WPF
Posted: Wed Jun 22, 2011 10:19 am
by 10050769
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,
Re: Gauge Logarithmic Axis WPF
Posted: Thu Jun 23, 2011 9:47 am
by 15659642
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.
Re: Gauge Logarithmic Axis WPF
Posted: Thu Jun 23, 2011 12:22 pm
by 10050769
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,
Re: Gauge Logarithmic Axis WPF
Posted: Thu Jun 23, 2011 2:40 pm
by 15659642
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:
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.
Re: Gauge Logarithmic Axis WPF
Posted: Thu Jun 23, 2011 2:45 pm
by 15659642
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();
}
Re: Gauge Logarithmic Axis WPF
Posted: Mon Jun 27, 2011 9:54 am
by 10050769
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,
Re: Gauge Logarithmic Axis WPF
Posted: Tue Jun 28, 2011 8:15 am
by 15659642
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.
Re: Gauge Logarithmic Axis WPF
Posted: Tue Jun 28, 2011 3:17 pm
by 10050769
Hello antoine,
Thank you for your project. I have added your information in the bug (TW16015628).
Thanks,
Re: Gauge Logarithmic Axis WPF
Posted: Tue Aug 02, 2011 6:41 am
by 15659642
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
- gauge.PNG (29.13 KiB) Viewed 10949 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.
Re: Gauge Logarithmic Axis WPF
Posted: Tue Aug 02, 2011 9:25 am
by 10050769
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,
Re: Gauge Logarithmic Axis WPF
Posted: Tue Aug 02, 2011 9:50 am
by 15659642
Thanks, it works!