List of usage examples for org.jfree.chart ChartPanel setMinimumDrawHeight
public void setMinimumDrawHeight(int height)
From source file:uk.ac.lkl.cram.ui.ModuleFrame.java
private JXTaskPane createLearningExperienceChartPane() { JXTaskPane experienceChartPane = new JXTaskPane(); experienceChartPane.setScrollOnExpand(true); experienceChartPane.setTitle("Learning Experiences"); final LearningExperienceChartMaker maker = new LearningExperienceChartMaker(module); final ChartPanel chartPanel = maker.getChartPanel(); //Add a mouselistener, listening for a double click on a bar of the stacked bar chartPanel.addChartMouseListener(new ChartMouseListener() { @Override/*w w w . jav a 2s .c o 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) { //Get the selected segment of the pie CategoryItemEntity bar = (CategoryItemEntity) cme.getEntity(); //Get the row key that corresponds to that segment--this is a learning experience String key = bar.getRowKey().toString(); //Get the set of tlalineitems whose activity contains that learning type Set<TLALineItem> relevantTLAs = maker.getLearningExperienceMap().get(key); //Create a pop up dialog containing that set of tlalineitems LearningExperiencePopupDialog popup = new LearningExperiencePopupDialog( (Frame) SwingUtilities.getWindowAncestor(chartPanel), true, relevantTLAs); //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 CategoryItemEntity) { chartPanel.setCursor(HAND); } else { chartPanel.setCursor(Cursor.getDefaultCursor()); } } }); chartPanel.setPreferredSize(new Dimension(125, 75)); chartPanel.setMinimumDrawHeight(75); experienceChartPane.add(chartPanel); return experienceChartPane; }