custom marks on bar

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Jonathan
Newbie
Newbie
Posts: 60
Joined: Tue Mar 11, 2008 12:00 am
Location: Austin

custom marks on bar

Post by Jonathan » Mon Sep 27, 2010 9:27 pm

Hi,

I want to display custom marks of count and percent at the same time on each bars. When I use setLabels API, the custom label also replaces x label (in my example, A and B) as well. Is there a way not to replace the x label but display the custom labels/mark on bar series ? (In my example below, x label should be "A" and "B", and the custom mark should be "40, 40%" and "60, 60%", respectively)

Code: Select all

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        JPanel panel = new JPanel();
        panel.setSize(600, 600);
        final TChart chart = new TChart();
        final int INCREMENT = 10;
        ChartPaintListener chartPaintListener;
        panel.add(chart);

        Bar b = new Bar(chart.getChart());
        b.add(0,40,"A");
        b.add(1,60,"B");
        
        StringList label = new StringList(1);
        label.add(0,"40, 40%");
        label.add(1,"60, 60%");
        b.setLabels(label);
     
        chart.getAspect().setView3D(false);

        frame.add(panel);
        frame.setSize(600, 600);
        frame.setVisible(true);
    }

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

Re: custom marks on bar

Post by Yeray » Wed Oct 06, 2010 9:35 am

Hi Jonathan,

You could set Bar marks to show the labels and use custom labels to show the axis labels:

Code: Select all

        tChart1.getAspect().setView3D(false);

        com.steema.teechart.styles.Bar b = new com.steema.teechart.styles.Bar(tChart1.getChart());
        b.add(0, 40, "40, 40%");
        b.add(1, 60, "60, 60%");

        tChart1.getAxes().getBottom().getCustomLabels().clear();
        tChart1.getAxes().getBottom().getCustomLabels().add(0.0, "A");
        tChart1.getAxes().getBottom().getCustomLabels().add(1.0, "B");
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