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 Search | Active Topics | Log In | Register

ChartTitle Options · View
roberto
#1 Posted : Tuesday, January 29, 2013 12:29:20 PM
Rank: Newbie

Groups: Registered

Joined: 1/16/2013
Posts: 6
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.




Is it possible to reach this objective?

Thank you in advance.
Best regards,

Roberto
Baydalka Volodymyr
#2 Posted : Wednesday, January 30, 2013 2:45:18 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
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 6:58:39 PM
Rank: Newbie

Groups: Registered

Joined: 1/16/2013
Posts: 6
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-2016 ArtfulBits. All rights reserved.