use of org.jfree.chart.JFreeChart in project adempiere by adempiere.
the class GraphBuilder method createAreaChart.
private JFreeChart createAreaChart() {
// create the chart...
JFreeChart chart = ChartFactory.createAreaChart(// chart title
m_goal.getMeasure().getName(), // domain axis label
m_X_AxisLabel, // range axis label
m_Y_AxisLabel, // data
dataset, // orientation
PlotOrientation.VERTICAL, // include legend
false, // tooltips?
true, // URLs?
true);
setupCategoryChart(chart);
return chart;
}
use of org.jfree.chart.JFreeChart in project adempiere by adempiere.
the class GraphBuilder method createLineChart.
private JFreeChart createLineChart() {
// create the chart...
JFreeChart chart = ChartFactory.createLineChart3D(// chart title
m_goal.getMeasure().getName(), // domain axis label
m_X_AxisLabel, // range axis label
m_Y_AxisLabel, // data
linearDataset, // orientation
PlotOrientation.VERTICAL, // include legend
false, // tooltips?
true, // URLs?
true);
setupCategoryChart(chart);
return chart;
}
use of org.jfree.chart.JFreeChart in project adempiere by adempiere.
the class WCRP method onEvent.
@Override
public void onEvent(Event event) throws Exception {
String cmd = event.getTarget().getId();
if (cmd.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);
renderChart(jfreechart);
}
}
if (cmd.equals(ConfirmPanel.A_CANCEL)) {
dispose();
}
}
use of org.jfree.chart.JFreeChart in project adempiere by adempiere.
the class WGraph method loadData.
private void loadData() {
list = builder.loadData();
if (m_renderChart && m_chartSelection) {
Toolbar toolbar = new Toolbar();
panel.appendChild(toolbar);
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);
WTableDirEditor editor = new WTableDirEditor("ChartType", false, false, true, mLookup);
toolbar.appendChild(editor.getComponent());
editor.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent evt) {
Object value = evt.getNewValue();
if (value == null || value.toString().trim().length() == 0)
return;
JFreeChart chart = null;
chart = builder.createChart(value.toString());
if (chart != null)
render(chart);
}
});
}
}
use of org.jfree.chart.JFreeChart in project adempiere by adempiere.
the class WPerformanceIndicator method init.
/**
* Init Graph Display
* Kinamo (pelgrim)
*/
private void init() {
JFreeChart chart = createChart();
chart.setBackgroundPaint(null);
chart.setBorderVisible(true);
chart.setBorderPaint(Color.LIGHT_GRAY);
chart.setAntiAlias(true);
BufferedImage bi = chart.createBufferedImage(200, 120, BufferedImage.TRANSLUCENT, null);
try {
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
AImage image = new AImage("", bytes);
Image myImage = new Image();
myImage.setContent(image);
appendChild(myImage);
} catch (Exception e) {
// TODO: handle exception
}
invalidate();
}
Aggregations