TeeChart with JScrollViewer
Posted: Thu May 08, 2014 10:03 pm
Hi,
I am working on teechart using horizontal bar series and I would like to know, how can i use a TeeChart with JScrollViewer?
I realized an implementation, but when I scrolling, the component (TeeChart) paint wrong (out of limits).
Please help me to solve the problem.
Implementation:
I am working on teechart using horizontal bar series and I would like to know, how can i use a TeeChart with JScrollViewer?
I realized an implementation, but when I scrolling, the component (TeeChart) paint wrong (out of limits).
Please help me to solve the problem.
Implementation:
Code: Select all
import com.steema.teechart.TChart;
import com.steema.teechart.styles.HorizBar;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
public class Teste {
public void initChart() {
JFrame jFrame = new JFrame();
TChart chart = new TChart();
JPanel baseChartJP = new JPanel();
JPanel southJP = new JPanel();
JScrollPane jScrollPane = new JScrollPane();
HorizBar horizBar;
chart.getLegend().setCurrentPage(true);
chart.getLegend().setVisible(false);
chart.getAspect().setView3D(false);
chart.getWalls().setVisible(true);
chart.getWalls().setView3D(false);
chart.getAxes().setVisible(false);
chart.getLegend().setCurrentPage(true);
chart.getAspect().setView3D(false);
horizBar = new HorizBar(chart.getChart());
for (int i = 1; i < 100; i++) {
horizBar.add(i);
}
southJP.setPreferredSize(new Dimension(100, 200));
southJP.setBackground(Color.BLUE);
baseChartJP.setLayout(new BorderLayout());
baseChartJP.setPreferredSize(new Dimension(100, 2000));
baseChartJP.add(chart, BorderLayout.CENTER);
jScrollPane.setViewportView(baseChartJP);
jFrame.setSize(new Dimension(600, 600));
jFrame.setLayout(new BorderLayout());
jFrame.add(jScrollPane, BorderLayout.CENTER);
jFrame.add(southJP, BorderLayout.SOUTH);
jFrame.setVisible(true);
}
public static void main(String[] args) {
new Teste().initChart();
}
}