alper
alper

Reputation: 11

How to add chart from teechart library to an existing layout

How to add a chart (from teechart library) to a layout that i created in xamarin android application?

Examples/tutorials that i found are changing all content view by using setcontentview method as follows.

However, I would like to add this as part of a layout.

Upvotes: 1

Views: 433

Answers (2)

Narcís Calvet
Narcís Calvet

Reputation: 7452

Yes, this is possible as adding any other object to a layout, just use the AddView method with desired LayoutParams, for example:

Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart(this); 
RelativeLayout rLayout = new RelativeLayout(this);

RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(400, 400);
lp.LeftMargin = 0;
lp.TopMargin = 0;

rLayout.AddView(tChart1, lp);

Upvotes: 2

JasJar
JasJar

Reputation: 332

Ok man take a look at this line:

  Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart(this); 

It seems a view declaration, have you tried to add it on your xml file and then casting it using findViewById? This way you could add it as another view on your layout.

Upvotes: 0

Related Questions