Circular.adjustCircleMarks buggy for small screens

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
znakeeye
Newbie
Newbie
Posts: 44
Joined: Mon Jan 07, 2013 12:00 am

Circular.adjustCircleMarks buggy for small screens

Post by znakeeye » Mon Jan 28, 2013 10:14 pm

pie.getMarks().setVisible(true);
pie.getMarks().setStyle(MarksStyle.SERIESTITLE);

Consider your code in the adjustCircleMarks() function:

...
rCircleRect.y += tmpH;
rCircleRect.height -= 2 * tmpH;
...
rCircleRect.x += tmpW;
rCircleRect.width -= 2 * tmpW;

On some screens (using Samsung GT-S55701 here), this will produce zero-width pies. I believe the subtraction/multiplication is dangerous.

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

Re: Circular.adjustCircleMarks buggy for small screens

Post by Yeray » Thu Jan 31, 2013 3:16 pm

Hello,

We have an S5570 but I can't reproduce it here. Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
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

znakeeye
Newbie
Newbie
Posts: 44
Joined: Mon Jan 07, 2013 12:00 am

Re: Circular.adjustCircleMarks buggy for small screens

Post by znakeeye » Sat Feb 23, 2013 3:32 pm

I have very limited time on this project, so unfortunately a sample project has to wait.

However, this fixed the issue:

pie.getMarks().setVisible(true);
pie.getMarks().getPen().setVisible(false);
pie.getMarks().getCallout().setLength(0);
pie.getMarks().setStyle(MarksStyle.SERIESTITLE);

Note the call to "setLength". Maybe that can point you in the right direction?

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

Re: Circular.adjustCircleMarks buggy for small screens

Post by Yeray » Tue Feb 26, 2013 4:02 pm

Hi,

If the callouts are too long for a chart size, this makes the pie not to be visible because there isn't enough space for it.
However, I've seen there was a problem in Series.java making SERIESTITLE, POINTINDEX or PERCENTRELATIVE MarksStyles to show empty Marks (TJ71016528).
I've just fixed it for the next maintenance release.
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

znakeeye
Newbie
Newbie
Posts: 44
Joined: Mon Jan 07, 2013 12:00 am

Re: Circular.adjustCircleMarks buggy for small screens

Post by znakeeye » Sat Apr 27, 2013 10:08 am

Can you please show the necessary changes so that I can apply it to my source code? My pies keep disappearing :(

znakeeye
Newbie
Newbie
Posts: 44
Joined: Mon Jan 07, 2013 12:00 am

Re: Circular.adjustCircleMarks buggy for small screens

Post by znakeeye » Sat Apr 27, 2013 10:56 am

Hmm. One way to produce the error I'm seeing is to disable localization (as described in another thread).

If loading the "CharForHeight" string fails, the returned value will be 69 - a very high value which might produce zero-width pies in the end.

This solved it for my localization hack:

Code: Select all

int tmpW = Utils.round(maxMarkWidth() +
                                   chart.getGraphics3D().textWidth("W"/*Language.getString("CharForHeight")*/) + tmpFrame);

znakeeye
Newbie
Newbie
Posts: 44
Joined: Mon Jan 07, 2013 12:00 am

Re: Circular.adjustCircleMarks buggy for small screens

Post by znakeeye » Sat Apr 27, 2013 12:23 pm

I believe this is a good trade-off:

Code: Select all

if (2 * tmpH >= rCircleRect.height) {
    tmpH = rCircleRect.height / 10;
}

Code: Select all

if (2 * tmpW >= rCircleRect.width) {
    tmpW = rCircleRect.width / 10;
}

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

Re: Circular.adjustCircleMarks buggy for small screens

Post by Yeray » Fri May 03, 2013 9:43 am

Hi,

Excuse us for the delayed reply here.
znakeeye wrote:Can you please show the necessary changes so that I can apply it to my source code? My pies keep disappearing :(
I don't think this will fix the problem you suffer. Anyway, the change at Series.java for TJ71016528 was at the end of the getMarkText function. Where you could read this:

Code: Select all

//...
		} else if (marks.markerStyle == MarksStyle.XY) {
			tmpResult = getAXValue(valueIndex) + tmp + getAYValue(valueIndex);
		} else {
			tmpResult = "";
		}

		return customMarkText.getMarkText(valueIndex, tmpResult);
	}
Change it for this:

Code: Select all

//...
		} else if (marks.markerStyle == MarksStyle.XY) {
			tmpResult = getAXValue(valueIndex) + tmp + getAYValue(valueIndex);
		} else if (marks.markerStyle == MarksStyle.SERIESTITLE) {
			 tmpResult = this.toString();
		} else if (marks.markerStyle == MarksStyle.POINTINDEX) {
			tmpResult = String.valueOf(valueIndex);
		} else if (marks.markerStyle == MarksStyle.PERCENTRELATIVE) {
			double pval = (valueIndex == 0) ? 1.0 : getMarkValue(valueIndex) / getMarkValue(0);
			tmpResult = percentDecimal.format(pval*100);
		} else {
			tmpResult = "";
		}

		return customMarkText.getMarkText(valueIndex, tmpResult);
	}
znakeeye wrote:Hmm. One way to produce the error I'm seeing is to disable localization (as described in another thread).
Correct me if I didn't understood it correctly. You disabled the localization as said here, this makes the application crash when it tries to do some calculations with the labels and the code above is a workaround for this. Am I correct?
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