CircularGauge Color bug (Java Android)

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
FrankLiemar
Newbie
Newbie
Posts: 15
Joined: Wed Oct 30, 2013 12:00 am

CircularGauge Color bug (Java Android)

Post by FrankLiemar » Mon Nov 11, 2013 9:16 am

Hello.
I have been using the Circular Gauge from the Teechart library.
But when the begin of the Green line starts at 30% of the graph or below the Colors of the green line start to act weird.
The beginning of the Green Line becomes the Middle Color (if you use it) or the End Color.

Also the Starting Color of the Red Line becomes the End Color.
And the End Color of the Red Line becomes the Starting Color.

See the attachment for the source code.
Attachments
Android Circular Gauge Bug.zip
Source
(1.15 KiB) Downloaded 1323 times

FrankLiemar
Newbie
Newbie
Posts: 15
Joined: Wed Oct 30, 2013 12:00 am

Re: CircularGauge Color bug (Java Android)

Post by FrankLiemar » Mon Nov 11, 2013 9:30 am

Here is a screenshot.
Attachments
Gauge Bug.png
Gauge Bug.png (139.98 KiB) Viewed 19516 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: CircularGauge Color bug (Java Android)

Post by Narcís » Tue Nov 12, 2013 4:10 pm

Hello,

This looks like a bug. Could you please add it to bugzilla? Doing so you'll be identified as the creator of the issue and therefore notified about its evolution.

Thanks in advance.
Best Regards,
Narcís Calvet / 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

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: CircularGauge Color bug (Java Android)

Post by Marc » Thu Nov 14, 2013 3:51 pm

Hello,

The effect you see is due to the limitation of the underlying gradient that the green (or red) line uses.

If you were to consider the gradient spread across a rectangle that covers the entire gauge-face and the green line arc being a cut-out across that rectangle, then you will notice that the arc will cover the same colour zones of the gradient twice if it is set to a large percentage of the entire circle. If you wish to offset that effect we recommend that you limit the gradient to two colours or set the first and middle colours as the same colour to cover a wider section of the arc.

Alternatively, knowing that the gradient is being plotted in this way you could also change the direction of it to vertical to modify the apperance.
eg.

Code: Select all

series.getGreenLine().getGradient().setDirection(GradientDirection.BACKDIAGONAL);
Regards,
Marc Meumann
Steema Support

FrankLiemar
Newbie
Newbie
Posts: 15
Joined: Wed Oct 30, 2013 12:00 am

Re: CircularGauge Color bug (Java Android)

Post by FrankLiemar » Fri Nov 15, 2013 8:37 am

Hi marc.
I understand the limitations of the gradient.
But i really want to show the gauge with a certain gauge.
And i want the gradient to look the same no matter how long the Green Line is.

I want it to look like this (The beginning of the green line may be changed to any size and i still need the same result)
Attachments
Gauge Bug2.png
Gauge Bug2.png (128.57 KiB) Viewed 19460 times

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: CircularGauge Color bug (Java Android)

Post by Marc » Thu Nov 21, 2013 12:41 pm

Hello Frank,

You can get quite a close reflection of what you need with:

Code: Select all

series.getGreenLine().getGradient().setStartColor(Color.YELLOW);
series.getGreenLine().getGradient().setMiddleColor(Color.YELLOW);
series.getGreenLine().getGradient().setEndColor(Color.GREEN);

series.getGreenLine().getGradient().setDirection(GradientDirection.BACKDIAGONAL);
The only exception I could see, that the appearance changes greatly is when the GreenLine is limited to a small percentage at the high end of the Chart, for example when value range is only 20% of the total scale range. In that case you could adjust the gradient direction to VERTICAL.

Regards,
Marc
Steema Support

FrankLiemar
Newbie
Newbie
Posts: 15
Joined: Wed Oct 30, 2013 12:00 am

Re: CircularGauge Color bug (Java Android)

Post by FrankLiemar » Thu Nov 21, 2013 3:13 pm

This worked for me

Code: Select all

                    Series.getGreenLine().getGradient().setDirection(GradientDirection.HORIZONTAL);
                    Series.getGreenLine().getGradient().setStartColor(Color.YELLOW);
                    Series.getGreenLine().getGradient().setMiddleColor(Color.GREEN);
                    Series.getGreenLine().getGradient().setEndColor(Color.GREEN);
Thankyou for your help.

Post Reply