No Mark when there is single Bar on Chart

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Dharmesh Patel
Newbie
Newbie
Posts: 6
Joined: Mon Nov 19, 2012 12:00 am

No Mark when there is single Bar on Chart

Post by Dharmesh Patel » Mon Jan 28, 2013 6:44 am

Hi,

I have created application which use this Bar chart.To show issue to you I have also created Demo application and Chart related snippet is as follow:

Code: Select all

        TChart chart = new TChart(this);
        LinearLayout linearLayout = (LinearLayout)findViewById(R.id.linearLayout);
        Bar bar = new Bar(chart.getChart());

        chart.getAspect().setView3D(false);
        
        StringList labelsList = new StringList(1);
        labelsList.add(0,"40");

        bar.getMarks().setVisible(true);
        bar.setMarksOnBar(true);
        bar.add(0,40,"40");
        bar.setLabels(labelsList);
        
        chart.getAxes().getBottom().getCustomLabels().clear();
        chart.getAxes().getBottom().getCustomLabels().add(0.0, "40");
        
        linearLayout.addView(chart);
I have also tried options that given on below link :

http://www.teechart.net/support/viewtop ... 10&t=13444

Above snippet's result is shown in below image :
TeeChart_SingleBar_Issue.jpg
TeeChart_SingleBar_Issue.jpg (29.88 KiB) Viewed 7206 times
Please reply me what to do if I want to show mark when there is only "Single Bar" in Chart ?

Regards,
Dharmesh patel

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: No Mark when there is single Bar on Chart

Post by Yeray » Mon Jan 28, 2013 2:02 pm

Hi

You can set the Marks visible or invisible with the following function:

Code: Select all

bar.getMarks().setVisible(true);
And you could check if your series has one value or several with the getCount() function:

Code: Select all

bar.getMarks().setVisible(bar.getCount()==1);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply