Page 1 of 1

custom marks on bar

Posted: Mon Sep 27, 2010 9:27 pm
by 7667590
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);
    }

Re: custom marks on bar

Posted: Wed Oct 06, 2010 9:35 am
by yeray
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");