Page 1 of 1
Problem with Bar
Posted: Thu Aug 29, 2013 3:26 am
by 17466735
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.
Re: Problem with Bar
Posted: Fri Aug 30, 2013 3:08 am
by 17466735
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());
}
}
Re: Problem with Bar
Posted: Fri Aug 30, 2013 12:18 pm
by yeray
Hi,
That's a problem already present in the defect list to be fixed for further releases (TJ71016295).
I've incremented the ticket priority.
Re: Problem with Bar
Posted: Tue Sep 24, 2013 2:26 am
by 17466735
hello,
I find an approach to avoid this problem by
does there exists some other approaches to avoid this problem?
e.g. set bigger distance between each bar? or something else?
Re: Problem with Bar
Posted: Tue Sep 24, 2013 3:08 am
by 17466735
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)
![Razz :P](./images/smilies/icon_razz.gif)