whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
roberto  
#1 Posted : Tuesday, January 29, 2013 2:29:20 PM(UTC)
roberto
Rank: Newbie

Groups: Registered
Joined: 1/16/2013(UTC)
Posts: 6
Man

Hi,
i add a title to the chart as following:
Code:
chartView.getChartTitles().add(chartTitle)
where chartTitle is an instance of class ChartTitle.
I apply some customizations to the title but i'm not able to place it in the desired position. I try to use:
Code:
chartTitle.setDock(Dock.Top);
chartTitle.setAlignment(ChartLayoutElement.Alignment.Near);


I need to align the title within Y-axis as in the following screenshots.

UserPostedImage
UserPostedImage

Is it possible to reach this objective?

Thank you in advance.
Best regards,

Roberto
Baydalka Volodymyr  
#2 Posted : Wednesday, January 30, 2013 4:45:18 PM(UTC)
Baydalka Volodymyr
Rank: Member

Groups: Registered
Joined: 7/28/2009(UTC)
Posts: 447
Man

Hi,

Your may layout it manually. Quick sample:

Code:
public class ChartViewEx extends ChartView
{
	public ChartTitle yaxisTitle = new ChartTitle();

	public ChartViewEx(Context context)
  {
	  super(context);
	  
	  getTitles().add(yaxisTitle);
	  setPadding(0, 20, 0, 0); // add padding from top 
  }

	@Override
	protected void onDraw(Canvas canvas)
	{
		getChart().ensureLayout(false); //layout chart is needed
		
		ChartArea myArea = getAreas().get(0);
		RectF axisBounds = myArea.getDefaultYAxis().getBounds();
		
		Point titleSize = new Point(getWidth(), getHeight());
		yaxisTitle.measure(titleSize);
		yaxisTitle.setBounds((int)axisBounds.left - titleSize.x, (int)axisBounds.top - titleSize.y, 
				(int)axisBounds.left, (int)axisBounds.top);  
		
	  super.onDraw(canvas);
	}	
}


Best regards,
Volodymyr Baydalka
Andriod development and support team
roberto  
#3 Posted : Wednesday, January 30, 2013 8:58:39 PM(UTC)
roberto
Rank: Newbie

Groups: Registered
Joined: 1/16/2013(UTC)
Posts: 6
Man

Great, It works as expected.

Thank you a lot.

Roberto
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2017 ArtfulBits. All rights reserved.