Problem with Bar

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Problem with Bar

Post by rubby » Thu Aug 29, 2013 3:26 am

Hello,

my code looks like:

TChar tchart2 = new TChart();
tchart2.addSeries(new Bar());
tchar2.getSeries(0).add(10);
tchart2.addSeries(new Bar());
tchar2.getSeries(1).add(18);
tchart2.addSeries(new Bar());
tchar2.getSeries(2).add(30);

Finally, only the first series is showed.
That is, only one bar is showed. There must be three bars.
Does anyone know how to address this?
Thanks.

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: Problem with Bar

Post by rubby » Fri Aug 30, 2013 3:08 am

my code is as follows.
In the bar.png, you will find there is only one bar which is wrong.

Code: Select all

import com.steema.teechart.Dimension;
import com.steema.teechart.Rectangle;
import com.steema.teechart.TChart;
import com.steema.teechart.editors.ChartEditor;
import com.steema.teechart.styles.Bar;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JDialog;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

/**
 *
 * @author
 */
public class TestTeeChartJunit extends JDialog {

    public TestTeeChartJunit() {
        this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        setSize(new Dimension(581, 380));

        setTitle("TeeChart for Java - Swing example application");

        tChart2 = new TChart();
        tChart2.setGraphics3D(null);
//        tChart2.addSeries(new Line());
//        tChart2.getSeries(0).fillSampleValues(); //随机数


        tChart2.addSeries(new Bar());
        tChart2.getSeries(0).add(10); 
        tChart2.addSeries(new Bar());
        tChart2.getSeries(1).add(13); 
        tChart2.addSeries(new Bar());
        tChart2.getSeries(2).add(49); 
        tChart2.addSeries(new Bar());
        tChart2.getSeries(3).add(55);
 

        tChart2.setBounds(new Rectangle(0, 0, 500, 500));

        //设置图标的属性
        tChart2.getAspect().setView3D(false); // no 3D
        // tChart2.getLegend().setText("jw legend");
        this.add(tChart2);
        tChart2.setComponentPopupMenu(popup);
        JMenuItem item = new JMenuItem("Property");
        item.addActionListener(new RightListener(tChart2));
        popup.add(item);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        TestTeeChartJunit myChart = new TestTeeChartJunit();
    }
    TChart tChart2;
    JPopupMenu popup = new JPopupMenu();
}

class RightListener implements ActionListener {

    TChart tChart2 = null;

    public RightListener(TChart chart) {
        this.tChart2 = chart;
    }

    public void actionPerformed(ActionEvent e) {
        ChartEditor.editChart(tChart2.getChart());
    }
}
Attachments
bar.png
bar.png (13.47 KiB) Viewed 2401 times

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

Re: Problem with Bar

Post by Yeray » Fri Aug 30, 2013 12:18 pm

Hi,

That's a problem already present in the defect list to be fixed for further releases (TJ71016295).
I've incremented the ticket priority.
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

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: Problem with Bar

Post by rubby » Tue Sep 24, 2013 2:26 am

hello,

I find an approach to avoid this problem by

Code: Select all

chart.getAspect().setView3D(true)
does there exists some other approaches to avoid this problem?
e.g. set bigger distance between each bar? or something else?

rubby
Newbie
Newbie
Posts: 38
Joined: Mon Aug 12, 2013 12:00 am

Re: Problem with Bar

Post by rubby » Tue Sep 24, 2013 3:08 am

Hello,

luckily, i find a perfect approach to avoid the bar problem which is very common and confuse the users always.

Code: Select all

(Bar)chart.getSeries(i).setMultiBar(MultiBars.SIDEALL)
:P

Post Reply