Page 1 of 1

No Mark when there is single Bar on Chart

Posted: Mon Jan 28, 2013 6:44 am
by 17064216
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 7230 times
Please reply me what to do if I want to show mark when there is only "Single Bar" in Chart ?

Regards,
Dharmesh patel

Re: No Mark when there is single Bar on Chart

Posted: Mon Jan 28, 2013 2:02 pm
by yeray
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);