CircularGauge Look

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

CircularGauge Look

Post by Mulderone » Thu Jun 07, 2012 1:11 pm

Hi,

i try to create a circular Gauge like this
CircularGauge.png
CircularGauge.png (10.18 KiB) Viewed 30638 times
How to make a 180°circular instead full circle, by default ?

How to change the needle look ?

Thanks for your help

mts
Newbie
Newbie
Posts: 18
Joined: Fri Apr 29, 2011 12:00 am

Re: CircularGauge Look

Post by mts » Thu Jun 07, 2012 2:53 pm

Circular gauge will always be a full circle, though you can set where the data ticks start by using setRotationAngle and setTotalAngle. If you want a 180 gauge use the regular Gauges series.

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

Re: CircularGauge Look

Post by Yeray » Thu Jun 07, 2012 3:32 pm

Hi Mulderone,

I get the gauges in the image below with the following code:

Code: Select all

		tChart1.getHeader().setVisible(false);
		tChart1.getPanel().setColor(Color.fromArgb(167, 200, 85));
		Gauges gauges1 = new Gauges(tChart1.getChart());
		gauges1.setTotalAngle(180);
		gauges1.setRotationAngle(180);
		gauges1.setMaximum(120);
		gauges1.setValue(60);
		gauges1.getVertAxis().getLabels().setVisible(false);
		gauges1.getVertAxis().setIncrement(10);
		gauges1.getVertAxis().getTicks().setLength(10);
		gauges1.getVertAxis().getTicks().setWidth(3);
		gauges1.getVertAxis().getTicks().setColor(Color.WHITE);
		gauges1.getVertAxis().getMinorTicks().setVisible(false);
		gauges1.getVertAxis().getAxisPen().setVisible(false);
		gauges1.getPen().setColor(Color.WHITE);
		gauges1.getCenter().getPen().setVisible(false);
Gauges.png
Gauges.png (9.25 KiB) Viewed 30572 times
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

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Thu Jun 07, 2012 3:41 pm

Marvellous!!!!

Thanks for your help

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Thu Jun 07, 2012 6:54 pm

Hi Yeray,

it works but i'm using the android version of this library and i have a half-circle at the bottom which remains.

I don't know how to disable it , to obtain the same chart as you

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Thu Jun 07, 2012 7:25 pm

i give you a screen capture of my android app, as you see , i have a gray semi circle at the chart's bottom
android_circular.png
android_circular.png (7.01 KiB) Viewed 30598 times

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

Re: CircularGauge Look

Post by Yeray » Fri Jun 08, 2012 1:33 pm

Hi Mulderone,

It seems there's a bug here. I'm trying to find a definitive fix.
In the meanwhile, since you are source code customer, you could apply a temporal fix manually. In Graphics3DAndroid.java (in com/steema/teechart/android/), you'll find the arc method says:

Code: Select all

	public void arc(int x1, int y1, int x2, int y2, final double startAngle,
			final double sweepAngle) {
		canvas.drawArc(new RectF(x1,y1,x2,y2), (float)startAngle, (float)sweepAngle, 
			false, pen.getPaint());
	}
Change the above for the following, just adding a condition:

Code: Select all

	public void arc(int x1, int y1, int x2, int y2, final double startAngle,
			final double sweepAngle) {
		if (pen.visible) {
			canvas.drawArc(new RectF(x1,y1,x2,y2), (float)startAngle, (float)sweepAngle, 
					false, pen.getPaint());
		}
	}
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

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Fri Jun 08, 2012 2:21 pm

i'll try that and i'll keep you in touch

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Fri Jun 08, 2012 3:05 pm

It works, the bottom semi-circle disappear.

But i think that the overall rectangle size must be calculated again , to fit the inside draw, as the screen shot you put in your previous reply

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

Re: CircularGauge Look

Post by Yeray » Fri Jun 08, 2012 3:44 pm

Hi Mulderone,

Right. That's what I've just done. It will be fixed with the next maintenance release.
If you need the changes tell me and I'll send/explain you.
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

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Fri Jun 08, 2012 5:25 pm

Hi,

yes, until the next delivery, it would be nice if you send me or explain the solution

Best regards

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

Re: CircularGauge Look

Post by Yeray » Mon Jun 11, 2012 11:51 am

Hi Mulderone,

I'll send you the changes to the mail account you have registered in this forum.
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

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Mon Jun 11, 2012 2:30 pm

Yeray,

it doesn't work. The rectangle which contains the drawing circle is the same as my previous post as if the circle is complete instead of a wanted semi-circle.

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

Re: CircularGauge Look

Post by Yeray » Mon Jun 11, 2012 3:20 pm

Hi Mulderone,

I've just verified it.This is my testing application:

Code: Select all

package com.steema.test;

import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;

import com.steema.teechart.TChart;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.styles.Gauges;

public class AndroidTestActivity extends Activity {

	private TChart tChart1;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		LinearLayout group = (LinearLayout) findViewById(R.id.linearLayoutTchart);

		createChart(group);
		initializeChart();
	}

	private void createChart(LinearLayout group) {
		tChart1 = new TChart(this);
		group.addView(tChart1);
	}

	private void initializeChart() {
	      tChart1.getHeader().setVisible(false);
	      tChart1.getPanel().setColor(Color.fromArgb(167, 200, 85));
	      Gauges gauges1 = new Gauges(tChart1.getChart());
	      gauges1.setTotalAngle(180);
	      gauges1.setRotationAngle(180);
	      gauges1.setMaximum(120);
	      gauges1.setValue(60);
	      gauges1.getVertAxis().getLabels().setVisible(false);
	      gauges1.getVertAxis().setIncrement(10);
	      gauges1.getVertAxis().getTicks().setLength(10);
	      gauges1.getVertAxis().getTicks().setWidth(3);
	      gauges1.getVertAxis().getTicks().setColor(Color.WHITE);
	      gauges1.getVertAxis().getMinorTicks().setVisible(false);
	      gauges1.getVertAxis().getAxisPen().setColor(Color.RED);
	      gauges1.getVertAxis().getAxisPen().setWidth(1);
	      gauges1.getPen().setColor(Color.WHITE);
	      gauges1.getCenter().getPen().setVisible(false);
	}
}
The code above, with TeeChart Java for Android v3.2012.0202, gives me the following result:
wrong.png
wrong.png (8.13 KiB) Viewed 30522 times
With the changes I sent you, it changes to this:
ok, red.png
ok, red.png (8.22 KiB) Viewed 30520 times
Then, if I add the following line:

Code: Select all

	      gauges1.getVertAxis().getAxisPen().setVisible(false);
This is what I get (TeeChart Java for Android v3.2012.0202 with TJ71016219 fix):
ok.png
ok.png (6.23 KiB) Viewed 30532 times
Could you please check it again? Please, make sure you make a full Clean&Rebuild.
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

Mulderone
Newbie
Newbie
Posts: 26
Joined: Mon Oct 03, 2011 12:00 am

Re: CircularGauge Look

Post by Mulderone » Mon Jun 11, 2012 3:55 pm

yes, me too, i do exactly what you ask me to do.

So, the resulting chart as the same size as before as if only the bottom semi-circle isn't drawn but the used space already exist.

What i expect is a "packed" semi-circle, without the bottom space which has the same size as the upper semi-circle

Post Reply