org.jfree.chart.entity.EntityCollection Java Examples
The following examples show how to use
org.jfree.chart.entity.EntityCollection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractCategoryItemRenderer.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Adds an entity with the specified hotspot, but only if an entity * collection is accessible via the renderer state. * * @param entities the entity collection. * @param dataset the dataset. * @param row the row index. * @param column the column index. * @param hotspot the hotspot. */ protected void addItemEntity(EntityCollection entities, CategoryDataset dataset, int row, int column, Shape hotspot) { String tip = null; CategoryToolTipGenerator tipster = getToolTipGenerator(row, column); if (tipster != null) { tip = tipster.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getItemURLGenerator(row, column); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url, dataset, row, dataset.getColumnKey(column), column); entities.add(entity); }
Example #2
Source File: ChartComposite.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ public String getToolTipText(org.eclipse.swt.events.MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Rectangle insets = getClientArea(); ChartEntity entity = entities.getEntity( (int) ((e.x - insets.x) / this.scaleX), (int) ((e.y - insets.y) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
Example #3
Source File: ChartPanel.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ @Override public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
Example #4
Source File: AbstractCategoryItemRenderer.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Adds an entity with the specified hotspot. * * @param entities the entity collection. * @param dataset the dataset. * @param row the row index. * @param column the column index. * @param hotspot the hotspot (<code>null</code> not permitted). */ protected void addItemEntity(EntityCollection entities, CategoryDataset dataset, int row, int column, Shape hotspot) { ParamChecks.nullNotPermitted(hotspot, "hotspot"); if (!getItemCreateEntity(row, column)) { return; } String tip = null; CategoryToolTipGenerator tipster = getToolTipGenerator(row, column); if (tipster != null) { tip = tipster.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getItemURLGenerator(row, column); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #5
Source File: ChartGestureMouseAdapterFX.java From mzmine3 with GNU General Public License v2.0 | 6 votes |
/** * Find chartentities like JFreeChartEntity, AxisEntity, PlotEntity, TitleEntity, XY... * * @param chartPanel * @param x * @param y * @return */ private ChartEntity findChartEntity(MouseEventWrapper e) { // TODO check if insets were needed // coordinates to find chart entities int x = (int) ((e.getX()) / chartViewer.getCanvas().getScaleX()); int y = (int) ((e.getY()) / chartViewer.getCanvas().getScaleY()); if (lastEntity != null && x == lastEntityX && y == lastEntityY) return lastEntity; else { ChartRenderingInfo info = chartViewer.getCanvas().getRenderingInfo(); ChartEntity entity = null; if (info != null) { EntityCollection entities = info.getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } return entity; } }
Example #6
Source File: AbstractChartPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Returns a string for the tooltip. * * @param e * the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ @Override public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity((int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
Example #7
Source File: StandardXYItemRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * A check to ensure that an item that falls outside the plot's data area * does NOT generate an item entity. */ public void testNoDisplayedItem() { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries s1 = new XYSeries("S1"); s1.add(10.0, 10.0); dataset.addSeries(s1); JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(new StandardXYItemRenderer()); NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setRange(0.0, 5.0); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setRange(0.0, 5.0); BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); ChartRenderingInfo info = new ChartRenderingInfo(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, info); g2.dispose(); EntityCollection ec = info.getEntityCollection(); assertFalse(TestUtilities.containsInstanceOf(ec.getEntities(), XYItemEntity.class)); }
Example #8
Source File: TooltipHandlerFX.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Returns the tooltip text. * * @param canvas the canvas that is displaying the chart. * @param x the x-coordinate of the mouse pointer. * @param y the y-coordinate of the mouse pointer. * * @return String The tooltip text (possibly <code>null</code>). */ private String getTooltipText(ChartCanvas canvas, double x, double y) { ChartRenderingInfo info = canvas.getRenderingInfo(); if (info == null) { return null; } EntityCollection entities = info.getEntityCollection(); if (entities == null) { return null; } ChartEntity entity = entities.getEntity(x, y); if (entity == null) { return null; } return entity.getToolTipText(); }
Example #9
Source File: ChartGestureMouseAdapterFX.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
/** * Find chartentities like JFreeChartEntity, AxisEntity, PlotEntity, TitleEntity, XY... * * @param chartPanel * @param x * @param y * @return */ private ChartEntity findChartEntity(MouseEventWrapper e) { // TODO check if insets were needed // coordinates to find chart entities int x = (int) ((e.getX()) / chartViewer.getCanvas().getScaleX()); int y = (int) ((e.getY()) / chartViewer.getCanvas().getScaleY()); if (lastEntity != null && x == lastEntityX && y == lastEntityY) return lastEntity; else { ChartRenderingInfo info = chartViewer.getCanvas().getRenderingInfo(); ChartEntity entity = null; if (info != null) { EntityCollection entities = info.getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } return entity; } }
Example #10
Source File: AbstractCategoryItemRenderer.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Adds an entity with the specified hotspot. * * @param entities the entity collection. * @param dataset the dataset. * @param row the row index. * @param column the column index. * @param hotspot the hotspot (<code>null</code> not permitted). */ protected void addItemEntity(EntityCollection entities, CategoryDataset dataset, int row, int column, Shape hotspot) { ParamChecks.nullNotPermitted(hotspot, "hotspot"); if (!getItemCreateEntity(row, column)) { return; } String tip = null; CategoryToolTipGenerator tipster = getToolTipGenerator(row, column); if (tipster != null) { tip = tipster.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getItemURLGenerator(row, column); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #11
Source File: AbstractChartPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Returns the chart entity at a given point. * <P> * This method will return null if there is (a) no entity at the given point, or (b) no entity * collection has been generated. * * @param viewX * the x-coordinate. * @param viewY * the y-coordinate. * * @return The chart entity (possibly <code>null</code>). */ @Override public ChartEntity getEntityForPoint(int viewX, int viewY) { ChartEntity result = null; if (this.info != null) { Insets insets = getInsets(); double x = (viewX - insets.left) / this.scaleX; double y = (viewY - insets.top) / this.scaleY; EntityCollection entities = this.info.getEntityCollection(); result = entities != null ? entities.getEntity(x, y) : null; } return result; }
Example #12
Source File: ChartPanel.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
Example #13
Source File: ChartPanel.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
Example #14
Source File: ChartPanel.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Returns a string for the tooltip. * * @param e the mouse event. * * @return A tool tip or <code>null</code> if no tooltip is available. */ public String getToolTipText(MouseEvent e) { String result = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { Insets insets = getInsets(); ChartEntity entity = entities.getEntity( (int) ((e.getX() - insets.left) / this.scaleX), (int) ((e.getY() - insets.top) / this.scaleY)); if (entity != null) { result = entity.getToolTipText(); } } } return result; }
Example #15
Source File: RendererState.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * A convenience method that returns a reference to the entity * collection (may be <code>null</code>) being used to record * chart entities. * * @return The entity collection (possibly <code>null</code>). */ public EntityCollection getEntityCollection() { EntityCollection result = null; if (this.info != null) { ChartRenderingInfo owner = this.info.getOwner(); if (owner != null) { result = owner.getEntityCollection(); } } return result; }
Example #16
Source File: ImageMapUtilities.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Creates an image map element that complies with the XHTML 1.0 * specification. * * @param name the map name (<code>null</code> not permitted). * @param info the chart rendering info (<code>null</code> not permitted). * @param toolTipTagFragmentGenerator a generator for the HTML fragment * that will contain the tooltip text (<code>null</code> not permitted * if <code>info</code> contains tooltip information). * @param urlTagFragmentGenerator a generator for the HTML fragment that * will contain the URL reference (<code>null</code> not permitted if * <code>info</code> contains URLs). * * @return The map tag. */ public static String getImageMap(String name, ChartRenderingInfo info, ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, URLTagFragmentGenerator urlTagFragmentGenerator) { StringBuilder sb = new StringBuilder(); sb.append("<map id=\"").append(htmlEscape(name)); sb.append("\" name=\"").append(htmlEscape(name)).append("\">"); sb.append(StringUtils.getLineSeparator()); EntityCollection entities = info.getEntityCollection(); if (entities != null) { int count = entities.getEntityCount(); for (int i = count - 1; i >= 0; i--) { ChartEntity entity = entities.getEntity(i); if (entity.getToolTipText() != null || entity.getURLText() != null) { String area = entity.getImageMapAreaTag( toolTipTagFragmentGenerator, urlTagFragmentGenerator); if (area.length() > 0) { sb.append(area); sb.append(StringUtils.getLineSeparator()); } } } } sb.append("</map>"); return sb.toString(); }
Example #17
Source File: ImageMapUtilities.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates an image map element that complies with the XHTML 1.0 * specification. * * @param name the map name (<code>null</code> not permitted). * @param info the chart rendering info (<code>null</code> not permitted). * @param toolTipTagFragmentGenerator a generator for the HTML fragment * that will contain the tooltip text (<code>null</code> not permitted * if <code>info</code> contains tooltip information). * @param urlTagFragmentGenerator a generator for the HTML fragment that * will contain the URL reference (<code>null</code> not permitted if * <code>info</code> contains URLs). * * @return The map tag. */ public static String getImageMap(String name, ChartRenderingInfo info, ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, URLTagFragmentGenerator urlTagFragmentGenerator) { StringBuffer sb = new StringBuffer(); sb.append("<map id=\"" + htmlEscape(name) + "\" name=\"" + htmlEscape(name) + "\">"); sb.append(StringUtilities.getLineSeparator()); EntityCollection entities = info.getEntityCollection(); if (entities != null) { int count = entities.getEntityCount(); for (int i = count - 1; i >= 0; i--) { ChartEntity entity = entities.getEntity(i); if (entity.getToolTipText() != null || entity.getURLText() != null) { String area = entity.getImageMapAreaTag( toolTipTagFragmentGenerator, urlTagFragmentGenerator); if (area.length() > 0) { sb.append(area); sb.append(StringUtilities.getLineSeparator()); } } } } sb.append("</map>"); return sb.toString(); }
Example #18
Source File: DefaultPolarItemRenderer.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param area the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param series the series. * @param item the item. * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). */ protected void addEntity(EntityCollection entities, Shape area, XYDataset dataset, int series, int item, double entityX, double entityY) { if (!getItemCreateEntity(series, item)) { return; } Shape hotspot = area; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; XYToolTipGenerator generator = getToolTipGenerator(series, item); if (generator != null) { tip = generator.generateToolTip(dataset, series, item); } String url = null; if (getURLGenerator() != null) { url = getURLGenerator().generateURL(dataset, series, item); } XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item, tip, url); entities.add(entity); }
Example #19
Source File: JGenProg2017_0044_t.java From coming with MIT License | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param selected is the item selected? * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.2.0 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, boolean selected, double entityX, double entityY) { if (!getItemCreateEntity(row, column, selected)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column, selected); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getURLGenerator(row, column, selected); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #20
Source File: XYLineAndShapeRenderer.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param dataArea the area within which the data is being drawn. * @param info collects information about the drawing. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { // do nothing if item is not visible if (!getItemVisible(series, item)) { return; } // first pass draws the background (lines, for instance) if (isLinePass(pass)) { if (getItemLineVisible(series, item)) { if (this.drawSeriesLineAsPath) { drawPrimaryLineAsPath(state, g2, plot, dataset, pass, series, item, domainAxis, rangeAxis, dataArea); } else { drawPrimaryLine(state, g2, plot, dataset, pass, series, item, domainAxis, rangeAxis, dataArea); } } } // second pass adds shapes where the items are .. else if (isItemPass(pass)) { // setup for collecting optional entity info... EntityCollection entities = null; if (info != null && info.getOwner() != null) { entities = info.getOwner().getEntityCollection(); } drawSecondaryPass(g2, plot, dataset, pass, series, item, domainAxis, dataArea, rangeAxis, crosshairState, entities); } }
Example #21
Source File: ChartPanel.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * 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); } }
Example #22
Source File: AbstractXYItemRenderer.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param area the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param series the series. * @param item the item. * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). */ protected void addEntity(EntityCollection entities, Shape area, XYDataset dataset, int series, int item, double entityX, double entityY) { if (!getItemCreateEntity(series, item)) { return; } Shape hotspot = area; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; XYToolTipGenerator generator = getToolTipGenerator(series, item); if (generator != null) { tip = generator.generateToolTip(dataset, series, item); } String url = null; if (getURLGenerator() != null) { url = getURLGenerator().generateURL(dataset, series, item); } XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item, tip, url); entities.add(entity); }
Example #23
Source File: XYLineAndShapeRenderer.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param dataArea the area within which the data is being drawn. * @param info collects information about the drawing. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot * (<code>null</code> permitted). * @param pass the pass index. */ @Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { // do nothing if item is not visible if (!getItemVisible(series, item)) { return; } // first pass draws the background (lines, for instance) if (isLinePass(pass)) { if (getItemLineVisible(series, item)) { if (this.drawSeriesLineAsPath) { drawPrimaryLineAsPath(state, g2, plot, dataset, pass, series, item, domainAxis, rangeAxis, dataArea); } else { drawPrimaryLine(state, g2, plot, dataset, pass, series, item, domainAxis, rangeAxis, dataArea); } } } // second pass adds shapes where the items are .. else if (isItemPass(pass)) { // setup for collecting optional entity info... EntityCollection entities = null; if (info != null && info.getOwner() != null) { entities = info.getOwner().getEntityCollection(); } drawSecondaryPass(g2, plot, dataset, pass, series, item, domainAxis, dataArea, rangeAxis, crosshairState, entities); } }
Example #24
Source File: jKali_0031_t.java From coming with MIT License | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param selected is the item selected? * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.2.0 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, boolean selected, double entityX, double entityY) { if (!getItemCreateEntity(row, column, selected)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column, selected); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getURLGenerator(row, column, selected); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #25
Source File: Arja_0089_s.java From coming with MIT License | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param selected is the item selected? * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.2.0 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, boolean selected, double entityX, double entityY) { if (!getItemCreateEntity(row, column, selected)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column, selected); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getURLGenerator(row, column, selected); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #26
Source File: ChartPanel.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Receives notification of mouse clicks on the panel. These are * translated and passed on to any registered chart mouse click listeners. * * @param event Information about the mouse event. */ 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); } }
Example #27
Source File: 1_AbstractCategoryItemRenderer.java From SimFix with GNU General Public License v2.0 | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param selected is the item selected? * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.2.0 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, boolean selected, double entityX, double entityY) { if (!getItemCreateEntity(row, column, selected)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column, selected); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getURLGenerator(row, column, selected); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #28
Source File: JGenProg2017_000_s.java From coming with MIT License | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param selected is the item selected? * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.2.0 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, boolean selected, double entityX, double entityY) { if (!getItemCreateEntity(row, column, selected)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column, selected); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getURLGenerator(row, column, selected); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }
Example #29
Source File: AbstractXYItemRenderer.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param area the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param series the series. * @param item the item. * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). */ protected void addEntity(EntityCollection entities, Shape area, XYDataset dataset, int series, int item, double entityX, double entityY) { if (!getItemCreateEntity(series, item)) { return; } Shape hotspot = area; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; XYToolTipGenerator generator = getToolTipGenerator(series, item); if (generator != null) { tip = generator.generateToolTip(dataset, series, item); } String url = null; if (getURLGenerator() != null) { url = getURLGenerator().generateURL(dataset, series, item); } XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item, tip, url); entities.add(entity); }
Example #30
Source File: Arja_000_s.java From coming with MIT License | 5 votes |
/** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param selected is the item selected? * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.2.0 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, boolean selected, double entityX, double entityY) { if (!getItemCreateEntity(row, column, selected)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column, selected); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getURLGenerator(row, column, selected); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); }