当前位置: 首页>>代码示例>>Java>>正文


Java ChartMouseEvent类代码示例

本文整理汇总了Java中org.jfree.chart.ChartMouseEvent的典型用法代码示例。如果您正苦于以下问题:Java ChartMouseEvent类的具体用法?Java ChartMouseEvent怎么用?Java ChartMouseEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChartMouseEvent类属于org.jfree.chart包,在下文中一共展示了ChartMouseEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mouseClickedInChart

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
/**
 * Handles mouse clicks in the chart panel.
 *
 * @param event the chart mouse event
 */
private void mouseClickedInChart(ChartMouseEvent event) {

    ArrayList<ChartEntity> entities = getEntitiesForPoint(event.getTrigger().getPoint().x, event.getTrigger().getPoint().y);

    if (entities.isEmpty()) {
        return;
    }

    boolean dataPointFound = false;
    String dataPointTooltip = "";

    for (ChartEntity tempEntity : entities) {
        if (tempEntity instanceof XYAnnotationEntity) {
            if (((XYAnnotationEntity) tempEntity).getToolTipText() != null) {
                dataPointFound = true;
                dataPointTooltip = ((XYAnnotationEntity) tempEntity).getToolTipText();
            }
        }
    }

    if (dataPointFound) {
        String dataset = tooltipToDatasetMap.get(dataPointTooltip);
        JOptionPane.showMessageDialog(this, dataPointTooltip + ":\n" + vennDiagramResults.get(dataset), "Selected Values", JOptionPane.INFORMATION_MESSAGE);
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:31,代码来源:VennDiagramPanel.java

示例2: mouseMovedInChart

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
/**
 * Handles mouse movements in the chart panel.
 *
 * @param event the chart mouse event
 */
private void mouseMovedInChart(ChartMouseEvent event) {

    ArrayList<ChartEntity> entities = getEntitiesForPoint(event.getTrigger().getPoint().x, event.getTrigger().getPoint().y);

    boolean dataPointFound = false;

    for (ChartEntity tempEntity : entities) {
        if (tempEntity instanceof XYAnnotationEntity) {
            if (((XYAnnotationEntity) tempEntity).getToolTipText() != null) {
                dataPointFound = true;
            }
        }
    }

    if (dataPointFound) {
        chartPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    } else {
        chartPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:26,代码来源:VennDiagramPanel.java

示例3: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseClicked(ChartMouseEvent event)
{
	if ((event.getEntity()!=null) && (event.getTrigger().getClickCount() > 1))
	{
		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
		try
		{
			GraphColumn bgc = getGraphColumn(event);
			if (bgc == null)
			{
				return;
			}

			MQuery query = bgc.getMQuery(builder.getMGoal());
			if (query != null)
				AEnv.zoom(query);
			else
				log.warn("Nothing to zoom to - " + bgc);
		}
		finally
		{
			setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:27,代码来源:Graph.java

示例4: chartMouseMoved

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
/**
 * Callback method for receiving notification of a mouse movement on a
 * chart.
 *
 * @param event information about the event.
 */
public void chartMouseMoved(ChartMouseEvent event)
{
    if (!(event.getChart().getXYPlot().getRenderer() instanceof MotionBubbleRenderer))
    {
        return;
    }

    MotionBubbleRenderer renderer = (MotionBubbleRenderer) event.getChart().getXYPlot().getRenderer();

    if (!(event.getEntity() instanceof XYItemEntity))
    {
        renderer.setHighlightedItem(-1, -1);
        return;
    }

    XYItemEntity item = (XYItemEntity) event.getEntity();
    renderer.setHighlightedItem(item.getSeriesIndex(), item.getItem());
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:25,代码来源:MotionMouseListener.java

示例5: chartMouseMoved

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseMoved(ChartMouseEvent e) {
    disableToolTip();
    
    if (isPointWithinChartArea(e.getTrigger().getX(), e.getTrigger().getY())) {
        chart.getXYPlot().setDomainCrosshairVisible(true);
        double vx = valueFromPosition(e);
        chart.getXYPlot().setDomainCrosshairValue(vx);
        scheduleTooltipDisplay(vx);
    }
    else {
        chart.getXYPlot().setDomainCrosshairVisible(false);
        synchronized(this) {
            if (tooltipTimerTask != null) {
                tooltipTimerTask.cancel();
            }
        }
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:20,代码来源:GraphPanel.java

示例6: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseClicked( final ChartMouseEvent e )
{
	// left mouse click
	if ( e.getTrigger().getButton() == MouseEvent.BUTTON1 && enableReferenceTimePoint )
	{
		referenceTimePoint = getChartXLocation( e.getTrigger().getPoint(), panel );
		
		valueMarker.setValue( referenceTimePoint );
		valueMarker.setLabel( " Reference\n Timepoint " + referenceTimePoint );
		
		if ( !markerShown )
		{
			((XYPlot) e.getChart().getPlot()).addDomainMarker( valueMarker );
			markerShown = true;
		}
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:19,代码来源:MouseListenerTimelapse.java

示例7: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseClicked(ChartMouseEvent event) {
    if (event.getEntity().getClass() == CategoryItemEntity.class) {
        if ((getChart() != null) && (getChart().getClass() == HighlightableBarChart.class)) {
            HighlightableBarChart chart = (HighlightableBarChart) getChart();
            CategoryItemEntity entity = (CategoryItemEntity) event.getEntity();

            // toggle highlight if already selected
            if (chart.isHighlighted(entity)) {
                chart.clearHighlights();

                firePropertyChange("highlightedBar", getRowAndColumn(entity), null);
            }
            else {
                chart.clearHighlights();
                chart.highlightEntity(entity);

                firePropertyChange("highlightedBar", null, getRowAndColumn(entity));
            }

            // assume whatever fired the event will repaint the chart
        }
    }
}
 
开发者ID:nmonvisualizer,项目名称:nmonvisualizer,代码行数:25,代码来源:BarChartPanel.java

示例8: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
public void chartMouseClicked(ChartMouseEvent e) {    	    	                
	
	if(e.getEntity() != null){
		for(Area shape : areas){    		
			//if(shape.contains(e.getTrigger().getPoint())){
			if(shape.equals(e.getEntity().getArea())){

				if(!e.getTrigger().isControlDown()){
					selected.clear();
				}
				if(selected.contains(shape)){
					selected.remove(shape);
				} else {
					selected.add(shape);
				}
			}    	
		}
	} else {    		
		selected.clear();
	}
	    	
	setSelectedForList(true);
}
 
开发者ID:chipster,项目名称:chipster,代码行数:24,代码来源:VenndiPlot.java

示例9: mouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
/**
 * Receives notification of mouse clicks on the panel. These are translated and passed on to any
 * registered {@link ChartMouseListener}s.
 * 
 * @param event
 *            Information about the mouse event.
 */

@Override
public void mouseClicked(MouseEvent event) {

	Insets insets = getInsets();
	int x = (int) ((event.getX() - insets.left) / this.scaleX);
	int y = (int) ((event.getY() - insets.top) / this.scaleY);

	this.anchor = new Point2D.Double(x, y);
	if (this.chart == null) {
		return;
	}
	this.chart.setNotify(true); // force a redraw
	// new entity code...
	Object[] listeners = this.chartMouseListeners.getListeners(ChartMouseListener.class);
	if (listeners.length == 0) {
		return;
	}

	ChartEntity entity = null;
	if (this.info != null) {
		EntityCollection entities = this.info.getEntityCollection();
		if (entities != null) {
			entity = entities.getEntity(x, y);
		}
	}
	ChartMouseEvent chartEvent = new ChartMouseEvent(getChart(), event, entity);
	for (int i = listeners.length - 1; i >= 0; i -= 1) {
		((ChartMouseListener) listeners[i]).chartMouseClicked(chartEvent);
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:40,代码来源:AbstractChartPanel.java

示例10: mouseMoved

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
/**
 * Implementation of the MouseMotionListener's method.
 * 
 * @param e
 *            the event.
 */

@Override
public void mouseMoved(MouseEvent e) {
	Graphics2D g2 = (Graphics2D) getGraphics();
	if (this.horizontalAxisTrace) {
		drawHorizontalAxisTrace(g2, e.getX());
	}
	if (this.verticalAxisTrace) {
		drawVerticalAxisTrace(g2, e.getY());
	}
	g2.dispose();

	Object[] listeners = this.chartMouseListeners.getListeners(ChartMouseListener.class);
	if (listeners.length == 0) {
		return;
	}
	Insets insets = getInsets();
	int x = (int) ((e.getX() - insets.left) / this.scaleX);
	int y = (int) ((e.getY() - insets.top) / this.scaleY);

	ChartEntity entity = null;
	if (this.info != null) {
		EntityCollection entities = this.info.getEntityCollection();
		if (entities != null) {
			entity = entities.getEntity(x, y);
		}
	}

	// we can only generate events if the panel's chart is not null
	// (see bug report 1556951)
	if (this.chart != null) {
		ChartMouseEvent event = new ChartMouseEvent(getChart(), e, entity);
		for (int i = listeners.length - 1; i >= 0; i -= 1) {
			((ChartMouseListener) listeners[i]).chartMouseMoved(event);
		}
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:45,代码来源:AbstractChartPanel.java

示例11: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseClicked(final ChartMouseEvent cme) {
	if (cme.getTrigger().getClickCount() % 2 == 0) {
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				if (cache.isEmpty()) {
					return;
				}
				jNextChart.getXYPlot().setDomainCrosshairVisible(true);
				double xValue = jNextChart.getXYPlot().getDomainCrosshairValue();
				double yValue = jNextChart.getXYPlot().getRangeCrosshairValue();
				RectangleEdge xEdge = jNextChart.getXYPlot().getDomainAxisEdge();
				RectangleEdge yEdge = jNextChart.getXYPlot().getRangeAxisEdge();
				Rectangle2D dataArea = jChartPanel.getScreenDataArea(); // jChartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(0).getDataArea();
				int x = (int) jNextChart.getXYPlot().getDomainAxis().valueToJava2D(xValue, dataArea, xEdge);
				int y = (int) jNextChart.getXYPlot().getRangeAxis().valueToJava2D(yValue, dataArea, yEdge);
				Date date = new Date((long)xValue);
				jIskValue.setText(iskFormat.format(yValue));
				jDateValue.setText(dateFormat.format(date));
				TrackerNote trackerNote = Settings.get().getTrackerNotes().get(new TrackerDate(date));
				if (trackerNote != null) {
					jAddNote.setVisible(false);
					jEditNote.setVisible(true);
					jNote.setVisible(true);
					jNote.setText(trackerNote.getNote());
				} else {
					jAddNote.setVisible(true);
					jEditNote.setVisible(false);
					jNote.setVisible(false);
				}
				jPopupMenu.show((Component)cme.getTrigger().getSource(), x, y);
			}
		});
	}
}
 
开发者ID:GoldenGnu,项目名称:jeveassets,代码行数:37,代码来源:TrackerTab.java

示例12: getGraphColumn

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
/**
 * Get BarGraphColumn for ChartEntity
 * @param event
 * @return BarGraphColumn or null if not found
 */
private GraphColumn getGraphColumn(ChartMouseEvent event)
{
	ChartEntity entity = event.getEntity();
	String key = null;
	if (entity instanceof CategoryItemEntity)
	{
		Comparable<?> colKey = ((CategoryItemEntity)entity).getColumnKey();
		if (colKey != null)
		{
			key = colKey.toString();
		}
	}
	else if (entity instanceof PieSectionEntity)
	{
		Comparable<?> sectionKey = ((PieSectionEntity)entity).getSectionKey();
		if (sectionKey != null)
		{
			key = sectionKey.toString();
		}
	}
	if (key == null)
	{
		return null;
	}
	for (int i = 0; i < list.size(); i++)
	{
		final String label = list.get(i).getLabel();
		if (key.equals(label))
		{
			return list.get(i);
		}
	}
	//
	return null;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:41,代码来源:Graph.java

示例13: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
public void chartMouseClicked(ChartMouseEvent event)
{
	JFreeChart chart = event.getChart();
					
	for(int x = 1; x < VisualFirewall.NUMVIEWS; ++x)
	{
		if( parent.views[x].chart != null && 
		    ( chart == parent.views[x].chart ||
		      chart.equals( parent.views[x].chart) ) )
		{
			mouseClicked(new MouseEvent(parent.views[x].getCanvas(), 0,0,0,0,0,0, false));
			break;
		}
	} // end for()
}
 
开发者ID:chrislee35,项目名称:visualfirewall,代码行数:16,代码来源:VFW_MouseListener.java

示例14: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseClicked( final ChartMouseEvent e )
{
	// left mouse click
	if ( e.getTrigger().getButton() == MouseEvent.BUTTON1 )
	{
		final double value = getChartXLocation( e.getTrigger().getPoint(), panel );

		valueMarker.setValue( value );
		valueMarker.setLabel(  " Distance=" + value );
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:13,代码来源:MouseListenerValue.java

示例15: chartMouseClicked

import org.jfree.chart.ChartMouseEvent; //导入依赖的package包/类
@Override
public void chartMouseClicked( final ChartMouseEvent e )
{
	// left mouse click
	if ( e.getTrigger().getButton() == MouseEvent.BUTTON1 && enableReferenceTimePoint )
	{
		final int referenceTimePoint = getChartXLocation( e.getTrigger().getPoint(), panel );

		if ( timepoints != null )
		{
			if ( setReferenceTimepoint( timepoints, referenceTimePoint ) )
				this.referenceTimePoint = referenceTimePoint;
		}
		else
		{
			this.referenceTimePoint = referenceTimePoint;
		}

		valueMarker.setValue( this.referenceTimePoint );
		valueMarker.setLabel( " Reference\n Timepoint " + this.referenceTimePoint );
		
		if ( !markerShown )
		{
			((XYPlot) e.getChart().getPlot()).addDomainMarker( valueMarker );
			markerShown = true;
		}
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:29,代码来源:MouseListenerTimelapse.java


注:本文中的org.jfree.chart.ChartMouseEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。