Page 1 of 1

Circular.adjustCircleMarks buggy for small screens

Posted: Mon Jan 28, 2013 10:14 pm
by 17064597
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.

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Thu Jan 31, 2013 3:16 pm
by yeray
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.

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Sat Feb 23, 2013 3:32 pm
by 17064597
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?

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Tue Feb 26, 2013 4:02 pm
by yeray
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.

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Sat Apr 27, 2013 10:08 am
by 17064597
Can you please show the necessary changes so that I can apply it to my source code? My pies keep disappearing :(

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Sat Apr 27, 2013 10:56 am
by 17064597
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);

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Sat Apr 27, 2013 12:23 pm
by 17064597
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;
}

Re: Circular.adjustCircleMarks buggy for small screens

Posted: Fri May 03, 2013 9:43 am
by yeray
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?