Page 1 of 1

Shadow color for header?

Posted: Sat Mar 02, 2013 10:35 pm
by 17064597
http://stackoverflow.com/questions/1414 ... n-teechart

TJ71016479

Will this be added in the maintenance release? This feature is very important for me!

Re: Shadow color for header?

Posted: Tue Mar 05, 2013 9:24 am
by yeray
Hello,

I've revised it and I found a fix for it. So yes, the next maintenance release will include this fix.

Re: Shadow color for header?

Posted: Tue Mar 12, 2013 10:21 pm
by 17064597
Could you please share the patch for this bug?

Re: Shadow color for header?

Posted: Tue Mar 12, 2013 10:37 pm
by 17064597
This is what I came up with. Correct?

Code: Select all

protected void drawString(int x, int y, final String text, final ChartBrush brush) {
		
		// FIX:
		Paint fontPaint = brush.getPaint();
		fontPaint.setTextSize(font.getSize() * (float)(chart.getAspect().getFontZoom() * 0.01));
		// Paint fontPaint = font.getPaint((float) (chart.getAspect().getFontZoom() * 0.01));

Re: Shadow color for header?

Posted: Wed Mar 13, 2013 11:19 am
by yeray
Hello,

The fix I applied was a bit different but your suggestion looks better to me. The next maintenance release will include it.

Re: Shadow color for header?

Posted: Wed Mar 13, 2013 8:05 pm
by 17064597
I'm wondering if you should also set these:

fontPaint.setTypeface(font.getTypeFace()); // getTypeFace() needs to be implemented
fontPaint.setUnderlineText(font.getUnderline());
fontPaint.setStrikeThruText(font.getStrikeout());

Re: Shadow color for header?

Posted: Mon Mar 18, 2013 1:40 pm
by yeray
Hello,

Right, the fix you suggested breaks these properties.
The fix I initially used doesn't, so it could be better to use it:

Code: Select all

	protected void drawString(int x, int y, final String text, final ChartBrush brush) {
		final Paint fontPaint = font.getPaint((float) (chart.getAspect().getFontZoom() * 0.01));
		
		fontPaint.getTextBounds(text, 0, text.length(), textBounds);
		textSize.width=textBounds.width()+2;
		textSize.height=getFontHeight();

		//TJ71016479
		if (fontPaint.getColor() != brush.getColor().getRGB())
			fontPaint.setColor(brush.getColor().getRGB());
		//...
	}