List of usage examples for org.jfree.chart LegendItem LegendItem
public LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape line,
Stroke lineStroke, Paint linePaint)
From source file:de.unibayreuth.bayeos.goat.chart.StatusXYPlot.java
private void addLegendItem(String text, Color col) { legendcol.add(new LegendItem(text, text, new Rectangle(10, 10), true, col, col, new BasicStroke(2.0f))); }
From source file:jamel.gui.charts.JamelChart.java
/** * Adds a line item to the legend of the chart. * @param label the label of the item.//from www .j av a 2 s .com * @param color the color of the item. */ public void addLineLegendItem(String label, Color color) { final LegendItemCollection gbcdg = getFixedLegendItems(); gbcdg.add(new LegendItem(label, null, null, null, line, basicStroke, color)); }
From source file:gov.nih.nci.caintegrator.ui.graphing.chart.plot.ClinicalPlot.java
/** * Build the legend// ww w . j a v a 2s.c o m * */ private void buildLegend() { LegendTitle legend = clinicalChart.getLegend(); LegendItemSource[] sources = new LegendItemSource[1]; ClinicalLegendItemSource legendSrc = new ClinicalLegendItemSource(); LegendItem item = null; //go through the disease color map and add legend items String diseaseName = null; Color diseaseColor = null; DiseaseType[] diseases = DiseaseType.values(); for (int i = 0; i < diseases.length; i++) { diseaseName = diseases[i].name(); if (diseases[i].equals(DiseaseType.UNCLASSIFIED)) { continue; //remove unclassified from the legend } diseaseColor = diseases[i].getColor(); item = new LegendItem(diseaseName, null, null, null, new Line2D.Double(0, 0, 6, 6), new BasicStroke(3.0f), diseaseColor); legendSrc.addLegendItem(item); } // for (Iterator i=diseaseColorMap.keySet().iterator(); i.hasNext(); ) { // diseaseName = (String) i.next(); // diseaseColor = (Color) diseaseColorMap.get(diseaseName); // item = new LegendItem(diseaseName, null, null, null, new Line2D.Double(0,0,6,6), new BasicStroke(3.0f), diseaseColor); // //item = new LegendItem(diseaseName, null, null, null, new Rectangle2D.Double(0,0,6,6), diseaseColor); // legendSrc.addLegendItem(item); // } sources[0] = legendSrc; legend.setSources(sources); }