我在Redhat 6.5中遇到i
的问题。我的图表从上到下翻转。
这是我添加图表的源代码。
JFreeChart
执行jar:
private Control createPartControl() {
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
ScrolledComposite sc = new ScrolledComposite(m_parent, SWT.H_SCROLL | SWT.V_SCROLL);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
sc.setLayoutData(layoutData);
sc.setMinSize(450, 250);
m_mainComposite = new Composite(sc, SWT.EMBEDDED);
m_mainComposite.setLayoutData(layoutData);
m_mainComposite.setBackground(ColorConstants.white);
Frame frame = SWT_AWT.new_Frame(m_mainComposite);
frame.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
m_panel.setMaximumDrawHeight(e.getComponent().getHeight());
m_panel.setMaximumDrawWidth(e.getComponent().getWidth());
m_panel.setMinimumDrawWidth(e.getComponent().getWidth());
m_panel.setMinimumDrawHeight(e.getComponent().getHeight());
}
});
m_panel = new ChartPanel(null);
m_panel.setPopupMenu(null);
frame.add(m_panel);
frame.setBackground(Color.white);
sc.setContent(m_mainComposite);
return sc;
}
public void updateContent(List<AggregatedSdcCollectionStat> stats) {
if (!isChartExsited()) {
m_chart = createChart(createDataset(stats));
m_panel.setChart(m_chart);
setChartExisted(true);
//m_panel.setVisible(true);
}
}
private JFreeChart createChart(CategoryDataset categorydataset) {
String collectionTime = Messages.getString("SdcCollectionStatisticViewItem.chart.xAxis");//$NON-NLS-1$
String nes = Messages.getString("SdcCollectionStatisticViewItem.chart.yAxis");//$NON-NLS-1$
JFreeChart jfreechart = ChartFactory
.createStackedBarChart(null, collectionTime, nes, categorydataset, PlotOrientation.VERTICAL, true, true, false);
CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
categoryplot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer();
stackedbarrenderer.setDrawBarOutline(false);
stackedbarrenderer.setBaseItemLabelsVisible(true);
stackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
CategoryItemRenderer renderer = categoryplot.getRenderer();
renderer.setSeriesPaint(0, SUCCESS_CLR);
renderer.setSeriesPaint(1, ONGOING_CLR);
renderer.setSeriesPaint(2, MISSING_CLR);
renderer.setSeriesPaint(3, EXCLUDED_CLR);
renderer.setBaseItemLabelsVisible(Boolean.FALSE);
return jfreechart;
}
控制台输出:
线程“main”中的异常
java.lang.NoClassDefFoundError:org / jfree / ui / ApplicationFrame引起:
java.lang.ClassNotFoundException:org.jfree.ui.ApplicationFrame在 java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)在 java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)在 java中的java.security.AccessController.doPrivileged(Native方法) java.net.URLClassLoader.findClass(URLClassLoader.java:354)在
java.lang.ClassLoader.loadClass(ClassLoader.java:423)
这只发生在Redhat上;它在Windows和Ubuntu上运行良好。 你看到这个问题了吗?你能给我一个解决这个案子的方法吗?