use of com.ramussoft.chart.exception.ChartNotSetupedException in project ramus by Vitaliy-Yakovchuk.
the class PieChartDataPlugin method createChart.
@Override
public JFreeChart createChart(Element element, ChartSource source) {
Attribute key = source.getAttributeProperty(PIE_ATTRIBUTE_KEY);
Attribute value = source.getAttributeProperty(PIE_ATTRIBUTE_VALUE);
if ((key == null) || (value == null))
throw new ChartNotSetupedException();
DefaultPieDataset dataset = new DefaultPieDataset();
for (Element element2 : source.getElements()) {
Object v1 = engine.getAttribute(element2, key);
Object v2 = engine.getAttribute(element2, value);
if ((v1 != null) && (v2 != null))
dataset.setValue(toString(v1), toDouble(v2));
}
return ChartFactory.createPieChart(element.getName(), dataset, true, true, false);
}
use of com.ramussoft.chart.exception.ChartNotSetupedException in project ramus by Vitaliy-Yakovchuk.
the class ChartView method createComponent.
@Override
public JComponent createComponent() {
ChartDataPlugin plugin = chartDataFramework.getChartDataPlugin(chartSource.getChartType());
try {
chartPanel = new ChartPanel(plugin.createChart(element));
chartPanel.setPopupMenu(null);
} catch (ChartNotSetupedException e) {
JOptionPane.showMessageDialog(framework.getMainFrame(), ChartResourceManager.getString("Error.chartNotSetuped"));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
close();
}
});
return new JPanel();
}
return chartPanel;
}
use of com.ramussoft.chart.exception.ChartNotSetupedException in project ramus by Vitaliy-Yakovchuk.
the class ChartView method reload.
protected void reload() {
try {
ChartDataPlugin plugin = chartDataFramework.getChartDataPlugin(chartSource.getChartType());
chartPanel.setChart(plugin.createChart(element));
} catch (ChartNotSetupedException e) {
close();
JOptionPane.showMessageDialog(framework.getMainFrame(), ChartResourceManager.getString("Error.chartNotSetuped"));
}
}
Aggregations