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

How to set labels for Y axis in column chart? Options · View
hennamullaji
#1 Posted : Friday, April 23, 2010 4:39:22 PM
Rank: Member

Groups: Registered

Joined: 2/9/2010
Posts: 16
Location: Earth
Hello,

I have a column chart in which i have labels on the X -axis, i created those labels by using

chartPoint.setAxisLabel()....but the problem is that these labels enter only on the x-axis, my query is how do i get these labels on the y axis...dont we have a

chartPoint.setYAxisLabel feature?

In my application the labels appear on x-axis and the y axis labels come by default as integer numbers.

Any help with code snippet would be appreciated.

Thanks and regards,
Henna
hennamullaji
#2 Posted : Sunday, April 25, 2010 4:32:31 PM
Rank: Member

Groups: Registered

Joined: 2/9/2010
Posts: 16
Location: Earth
Hey guys, someone please help me on this, I am still not able to figure it out.
I am sure there is an answer for this.
Thanks in advance,
Henna
Baydalka Volodymyr
#3 Posted : Monday, April 26, 2010 11:58:37 AM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

You may use ChartAxis.setFormat() method to set labels format.
-or-
Each axis has collection of custom labels. You can use it to specify your own axis labels. In order to access default area axes, use ChartArea.getDefaultY/XAxis API.
Note : You may want to set ChartAxis.setLabelsMode(ChartAxis.LabelsMode.NoLabels) to disable default labels

Best regards,
Volodymyr Baydalka
Andriod development and support team
hennamullaji
#4 Posted : Monday, April 26, 2010 2:02:25 PM
Rank: Member

Groups: Registered

Joined: 2/9/2010
Posts: 16
Location: Earth
Hey thanks but this is not working for me,

Below is my code

ChartView chartView=(ChartView)findViewById(R.id.chart1);
ChartSeries series=new ChartSeries("Series1", ChartTypes.Column);

double[] values={43.213,22.432,98.786,87.887,34.765};
String[] labels={"Anne","Bbba","Cignit","Galileo","Mediine"};

for(int k=0;k<values.length;k++)
{
ChartPoint chartPoint=new ChartPoint(k,values[k]);
chartPoint.setAxisLabel(labels[k]);

chartPoint.setLabelFormat("$"+values[k]);
series.getPoints().add(chartPoint);
}

area.getDefaultXAxis().setLabelsMode(LabelsMode.SeriesLabels);
series.setShowLabel( true );

series.setArea( area.getName() );
chartView.getSeries().add( series );


Now what happens is that on the X axis I get the values in the labels array properly, but on the y axis I get a range of o-10,000-20,000...and so on.
I want my float values i.e 43.213 , 22.432 ...to appear on the y axis.

Please help me on this,
Thanks,
Henna

Baydalka Volodymyr
#5 Posted : Tuesday, April 27, 2010 9:53:10 AM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Please, try to add this code to end of your sample :

Code:
ChartAxis yAxis = area.getDefaultYAxis();
       
yAxis.setLabelsMode(LabelsMode.NoLabels);
          
for (double value : values)
{
    String text = Double.toString(value);
    yAxis.getCustomLabels().add(new ChartAxis.Label(text, value));
}


Best regards,
Volodymyr Baydalka
Andriod development and support team
hennamullaji
#6 Posted : Tuesday, April 27, 2010 4:20:58 PM
Rank: Member

Groups: Registered

Joined: 2/9/2010
Posts: 16
Location: Earth
Hey thanks a lot Volodymyr.
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.