public static PieChartJson productPieChart(String diagName, Map<String, DiagCountDTO> values) { PieChart chart = new PieChart(); chart.setCaption(diagName); chart.setFormatnumberscale("0"); chart.setUnescapeLinks("0"); List<Data> data = new ArrayList<Data>(); Iterator<String> it = values.keySet().iterator(); while (it.hasNext()) { String key = it.next(); String dName = key.substring(0, key.lastIndexOf("-")); String dValue = key.substring(key.lastIndexOf("-") + 1); String value = Integer.toString(values.get(key).getCount()); key = key.endsWith("1") ? key.substring(0, key.lastIndexOf("1") - 1) : key; data.add( new PieData( key, value, "javascript:showPatientTable('" + DiagMap.getKey(dName) + "','" + DiagMap.getKey(dValue) + "')")); } PieChartJson chartJson = new PieChartJson(); chartJson.setData(data); chartJson.setChart(chart); return chartJson; }
private static Boolean PieChartTester(DataSet m_testData) { int A1 = 1; // Record number int A2 = 2; // Month String header = "Pie Chart Test"; PieChart pieChart = new PieChart(); JFreeChart chart = pieChart.MakeChart(m_testData, A1, A2, header); ChartPanel panel = new ChartPanel(chart); CreateFrame(panel, "PieChartTester"); return true; }
public void BondInterestButtonClicked() { this.model.setColumnCount(0); this.model.getDataVector().removeAllElements(); this.model.fireTableDataChanged(); this.model.addColumn("Imie"); this.model.addColumn("Nazwisko"); this.model.addColumn("Czas trwania"); this.model.addColumn("Oprocentowanie"); this.model.addColumn("Pesel"); this.model.addColumn("Nazwa firmy"); this.model.addColumn("NIP"); this.model.addColumn("Wartosc"); this.model.addColumn("Data"); for (int idx = 0; idx < this.bondInterests.size(); ++idx) { String forename = this.bondInterests.get(idx).getForename(); String surname = this.bondInterests.get(idx).getSurname(); int durationDays = this.bondInterests.get(idx).getDurationDays(); double interest = this.bondInterests.get(idx).getInterest(); String pesel = this.bondInterests.get(idx).getPesel(); String firmName = this.bondInterests.get(idx).getFirmName(); String NIP = this.bondInterests.get(idx).getNIP(); int costValue = this.bondInterests.get(idx).getCostValue(); String date = this.bondInterests.get(idx).getDate(); model.addRow( new Object[] { forename, surname, durationDays, interest, pesel, firmName, NIP, costValue, date }); } this.table.repaint(); PieChart pieChart = new PieChart(); pieChart.setBondInterests(this.bondInterests); pieChart.setInvestmentInterests(this.investmentInterests); pieChart.drawInterests(); JFrame frame = new JFrame(); frame.setTitle("PieChart"); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frame.add(pieChart); frame.setPreferredSize(new Dimension(300, 300)); frame.setSize(new Dimension(300, 300)); frame.setVisible(true); }