List of usage examples for org.jfree.chart.entity PieSectionEntity getSectionKey
public Comparable getSectionKey()
From source file:org.openfaces.component.chart.impl.helpers.ChartInfoUtil.java
public static PieSectorInfo getPieSectorInfo(ChartEntity entity) { if (entity instanceof PieSectionEntity) { PieSectionEntity pieEntity = (PieSectionEntity) entity; return getPieSectorInfo(pieEntity.getDataset(), pieEntity.getSectionKey(), pieEntity.getPieIndex()); }/*www. ja v a2 s .c o m*/ return null; }
From source file:net.sf.jasperreports.charts.util.PieChartHyperlinkProvider.java
@Override public JRPrintHyperlink getEntityHyperlink(ChartEntity entity) { JRPrintHyperlink printHyperlink = null; if (hasHyperlinks() && entity instanceof PieSectionEntity) { PieSectionEntity pieEntity = (PieSectionEntity) entity; printHyperlink = sectionHyperlinks.get(pieEntity.getSectionKey()); }/*from w w w.j a v a 2s. c o m*/ return printHyperlink; }
From source file:probe.com.view.body.quantcompare.PieChart.java
@Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { int x = event.getRelativeX(); int y = event.getRelativeY(); ChartEntity entity = chartRenderingInfo.getEntityCollection().getEntity(x, y); if (entity instanceof PieSectionEntity) { PieSectionEntity pieEnt = (PieSectionEntity) entity; updatePopupAndShow(pieEnt.getSectionKey().toString()); }/*w ww .jav a 2s .c om*/ }
From source file:org.pentaho.platform.uifoundation.chart.CategoryDatasetChartComponent.java
private void populatePieSectionEntity(PieSectionEntity pieSectionEntity) { String value = pieSectionEntity.getSectionKey().toString(); if (paramName == null) { pieSectionEntity.setURLText(value); } else {/*from w w w. j a v a2 s . c o m*/ try { String encodedVal = URLEncoder.encode(value, LocaleHelper.getSystemEncoding()); String drillURL = TemplateUtil.applyTemplate(urlTemplate, paramName, encodedVal); pieSectionEntity.setURLText(drillURL); } catch (UnsupportedEncodingException ignored) { this.getLogger().debug(ignored); } } }
From source file:org.pentaho.platform.uifoundation.chart.PieDatasetChartComponent.java
private void populateInfo(final ChartRenderingInfo info) { ArrayList keyListArray = null; int keyListIndex = 0; Iterator iter = info.getEntityCollection().iterator(); while (iter.hasNext()) { ChartEntity entity = (ChartEntity) iter.next(); if (entity instanceof PieSectionEntity) { PieSectionEntity pieSectionEntity = (PieSectionEntity) entity; String value = pieSectionEntity.getSectionKey().toString(); if (paramName == null) { pieSectionEntity.setURLText(value); } else { try { String encodedVal = URLEncoder.encode(value, LocaleHelper.getSystemEncoding()); String drillURL = TemplateUtil.applyTemplate(urlTemplate, paramName, encodedVal); pieSectionEntity.setURLText(drillURL); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); }// w ww . j a v a2 s. c o m } } else if (entity instanceof CategoryItemEntity) { CategoryItemEntity categoryItemEntity = (CategoryItemEntity) entity; if (keyListArray == null) { keyListArray = new ArrayList(categoryItemEntity.getDataset().getRowKeys()); } String category = categoryItemEntity.getCategory().toString(); if (paramName == null) { categoryItemEntity.setURLText(category); } else { try { String encodedVal = URLEncoder.encode(category, LocaleHelper.getSystemEncoding()); String drillURL = TemplateUtil.applyTemplate(urlTemplate, paramName, encodedVal); if (keyListIndex >= keyListArray.size()) { keyListIndex = 0; } encodedVal = URLEncoder.encode(keyListArray.get(keyListIndex).toString(), LocaleHelper.getSystemEncoding()); keyListIndex++; drillURL = TemplateUtil.applyTemplate(drillURL, paramName2, encodedVal); categoryItemEntity.setURLText(drillURL); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }
From source file:de.laures.cewolf.taglib.tags.ChartMapTag.java
private String generateLink(Dataset dataset, ChartEntity ce) { String link = null;/* ww w .j av a 2 s . c om*/ if (useJFreeChartLinkGenerator) { link = ce.getURLText(); } else if (linkGenerator instanceof CategoryItemLinkGenerator || linkGenerator instanceof XYItemLinkGenerator || linkGenerator instanceof PieSectionLinkGenerator) { if (linkGenerator instanceof CategoryItemLinkGenerator) { if (ce instanceof CategoryItemEntity) { CategoryItemEntity catEnt = (CategoryItemEntity) ce; link = ((CategoryItemLinkGenerator) linkGenerator).generateLink(dataset, catEnt.getSeries(), catEnt.getCategory()); } } if (linkGenerator instanceof XYItemLinkGenerator) { if (ce instanceof XYItemEntity) { XYItemEntity xyEnt = (XYItemEntity) ce; link = ((XYItemLinkGenerator) linkGenerator).generateLink(dataset, xyEnt.getSeriesIndex(), xyEnt.getItem()); } else { // Note; there is a simple ChartEntity also passed since Jfreechart 1.0rc1, that is ignored LOG.debug("Link entity skipped, not XYItemEntity.class:" + ce); } } if (linkGenerator instanceof PieSectionLinkGenerator) { if (ce instanceof PieSectionEntity) { PieSectionEntity pieEnt = (PieSectionEntity) ce; link = ((PieSectionLinkGenerator) linkGenerator).generateLink(dataset, pieEnt.getSectionKey()); } } } return link; }
From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.interactivepiechartfilters.JfreeDivaPieChartFilter.java
@Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { ChartEntity entity = chartRenderingInfo.getEntityCollection().getEntity(event.getRelativeX(), event.getRelativeY());/*w w w . j ava 2 s .c o m*/ if (entity != null && entity instanceof PieSectionEntity) { PieSectionEntity pieEnt = (PieSectionEntity) entity; selectSlice(pieEnt.getSectionKey().toString()); } }
From source file:com.igalia.java.zk.components.JFreeChartEngine.java
/** * decode PieSectionEntity into key-value pair of Area's componentScope. *///w ww. ja v a 2s . c o m private void decodePieSectionInfo(Area area, PieSectionEntity info) { PieDataset dataset = info.getDataset(); Comparable category = info.getSectionKey(); area.setAttribute("value", dataset.getValue(category)); area.setAttribute("category", category); }
From source file:org.bhavaya.ui.view.ChartView.java
public Object[] getBeansForEntity(ChartEntity entity) { int series = 0; Object category = null;/* w ww . j a v a 2 s . c o m*/ if (entity instanceof CategoryItemEntity) { CategoryItemEntity itemEntity = (CategoryItemEntity) entity; category = itemEntity.getCategory(); series = itemEntity.getSeries(); } else if (entity instanceof PieSectionEntity) { PieSectionEntity sectionEntity = (PieSectionEntity) entity; category = sectionEntity.getSectionKey(); series = 0; } if (category != null) { return tableModelDataSet.getBeansForLocation(series, category); } else { return EMPTY_OBJECT_ARRAY; } }
From source file:uk.ac.lkl.cram.ui.ModuleFrame.java
private JXTaskPane createLearningTypeChartPane() { JXTaskPane typeChartPane = new JXTaskPane(); typeChartPane.setTitle("Learning Types"); typeChartPane.setScrollOnExpand(true); final LearningTypeChartMaker maker = new LearningTypeChartMaker(module); final ChartPanel chartPanel = maker.getChartPanel(); //Add a mouse listener to the chart chartPanel.addChartMouseListener(new ChartMouseListener() { @Override/*from w ww. ja v a 2 s .co m*/ public void chartMouseClicked(ChartMouseEvent cme) { //Get the mouse event MouseEvent trigger = cme.getTrigger(); //Test if the mouse event is a left-button if (trigger.getButton() == MouseEvent.BUTTON1 && trigger.getClickCount() == 2) { //Check that the mouse click is on a segment of the pie if (cme.getEntity() instanceof PieSectionEntity) { //Get the selected segment of the pie PieSectionEntity pieSection = (PieSectionEntity) cme.getEntity(); //Get the key that corresponds to that segment--this is a learning type String key = pieSection.getSectionKey().toString(); //Get the set of tlalineitems whose activity contains that learning type Set<TLALineItem> relevantTLAs = maker.getLearningTypeMap().get(key); //Create a pop up dialog containing that set of tlalineitems LearningTypePopupDialog popup = new LearningTypePopupDialog( (Frame) SwingUtilities.getWindowAncestor(chartPanel), true, relevantTLAs, key); //Set the title of the popup to indicate which learning type was selected popup.setTitle("Activities with \'" + key + "\'"); //Centre the popup at the location of the mouse click Point location = trigger.getLocationOnScreen(); int w = popup.getWidth(); int h = popup.getHeight(); popup.setLocation(location.x - w / 2, location.y - h / 2); popup.setVisible(true); int returnStatus = popup.getReturnStatus(); if (returnStatus == LearningTypePopupDialog.RET_OK) { modifyTLALineItem(popup.getSelectedTLALineItem(), 0); } } } } @Override public void chartMouseMoved(ChartMouseEvent cme) { //Set the cursor shape according to the location of the cursor if (cme.getEntity() instanceof PieSectionEntity) { chartPanel.setCursor(HAND); } else { chartPanel.setCursor(Cursor.getDefaultCursor()); } } }); chartPanel.setPreferredSize(new Dimension(150, 200)); typeChartPane.add(chartPanel); return typeChartPane; }