use of org.jfree.chart.ChartPanel in project adempiere by adempiere.
the class VChart method createChart.
public void createChart() {
JFreeChart chart = chartModel.createChart();
if (chartPanel != null)
remove(chartPanel);
chartPanel = new ChartPanel(chart);
Dimension size = getSize();
size.height = chartModel.getWinHeight();
chartPanel.setPreferredSize(size);
chartPanel.addChartMouseListener(this);
add(chartPanel, BorderLayout.CENTER);
this.setMinimumSize(size);
}
use of org.jfree.chart.ChartPanel in project adempiere by adempiere.
the class VCRP method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
Timestamp date = null;
if (dateFrom.getValue() != null)
date = (Timestamp) dateFrom.getValue();
int S_Resource_ID = 0;
if (resource.getValue() != null)
S_Resource_ID = ((Integer) resource.getValue()).intValue();
if (date != null && S_Resource_ID != 0) {
MResource r = MResource.get(Env.getCtx(), S_Resource_ID);
int uom_id = r.getResourceType().getC_UOM_ID();
MUOM uom = MUOM.get(Env.getCtx(), uom_id);
CategoryDataset dataset = null;
if (uom.isHour()) {
dataset = createDataset(date, r);
} else {
dataset = createWeightDataset(date, r);
}
String title = r.getName() != null ? r.getName() : "";
title = title + " " + r.getDescription() != null ? r.getDescription() : "";
JFreeChart jfreechart = createChart(dataset, title, uom);
centerPanel.removeAll();
chartPanel = new ChartPanel(jfreechart, false);
centerPanel.add(chartPanel, BorderLayout.CENTER);
centerPanel.setVisible(true);
m_frame.pack();
}
}
if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) {
dispose();
}
}
use of org.jfree.chart.ChartPanel in project adempiere by adempiere.
the class VCRPDetail method handleActionEvent.
private void handleActionEvent(ActionEvent e) {
Timestamp df = getDateFrom();
Timestamp dt = getDateTo();
MResource r = getResource(resource.getValue());
if (df != null && dt != null && r != null) {
model = CRPDatasetFactory.get(df, dt, r);
JFreeChart jfreechart = createChart(model.getDataset(), getChartTitle(), getSourceUOM(resource.getValue()));
chartPanel = new ChartPanel(jfreechart, false);
contentPanel.setLeftComponent(chartPanel);
JTree tree = model.getTree();
tree.addMouseListener(new TreeHandler());
contentPanel.setRightComponent(new JScrollPane(tree));
popup = createPopup(tree);
contentPanel.setDividerLocation(0.70);
contentPanel.setVisible(true);
contentPanel.validate();
contentPanel.repaint();
}
SwingTool.setCursorsFromParent(m_form.getWindow(), false);
}
use of org.jfree.chart.ChartPanel in project adempiere by adempiere.
the class Graph method loadData.
private void loadData() {
list = builder.loadData();
JFreeChart chart = builder.createChart(builder.getMGoal().getChartType());
if (chartPanel != null)
remove(chartPanel);
chartPanel = new ChartPanel(chart);
chartPanel.setSize(getSize());
chartPanel.addChartMouseListener(this);
add(chartPanel, BorderLayout.CENTER);
if (m_userSelection) {
int AD_Reference_Value_ID = DB.getSQLValue(null, "SELECT AD_Reference_ID FROM AD_Reference WHERE Name = ?", "PA_Goal ChartType");
MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), AD_Reference_Value_ID);
MLookup mLookup = new MLookup(info, 0);
VLookup lookup = new VLookup("ChartType", false, false, true, mLookup);
lookup.addVetoableChangeListener(new VetoableChangeListener() {
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
Object value = evt.getNewValue();
if (value == null)
return;
JFreeChart chart = null;
chart = builder.createChart(value.toString());
if (chart != null) {
if (chartPanel != null)
remove(chartPanel);
chartPanel = new ChartPanel(chart);
chartPanel.setSize(getSize());
chartPanel.addChartMouseListener(Graph.this);
add(chartPanel, BorderLayout.CENTER);
getParent().validate();
}
}
});
add(lookup, BorderLayout.NORTH);
}
this.setMinimumSize(paneldimension);
}
use of org.jfree.chart.ChartPanel in project BachelorPraktikum by lucasbuschlinger.
the class Plotter method viewPlot.
/**
* Views the plot with the plotted data.
*/
public void viewPlot() {
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
setContentPane(chartPanel);
this.pack();
RefineryUtilities.centerFrameOnScreen(this);
this.setVisible(true);
}
Aggregations