Page 1 of 2
CircularGauge Look
Posted: Thu Jun 07, 2012 1:11 pm
by 17060329
Hi,
i try to create a circular Gauge like this
- CircularGauge.png (10.18 KiB) Viewed 34674 times
How to make a 180°circular instead full circle, by default ?
How to change the needle look ?
Thanks for your help
Re: CircularGauge Look
Posted: Thu Jun 07, 2012 2:53 pm
by 15359204
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.
Re: CircularGauge Look
Posted: Thu Jun 07, 2012 3:32 pm
by yeray
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 (9.25 KiB) Viewed 34608 times
Re: CircularGauge Look
Posted: Thu Jun 07, 2012 3:41 pm
by 17060329
Marvellous!!!!
Thanks for your help
Re: CircularGauge Look
Posted: Thu Jun 07, 2012 6:54 pm
by 17060329
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
Re: CircularGauge Look
Posted: Thu Jun 07, 2012 7:25 pm
by 17060329
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 (7.01 KiB) Viewed 34634 times
Re: CircularGauge Look
Posted: Fri Jun 08, 2012 1:33 pm
by yeray
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());
}
}
Re: CircularGauge Look
Posted: Fri Jun 08, 2012 2:21 pm
by 17060329
i'll try that and i'll keep you in touch
Re: CircularGauge Look
Posted: Fri Jun 08, 2012 3:05 pm
by 17060329
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
Re: CircularGauge Look
Posted: Fri Jun 08, 2012 3:44 pm
by yeray
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.
Re: CircularGauge Look
Posted: Fri Jun 08, 2012 5:25 pm
by 17060329
Hi,
yes, until the next delivery, it would be nice if you send me or explain the solution
Best regards
Re: CircularGauge Look
Posted: Mon Jun 11, 2012 11:51 am
by yeray
Hi Mulderone,
I'll send you the changes to the mail account you have registered in this forum.
Re: CircularGauge Look
Posted: Mon Jun 11, 2012 2:30 pm
by 17060329
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.
Re: CircularGauge Look
Posted: Mon Jun 11, 2012 3:20 pm
by yeray
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 (8.13 KiB) Viewed 34558 times
With the changes I sent you, it changes to this:
- ok, red.png (8.22 KiB) Viewed 34556 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 (6.23 KiB) Viewed 34568 times
Could you please check it again? Please, make sure you make a full Clean&Rebuild.
Re: CircularGauge Look
Posted: Mon Jun 11, 2012 3:55 pm
by 17060329
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