CircularGauge - PackageMistake?

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Perbit
Newbie
Newbie
Posts: 10
Joined: Fri May 30, 2014 12:00 am

CircularGauge - PackageMistake?

Post by Perbit » Tue Jun 10, 2014 4:30 pm

Hello all,

I have the following problem: I wanted to set up an circularGauge with the following code (out of Forum):

Code: Select all

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;
My Code is like this:

Code: Select all

TChart chart;
chart = new TChart(this.getActivity());
Series series = null;
series = Series.createNewSeries(chart.getChart(), CircularGauge.class, null);

chart.Frame // ......  Frame is not possible to use - why is it?
chart.FaceBrush //...... FaceBrush is not possible to use...
// [...] the same on each line if I want to use it like on top

I can't get CircularGauge".Frame" ".FaceBrush" etc...

Can you tell me what's my mistake and give me some sample code for my declaration?
Is there a mistake in Import of TeeChart?

Thank you very much.
Perbit

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: CircularGauge - PackageMistake?

Post by Yeray » Wed Jun 11, 2014 10:30 am

Hello,

Note a difference between C# and Java is that Java we use getters and setters to retrieve and set properties respectively. Ie we call getFrame() to access the Frame, and we call setVisible(false) to change the visibility of an object.

Also note in the first code you posted you are accessing the properties from circularGauge1, that is an instance of the Steema.TeeChart.Styles.CircularGauge class.
However, in the Java version you are trying to access the properties from chart, that is an instance of the TChart class. You need an instance of the CircularGauge class. Ie:

Code: Select all

TChart chart;
chart = new TChart(this.getActivity());
CircularGauge series = null;
series = (CircularGauge)Series.createNewSeries(chart.getChart(), CircularGauge.class, null);

series.getFrame().setVisible(false);
series.getFaceBrush().setVisible(false);
// [...] 
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Perbit
Newbie
Newbie
Posts: 10
Joined: Fri May 30, 2014 12:00 am

Re: CircularGauge - PackageMistake?

Post by Perbit » Thu Jun 12, 2014 9:26 am

Hello Yeray,

thank you for your support. I have another question. I want to have my Circular Gauge to look like this:
Image

That means I want to have the two thresholds. The lower Threshold to define where the first colour ends and second begins. An upper threshold to define where the second colour ends an the third begins.
In TeeChart I only find two "Lines" : "GreenLine" and "RedLine". Is it possible to have an third "Line"?.

As next I want to have an big number (value of the gauge) on the bottom of the gauge.
What's the Code for this? I only find the following code to get the value. But there is something like a frame behind this. I only want a big number as value on bottom.

Code: Select all

series.getNumericGauge().setVisible(true);
				series.getNumericGauge().getFrame().setVisible(false);
				series.getNumericGauge().getBrush().setVisible(false);
				series.getNumericGauge().getFaceBrush().setVisible(false);
				series.getNumericGauge().getMarks().setVisible(false);
			//	series.setAutoValueNumericGauge(true);
thank you for your support.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: CircularGauge - PackageMistake?

Post by Yeray » Thu Jun 12, 2014 10:21 am

Hello,
Perbit wrote:That means I want to have the two thresholds. The lower Threshold to define where the first colour ends and second begins. An upper threshold to define where the second colour ends an the third begins.
In TeeChart I only find two "Lines" : "GreenLine" and "RedLine". Is it possible to have an third "Line"?.
This is a feature request already present in the public tracker here.
Feel free to add your mail to the CC list to be automatically notified when an update arrives.
Perbit wrote:As next I want to have an big number (value of the gauge) on the bottom of the gauge.
What's the Code for this? I only find the following code to get the value. But there is something like a frame behind this. I only want a big number as value on bottom.
Have you tried with an Annotation tool? Ie:

Code: Select all

		Annotation annot1 = new Annotation(tChart1.getChart());
		annot1.setText("my annotation");
		annot1.getShape().setCustomPosition(true);
		annot1.getShape().setLeft(100);
		annot1.getShape().setTop(100);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Perbit
Newbie
Newbie
Posts: 10
Joined: Fri May 30, 2014 12:00 am

Re: CircularGauge - PackageMistake?

Post by Perbit » Thu Jun 12, 2014 11:15 am

Thanks for reply.

I did it now like this. It's still a frame around it, but I think it's okay:

Code: Select all

			series3.getNumericGauge().getValueMarker().getShape().setTransparent(true); 
				series3.getNumericGauge().getValueMarker().getShape().getFont().setBold(true);
				series3.getNumericGauge().getValueMarker().getShape().getFont().setSize(20);
I have another question. I want to have percentage values around the circular gauge.
2 -> 2%, 4 -> 4%....
The value on the bottom (inside getNumericGauge() - full value of CircularGauge) should be with percentage, too.

How can I do this?

Thank you for your support Yeray!

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: CircularGauge - PackageMistake?

Post by Yeray » Fri Jun 13, 2014 8:40 am

Perbit wrote:I did it now like this. It's still a frame around it, but I think it's okay:

Code: Select all

			series3.getNumericGauge().getValueMarker().getShape().setTransparent(true); 
				series3.getNumericGauge().getValueMarker().getShape().getFont().setBold(true);
				series3.getNumericGauge().getValueMarker().getShape().getFont().setSize(20);
Great! You are right, I missed it! :oops:
Perbit wrote:I have another question. I want to have percentage values around the circular gauge.
2 -> 2%, 4 -> 4%....
For the labels, you could use the AxisLabelResolver. Ie:

Code: Select all

		tChart1.setAxisLabelResolver(new AxisLabelAdapter() {
			
			@Override
			public String getLabel(Axis axis, ISeries s, int valueIndex,
					String labelText) {
				
				return labelText +  "%";
			}
		});
Perbit wrote:The value on the bottom (inside getNumericGauge() - full value of CircularGauge) should be with percentage, too.
For the ValueMarker below, I'm afraid there's no option to customize the text. Note the drawHand method in NumericGauge.java does it as follows:

Code: Select all

                    getValueMarker().setText(Double.toString(truncate(getValue())));
                    getValueMarker().drawText((Graphics3D) g);
I'll open a new ticket in the public tracker to try implement an event or some other feature to support this.
http://bugs.teechart.net/show_bug.cgi?id=797
Feel free to add your mail to the CC list to be automatically notified when an update arrives.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Perbit
Newbie
Newbie
Posts: 10
Joined: Fri May 30, 2014 12:00 am

Re: CircularGauge - PackageMistake?

Post by Perbit » Tue Jun 17, 2014 12:57 pm

Hello Yeray,

I have another question about the CircularGauge.
Now I know, that it is only possible to have one threshold (Change between "GreenLine" and "RedLine").

I want to label this threshold and give it a name.
That means: Change between GreenLine and Redline is at value "5". So at value 5 I want to write something on the CircularGauge.

Is that possible?

Thank you very much for your support, Yeray!

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: CircularGauge - PackageMistake?

Post by Yeray » Tue Jun 17, 2014 2:37 pm

Hello,
Perbit wrote:Now I know, that it is only possible to have one threshold (Change between "GreenLine" and "RedLine").

I want to label this threshold and give it a name.
That means: Change between GreenLine and Redline is at value "5". So at value 5 I want to write something on the CircularGauge.

Is that possible?
Try with the Annotation tool. I suggested you to use it above, when I missed the NumericGauge embedded into the CircularGauge.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply