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

Chart is not showing -ve axis value Options · View
Rabish
#1 Posted : Friday, February 15, 2013 8:52:32 AM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
Hi,

I am using maximum value 2013 and minimum value -360. These values I am getting from xml.

Below are the written codes:
chartArea.getDefaultYAxis().getScale().setMaximum(max);
chartArea.getDefaultYAxis().getScale().setMinimum(min); ChartArea.getDefaultYAxis().getScale().setInterval(Double.valueOf(max/4f));

I tried with setOrigin() also but no help, On Y-Axis -360 is not coming.
chartArea.getDefaultYAxis().setOrigin(min);

But when I used interval as 100.0, -ve values came on y-axis. Please refer to attached screenshots.
But I need axis value from -360 to 2013 with 4 or 5 intervals.
Max and min value can be any thing, like 200000 and -100.


Please help.

Thanks
Rabish attached the following image(s):
Chart1.jpg (51kb) downloaded 41 time(s).
Chart2.jpg (88kb) downloaded 38 time(s).
Rabish
#2 Posted : Friday, February 15, 2013 11:03:16 AM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
One more question..

If max value is too large like 20000000.0, can I show on axis as 2.E7?

Please suggest a way to do this :)

Thanks
Rabish
#3 Posted : Friday, February 15, 2013 11:59:41 AM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
Scientific notation I am able to achieve using a format like below:

DecimalFormat formatter = new DecimalFormat("0.####E0");
chartArea.getDefaultYAxis().setLabelFormat(formatter);

But I am getting 0 as 0E0. Is There any way to make it again zero? I want to show zero as 0 only.
Rabish
#4 Posted : Tuesday, February 19, 2013 11:34:21 AM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
Can please someone from support will reply to my these two questions?
Rabish
#5 Posted : Wednesday, February 27, 2013 11:08:58 AM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
Any update on this?
Baydalka Volodymyr
#6 Posted : Wednesday, February 27, 2013 12:38:18 PM
Rank: Developers Team


Groups: Registered, Administrators

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

Default labels adapter chooses zero as more better value to start labels generation. In your case you need something simpler.

Try to implement your own labels adapter. Example:

Code:
ChartAxis.LabelsAdapter SIMPLE_ADAPTER = new ChartAxis.LabelsAdapter()
{
    @Override
    public void updateLabels(ChartAxis axis, List output)
    {
        output.clear();
        
        double min = axis.getScale().getVisibleMinimum();
        double max = axis.getScale().getVisibleMaximum();
        double step = (max - min) / 4;

        for (double p = min; p <= max; p += step)
        {
            output.add(new Label(String.format("%.2e", p), p));
        }                
    }
};

chartArea.getDefaultYAxis().setLabelsAdapter(SIMPLE_ADAPTER);


Best regards,
Volodymyr Baydalka
Andriod development and support team
Rabish
#7 Posted : Thursday, March 21, 2013 12:33:19 PM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
Hello,

After using suggested adapter I am not getting horizontal grids. Please help.

Regards,
Rabish
Baydalka Volodymyr
#8 Posted : Friday, March 22, 2013 1:31:04 PM
Rank: Developers Team


Groups: Registered, Administrators

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

Try change next line :
Code:

//from
output.add(new Label(String.format("%.2e", p), p));
//to
output.add(new Label(String.format("%.2e", p), p, Label.OPTION_ALL));


Best regards,
Volodymyr Baydalka
Andriod development and support team
Rabish
#9 Posted : Friday, March 22, 2013 2:05:39 PM
Rank: Member

Groups: Registered

Joined: 2/11/2013
Posts: 24
Location: Bangalore
Thanks, suggested change is working.


Best Regards,
Rabish
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.