當前位置: 首頁>>代碼示例>>Java>>正文


Java CategoryItemRenderer類代碼示例

本文整理匯總了Java中org.jfree.chart.renderer.category.CategoryItemRenderer的典型用法代碼示例。如果您正苦於以下問題:Java CategoryItemRenderer類的具體用法?Java CategoryItemRenderer怎麽用?Java CategoryItemRenderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CategoryItemRenderer類屬於org.jfree.chart.renderer.category包,在下文中一共展示了CategoryItemRenderer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visualizarSerieChartAsignRescateVict

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
public void  visualizarSerieChartAsignRescateVict(Color color,CategoryDataset dataset) {
     ChartPanel chartPanel = new ChartPanel(chartNotifAsigResc);
     chartNotifAsigResc.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chartNotifAsigResc.getPlot();
     plot.setBackgroundPaint(color);
     plot.setDataset(dataset);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setUpperMargin(0.15);
     CategoryItemRenderer renderer = plot.getRenderer();
     renderer.setItemLabelGenerator(new LabelGenerator(50.0));
     renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
     renderer.setItemLabelsVisible(true);
     chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
   this.pack();
   RefineryUtilities.centerFrameOnScreen(this);
   this.setVisible(true);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:21,代碼來源:VisualizacionJfreechart.java

示例2: visualizarSeriesTiemposRescateVictPorRobots

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
public void  visualizarSeriesTiemposRescateVictPorRobots(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
     "Tiempos de Rescate de Victimas por cada robot ", // chart title
     "Robots en el entorno", // domain axis label
     "Tiempo milisegundos", // range axis label
     dataset, // data
     PlotOrientation.VERTICAL, // orientation
     true, // include legend
     true, // tooltips?
     false // URLs?
     );
     ChartPanel chartPanel = new ChartPanel(chart);
     chart.setBackgroundPaint(Color.white);
     CategoryPlot plot = chart.getCategoryPlot();
     plot.setBackgroundPaint(Color.lightGray);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setUpperMargin(0.15);
     CategoryItemRenderer renderer = plot.getRenderer();
     renderer.setItemLabelGenerator(new LabelGenerator(50.0));
     renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
     renderer.setItemLabelsVisible(true);
     chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
     this.visualizar(chartPanel);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:27,代碼來源:VisualizacionJfreechart.java

示例3: visualizarSeriesEnergRescateVictPorRobots

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
public void  visualizarSeriesEnergRescateVictPorRobots(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
     "Tiempos de Rescate de Victimas por cada robot ", // chart title
     "Robots en el entorno", // domain axis label
     "Unidades de energ�a", // range axis label
     dataset, // data
     PlotOrientation.VERTICAL, // orientation
     true, // include legend
     true, // tooltips?
     false // URLs?
     );
     ChartPanel chartPanel = new ChartPanel(chart);
     chart.setBackgroundPaint(Color.white);
     CategoryPlot plot = chart.getCategoryPlot();
     plot.setBackgroundPaint(Color.lightGray);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setUpperMargin(0.15);
     CategoryItemRenderer renderer = plot.getRenderer();
     renderer.setItemLabelGenerator(new LabelGenerator(50.0));
     renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
     renderer.setItemLabelsVisible(true);
     chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
     this.visualizar(chartPanel);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:27,代碼來源:VisualizacionJfreechart.java

示例4: setRenderer

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Sets a renderer.  A {@link PlotChangeEvent} is sent to all registered listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer (<code>null</code> permitted).
 * @param notify  notify listeners?
 */
public void setRenderer(int index, CategoryItemRenderer renderer, boolean notify) {
    
    // stop listening to the existing renderer...
    CategoryItemRenderer existing = (CategoryItemRenderer) this.renderers.get(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    
    // register the new renderer...
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    
    configureDomainAxes();
    configureRangeAxes();
    
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:CategoryPlot.java

示例5: drawRangeGridlines

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Draws the gridlines for the plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param ticks  the ticks.
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) {
    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible()) {
        Stroke gridStroke = getRangeGridlineStroke();
        Paint gridPaint = getRangeGridlinePaint();
        if ((gridStroke != null) && (gridPaint != null)) {
            ValueAxis axis = getRangeAxis();
            if (axis != null) {
                Iterator iterator = ticks.iterator();
                while (iterator.hasNext()) {
                    ValueTick tick = (ValueTick) iterator.next();
                    CategoryItemRenderer renderer1 = getRenderer();
                    if (renderer1 != null) {
                        renderer1.drawRangeGridline(
                            g2, this, getRangeAxis(), dataArea, tick.getValue()
                        );
                    }
                }
            }
        }
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:CategoryPlot.java

示例6: drawRangeMarkers

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Draws the range markers (if any) for an axis and layer.  This method is 
 * typically called from within the draw(...) method.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param index  the renderer index.
 * @param layer  the layer (foreground or background).
 */
protected void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea, int index,
                                Layer layer) {
                                             
    CategoryItemRenderer r = getRenderer(index);
    if (r == null) {
        return;
    }
    
    Collection markers = getRangeMarkers(index, layer);
    ValueAxis axis = getRangeAxisForDataset(index);
    if (markers != null && axis != null) {
        Iterator iterator = markers.iterator();
        while (iterator.hasNext()) {
            Marker marker = (Marker) iterator.next();
            r.drawRangeMarker(g2, this, axis, marker, dataArea);
        }
    }
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:29,代碼來源:CategoryPlot.java

示例7: getDataRange

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Returns the range of data values that will be plotted against the range axis.
 * If the dataset is <code>null</code>, this method returns <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(getDatasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(getDatasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.getRangeExtent(d));
        }
    }
    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:CategoryPlot.java

示例8: setRenderer

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Sets a renderer.  A {@link PlotChangeEvent} is sent to all registered 
 * listeners.
 *
 * @param index  the index.
 * @param renderer  the renderer (<code>null</code> permitted).
 * @param notify  notify listeners?
 * 
 * @see #getRenderer(int)
 */
public void setRenderer(int index, CategoryItemRenderer renderer, 
                        boolean notify) {
    
    // stop listening to the existing renderer...
    CategoryItemRenderer existing 
        = (CategoryItemRenderer) this.renderers.get(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    
    // register the new renderer...
    this.renderers.set(index, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }
    
    configureDomainAxes();
    configureRangeAxes();
    
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:CategoryPlot.java

示例9: drawRangeGridlines

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Draws the gridlines for the plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param ticks  the ticks.
 * 
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, 
                                  List ticks) {
    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible()) {
        Stroke gridStroke = getRangeGridlineStroke();
        Paint gridPaint = getRangeGridlinePaint();
        if ((gridStroke != null) && (gridPaint != null)) {
            ValueAxis axis = getRangeAxis();
            if (axis != null) {
                Iterator iterator = ticks.iterator();
                while (iterator.hasNext()) {
                    ValueTick tick = (ValueTick) iterator.next();
                    CategoryItemRenderer renderer1 = getRenderer();
                    if (renderer1 != null) {
                        renderer1.drawRangeGridline(g2, this, 
                                getRangeAxis(), dataArea, tick.getValue());
                    }
                }
            }
        }
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:32,代碼來源:CategoryPlot.java

示例10: drawDomainMarkers

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Draws the domain markers (if any) for an axis and layer.  This method is 
 * typically called from within the draw() method.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param index  the renderer index.
 * @param layer  the layer (foreground or background).
 * 
 * @see #drawRangeMarkers(Graphics2D, Rectangle2D, int, Layer)
 */
protected void drawDomainMarkers(Graphics2D g2, Rectangle2D dataArea, 
                                 int index, Layer layer) {
                                             
    CategoryItemRenderer r = getRenderer(index);
    if (r == null) {
        return;
    }
    
    Collection markers = getDomainMarkers(index, layer);
    CategoryAxis axis = getDomainAxisForDataset(index);
    if (markers != null && axis != null) {
        Iterator iterator = markers.iterator();
        while (iterator.hasNext()) {
            CategoryMarker marker = (CategoryMarker) iterator.next();
            r.drawDomainMarker(g2, this, axis, marker, dataArea);
        }
    }
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:31,代碼來源:CategoryPlot.java

示例11: drawRangeMarkers

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Draws the range markers (if any) for an axis and layer.  This method is 
 * typically called from within the draw() method.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param index  the renderer index.
 * @param layer  the layer (foreground or background).
 * 
 * @see #drawDomainMarkers(Graphics2D, Rectangle2D, int, Layer)
 */
protected void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea, 
                                int index, Layer layer) {
                                             
    CategoryItemRenderer r = getRenderer(index);
    if (r == null) {
        return;
    }
    
    Collection markers = getRangeMarkers(index, layer);
    ValueAxis axis = getRangeAxisForDataset(index);
    if (markers != null && axis != null) {
        Iterator iterator = markers.iterator();
        while (iterator.hasNext()) {
            Marker marker = (Marker) iterator.next();
            r.drawRangeMarker(g2, this, axis, marker, dataArea);
        }
    }
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:31,代碼來源:CategoryPlot.java

示例12: testDatasetIndices

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Datasets are now stored in a Map, and it should be possible to assign
 * them an arbitrary key (index).
 */
@Test
public void testDatasetIndices() {
    CategoryDataset dataset = new DefaultCategoryDataset();
    CategoryAxis xAxis = new CategoryAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    CategoryItemRenderer renderer = new BarRenderer();
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
    
    assertEquals(dataset, plot.getDataset(0));
    
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    dataset2.setValue(1, "R1", "C1");
    
    // we should be able to give a dataset an arbitrary index
    plot.setDataset(99, dataset2);
    assertEquals(2, plot.getDatasetCount());
    assertEquals(dataset2, plot.getDataset(99));
    
    assertEquals(0, plot.indexOf(dataset));
    assertEquals(99, plot.indexOf(dataset2));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:26,代碼來源:CategoryPlotTest.java

示例13: testAxisIndices

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
@Test
public void testAxisIndices() {
    CategoryDataset dataset = new DefaultCategoryDataset();
    CategoryAxis xAxis = new CategoryAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    CategoryItemRenderer renderer = new BarRenderer();
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
    assertEquals(xAxis, plot.getDomainAxis(0));        
    assertEquals(yAxis, plot.getRangeAxis(0)); 
    
    CategoryAxis xAxis2 = new CategoryAxis("X2");
    plot.setDomainAxis(99, xAxis2);
    assertEquals(xAxis2, plot.getDomainAxis(99));
    
    NumberAxis yAxis2 = new NumberAxis("Y2");
    plot.setRangeAxis(99, yAxis2);
    assertEquals(yAxis2, plot.getRangeAxis(99));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:19,代碼來源:CategoryPlotTest.java

示例14: testAxisLocationIndices

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
@Test 
public void testAxisLocationIndices() {
    CategoryDataset dataset = new DefaultCategoryDataset();
    CategoryAxis xAxis = new CategoryAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    CategoryItemRenderer renderer = new BarRenderer();
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    CategoryAxis xAxis2 = new CategoryAxis("X2");
    NumberAxis yAxis2 = new NumberAxis("Y2");
    plot.setDomainAxis(99, xAxis2);
    plot.setRangeAxis(99, yAxis2);
    
    plot.setDomainAxisLocation(99, AxisLocation.BOTTOM_OR_RIGHT);
    assertEquals(AxisLocation.BOTTOM_OR_RIGHT, 
            plot.getDomainAxisLocation(99));
    plot.setRangeAxisLocation(99, AxisLocation.BOTTOM_OR_LEFT);
    assertEquals(AxisLocation.BOTTOM_OR_LEFT, 
            plot.getRangeAxisLocation(99));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:21,代碼來源:CategoryPlotTest.java

示例15: getDataRange

import org.jfree.chart.renderer.category.CategoryItemRenderer; //導入依賴的package包/類
/**
 * Returns the range of data values that will be plotted against the range
 * axis.  If the dataset is <code>null</code>, this method returns
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
@Override
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    List<CategoryDataset> mappedDatasets = new ArrayList<CategoryDataset>();
    int rangeIndex = findRangeAxisIndex(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union
    // of the ranges.
    for (CategoryDataset d : mappedDatasets) {
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;
}
 
開發者ID:nick-paul,項目名稱:aya-lang,代碼行數:32,代碼來源:CategoryPlot.java


注:本文中的org.jfree.chart.renderer.category.CategoryItemRenderer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。