List of usage examples for java.awt BasicStroke CAP_ROUND
int CAP_ROUND
To view the source code for java.awt BasicStroke CAP_ROUND.
Click Source Link
From source file:edu.unibonn.kmeans.mapreduce.plotting.TimeSeriesPlotter_KMeans.java
/** * Creates a chart.//from ww w . ja va2 s . c om * * @param dataset a dataset. * @param clusters * * @return A chart. */ // private JFreeChart createChart(final XYDataset dataset, ArrayList<Cluster_DBScan> clusters) { // // final JFreeChart chart = ChartFactory.createTimeSeriesChart( // "Sensors", // "Time", "Erlang", // dataset, // false, //t // true, //t // false //f // ); // // ChartUtilities.applyCurrentTheme(chart); // // //chart.setBackgroundPaint(Color.white); // //// final StandardLegend sl = (StandardLegend) chart.getLegend(); //// sl.setDisplaySeriesShapes(true); // // final XYPlot plot = chart.getXYPlot(); // plot.setBackgroundPaint(Color.WHITE); // plot.setDomainGridlinePaint(Color.white); // plot.setRangeGridlinePaint(Color.white); //// plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); // plot.setDomainCrosshairVisible(true); // plot.setRangeCrosshairVisible(true); // // final XYItemRenderer renderer = plot.getRenderer(); // // if (renderer instanceof StandardXYItemRenderer) // { // final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; // //rr.setPlotShapes(true); // rr.setShapesFilled(true); // rr.setItemLabelsVisible(true); // } // // int temp_count = 0; // // //for (int i = 0; i < clusters.size(); i++) // for (int i = 0; (i < 11) && (i < clusters.size()); i++) // { // Cluster_DBScan current_cluster = clusters.get(i); // ArrayList<Day_24d> member_time_series = current_cluster.getMembership(); // // for (int j = 0; j < member_time_series.size(); j++) // { // renderer.setSeriesPaint(j+temp_count, getColor(i)); // } // temp_count = temp_count + member_time_series.size(); // } // // final DateAxis axis = (DateAxis) plot.getDomainAxis(); // axis.setDateFormatOverride(new SimpleDateFormat("HH:mm")); // // final ValueAxis axis_y = plot.getRangeAxis(); // axis_y.setRange(0, 100); // // return chart; // // } private JFreeChart createChart(final XYDataset dataset, final XYDataset dataset_centroids, ArrayList<Cluster_KMeans> clusters) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Sensors", "Time", "Erlang", dataset, false, //t true, //t false //f ); ChartUtilities.applyCurrentTheme(chart); //chart.setBackgroundPaint(Color.white); // final StandardLegend sl = (StandardLegend) chart.getLegend(); // sl.setDisplaySeriesShapes(true); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final XYItemRenderer renderer = plot.getRenderer(); if (renderer instanceof StandardXYItemRenderer) { final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; //rr.setPlotShapes(true); rr.setShapesFilled(true); rr.setItemLabelsVisible(true); } int temp_count = 0; //for (int i = 0; i < clusters.size(); i++) for (int i = 0; (i < 11) && (i < clusters.size()); i++) { Cluster_KMeans current_cluster = clusters.get(i); ArrayList<Day_24d> member_time_series = current_cluster.getMembership(); for (int j = 0; j < member_time_series.size(); j++) { renderer.setSeriesPaint(j + temp_count, getColor(i)); } temp_count = temp_count + member_time_series.size(); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("HH:mm")); //final ValueAxis axis_y = plot.getRangeAxis(); //axis_y.setRange(0, 20); plot.setDataset(1, dataset_centroids); plot.setRenderer(1, new StandardXYItemRenderer()); for (int i = 0; (i < clusters.size()); i++) { //plot.getRenderer(1).setSeriesPaint(i, getColor(i)); plot.getRenderer(1).setSeriesPaint(i, Color.BLACK); plot.getRenderer(1).setSeriesStroke(i, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f)); } plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
From source file:com.rapidminer.gui.plotter.charts.DistributionPlotter.java
private JFreeChart createNumericalChart() { JFreeChart chart;/*from w w w . j a va 2 s .c o m*/ XYDataset dataset = createNumericalDataSet(); // create the chart... String domainName = dataTable == null ? MODEL_DOMAIN_AXIS_NAME : dataTable.getColumnName(plotColumn); chart = ChartFactory.createXYLineChart(null, // chart title domainName, // x axis label RANGE_AXIS_NAME, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); DeviationRenderer renderer = new DeviationRenderer(true, false); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = getColorProvider() .getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(renderer); return chart; }
From source file:org.drools.planner.benchmark.core.statistic.PlannerStatistic.java
private void writeAverageCalculateCountPerSecondSummaryChart() { NumberAxis xAxis = new NumberAxis("Problem scale"); NumberAxis yAxis = new NumberAxis("Average calculate count per second"); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); int seriesIndex = 0; for (SolverBenchmark solverBenchmark : plannerBenchmark.getSolverBenchmarkList()) { String solverLabel = solverBenchmark.getName(); if (solverBenchmark.isRankingBest()) { solverLabel += " (winner)"; }/*from w w w.j a v a 2 s . c o m*/ XYSeries series = new XYSeries(solverLabel); for (SingleBenchmark singleBenchmark : solverBenchmark.getSingleBenchmarkList()) { if (singleBenchmark.isSuccess()) { long problemScale = singleBenchmark.getProblemScale(); long averageCalculateCountPerSecond = singleBenchmark.getAverageCalculateCountPerSecond(); series.add((Long) problemScale, (Long) averageCalculateCountPerSecond); } } XYSeriesCollection seriesCollection = new XYSeriesCollection(); seriesCollection.addSeries(series); plot.setDataset(seriesIndex, seriesCollection); XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); // Use dashed line renderer.setSeriesStroke(0, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); plot.setRenderer(seriesIndex, renderer); seriesIndex++; } plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart("Average calculate count summary (higher is better)", JFreeChart.DEFAULT_TITLE_FONT, plot, true); BufferedImage chartImage = chart.createBufferedImage(1024, 768); averageCalculateCountSummaryFile = new File(plannerBenchmark.getBenchmarkReportDirectory(), "averageCalculateCountSummary.png"); OutputStream out = null; try { out = new FileOutputStream(averageCalculateCountSummaryFile); ImageIO.write(chartImage, "png", out); } catch (IOException e) { throw new IllegalArgumentException( "Problem writing averageCalculateCountSummaryFile: " + averageCalculateCountSummaryFile, e); } finally { IOUtils.closeQuietly(out); } }
From source file:userinterface.graph.SeriesSettings.java
public void updateSeries() { // We don't want series to change while we are updating. synchronized (graph.getSeriesLock()) { int seriesIndex = graph.getJFreeChartIndex(key); if (seriesIndex >= 0) { /* Set series colour. */ if (renderer.getSeriesPaint(seriesIndex) == null || !renderer.getSeriesPaint(seriesIndex).equals(seriesColour)) { renderer.setSeriesPaint(seriesIndex, seriesColour.getColorValue()); }/* ww w. ja v a 2 s . c o m*/ /* Set series heading. */ if (!graph.getXYSeries(key).getKey().equals(seriesHeading.getStringValue())) { graph.changeSeriesName(key, seriesHeading.getStringValue()); try { seriesHeading.setValue(graph.getXYSeries(key).getKey()); } catch (SettingException e) { } } /* Set showPoints. */ Boolean pointsVisibleFlag = renderer.getSeriesShapesVisible(seriesIndex); if (pointsVisibleFlag == null || pointsVisibleFlag.booleanValue() != showPoints.getBooleanValue()) { renderer.setSeriesShapesVisible(seriesIndex, showPoints.getBooleanValue()); } /* Set seriesShape. */ Shape shape = renderer.getSeriesShape(seriesIndex); int shapeIndex = seriesShape.getCurrentIndex(); if (!ShapeUtilities.equal(shape, SHAPES[shapeIndex])) renderer.setSeriesShape(seriesIndex, SHAPES[shapeIndex]); /* Set showLines. */ Boolean linesVisibleFlag = renderer.getSeriesLinesVisible(seriesIndex); if (linesVisibleFlag == null || linesVisibleFlag.booleanValue() != showLines.getBooleanValue()) { renderer.setSeriesLinesVisible(seriesIndex, showLines.getBooleanValue()); } /* Set stroke - hard to check*/ if (lineStyle.getCurrentIndex() == SOLID) // solid { BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f); renderer.setSeriesStroke(seriesIndex, newStroke); } else if (lineStyle.getCurrentIndex() == DASHED) // Just dash { float dash[] = { 2.0f, 3.0f }; BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, dash, 1.0f); renderer.setSeriesStroke(seriesIndex, newStroke); } else // Funny dash { float dash[] = { 1.0f, 3.0f, 5.0f, 3.0f }; BasicStroke newStroke = new BasicStroke((float) lineWidth.getDoubleValue(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, dash, 0.0f); renderer.setSeriesStroke(seriesIndex, newStroke); } } icon = new GraphSeriesIcon(renderer.getSeriesShape(seriesIndex), renderer.getSeriesStroke(seriesIndex), seriesColour.getColorValue(), showLines.getBooleanValue(), showPoints.getBooleanValue()); icon.setOpaque(false); icon.setMinimumSize(new Dimension(20, 10)); icon.setMaximumSize(new Dimension(50, 20)); icon.setPreferredSize(new Dimension(30, 10)); } }
From source file:business.ImageManager.java
private void doDrawPath(Graphics2D big, Point ori, Point dest, Color color) { //setup para os rastros big.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); big.setStroke(new BasicStroke(0.75f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f, new float[] { 3f, 5f, 7f, 5f, 11f, 5f, 15f, 5f, 21f, 5f, 27f, 5f, 33f, 5f }, 0f)); big.setColor(color);/*from w ww . j a v a 2s . co m*/ //draw path Path2D.Double path = new Path2D.Double(); path.moveTo(ori.getX(), ori.getY()); path.lineTo(dest.getX(), dest.getY()); //draw on graph big.draw(path); }
From source file:com.rapidminer.gui.plotter.charts.MultipleScatterPlotter.java
@Override public void updatePlotter() { prepareData();//from www. j a v a2 s . c o m JFreeChart chart = ChartFactory.createScatterPlot(null, // chart title null, // domain axis label null, // range axis label dataSet, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // URLs ); if (xAxis >= 0) { int size = dataSet.getSeriesCount(); chart = ChartFactory.createScatterPlot(null, // chart title null, // domain axis label null, // range axis label dataSet, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // URLs ); // renderer settings XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer(); renderer.setBaseOutlinePaint(Color.BLACK); renderer.setUseOutlinePaint(true); renderer.setDrawOutlines(true); for (int i = 0; i < size; i++) { renderer.setSeriesShapesVisible(i, this.showPoints[plotIndexToColumnIndexMap.get(i)]); renderer.setSeriesLinesVisible(i, this.showLines[plotIndexToColumnIndexMap.get(i)]); } renderer.setSeriesShape(0, new Ellipse2D.Double(-3, -3, 7, 7)); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } } // GENERAL CHART SETTINGS int size = dataSet.getSeriesCount(); if (size <= 1) { chart.getXYPlot().getRenderer().setSeriesPaint(0, getColorProvider().getPointColor(1.0d)); } else { for (int i = 0; i < dataSet.getSeriesCount(); i++) { chart.getXYPlot().getRenderer().setSeriesStroke(i, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); chart.getXYPlot().getRenderer().setSeriesPaint(i, getColorProvider().getPointColor(i / (double) (dataSet.getSeriesCount() - 1))); } } // set the background colors for the chart... chart.setBackgroundPaint(Color.WHITE); chart.getPlot().setBackgroundPaint(Color.WHITE); chart.setAntiAlias(false); // general plot settings XYPlot plot = chart.getXYPlot(); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); // domain axis if (xAxis >= 0) { if (dataTable.isNominal(xAxis)) { String[] values = new String[dataTable.getNumberOfValues(xAxis)]; for (int i = 0; i < values.length; i++) { values[i] = dataTable.mapIndex(xAxis, i); } plot.setDomainAxis(new SymbolAxis(dataTable.getColumnName(xAxis), values)); } else if ((dataTable.isDate(xAxis)) || (dataTable.isDateTime(xAxis))) { DateAxis domainAxis = new DateAxis(dataTable.getColumnName(xAxis)); domainAxis.setTimeZone(Tools.getPreferredTimeZone()); plot.setDomainAxis(domainAxis); } else { if (xLogScale) { LogAxis domainAxis = new LogAxis(dataTable.getColumnName(xAxis)); domainAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US)); plot.setDomainAxis(domainAxis); } else { NumberAxis domainAxis = new NumberAxis(dataTable.getColumnName(xAxis)); domainAxis.setAutoRangeStickyZero(false); domainAxis.setAutoRangeIncludesZero(false); plot.setDomainAxis(domainAxis); } } } plot.getDomainAxis().setLabelFont(LABEL_FONT_BOLD); plot.getDomainAxis().setTickLabelFont(LABEL_FONT); // rotate labels if (isLabelRotating()) { plot.getDomainAxis().setTickLabelsVisible(true); plot.getDomainAxis().setVerticalTickLabels(true); } // range axis plot.getRangeAxis().setLabelFont(LABEL_FONT_BOLD); plot.getRangeAxis().setTickLabelFont(LABEL_FONT); // Chart Panel Settings if (panel instanceof AbstractChartPanel) { panel.setChart(chart); } else { panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN); final ChartPanelShiftController controller = new ChartPanelShiftController(panel); panel.addMouseListener(controller); panel.addMouseMotionListener(controller); // react to mouse clicks // ATTENTION: ACTIVATING THIS WILL LEAD TO SEVERE MEMORY LEAKS!!! (see below) panel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent e) { if (e.getTrigger().getClickCount() > 1) { XYItemEntity entity = (XYItemEntity) e.getEntity(); if (entity != null) { String id = idMap.get(new SeriesAndItem(entity.getSeriesIndex(), entity.getItem())); if (id != null) { ObjectVisualizer visualizer = ObjectVisualizerService .getVisualizerForObject(dataTable); visualizer.startVisualization(id); } } } } @Override public void chartMouseMoved(ChartMouseEvent e) { } }); } // tooltips class CustomXYToolTipGenerator implements XYToolTipGenerator { public CustomXYToolTipGenerator() { } @Override public String generateToolTip(XYDataset dataset, int row, int column) { String id = idMap.get(new SeriesAndItem(row, column)); if (id != null) { return "<html><b>Id: " + id + "</b> (" + dataset.getSeriesKey(row) + ", " + Tools.formatIntegerIfPossible(dataset.getXValue(row, column)) + ", " + Tools.formatIntegerIfPossible(dataset.getYValue(row, column)) + ")</html>"; } else { return "<html>(" + dataset.getSeriesKey(row) + ", " + Tools.formatIntegerIfPossible(dataset.getXValue(row, column)) + ", " + Tools.formatIntegerIfPossible(dataset.getYValue(row, column)) + ")</html>"; } } } for (int i = 0; i < dataSet.getSeriesCount(); i++) { plot.getRenderer().setSeriesToolTipGenerator(i, new CustomXYToolTipGenerator()); } }
From source file:org.drools.planner.benchmark.core.statistic.BenchmarkReport.java
private void writeAverageCalculateCountPerSecondSummaryChart() { NumberAxis xAxis = new NumberAxis("Problem scale"); xAxis.setNumberFormatOverride(NumberFormat.getInstance(locale)); NumberAxis yAxis = new NumberAxis("Average calculate count per second"); yAxis.setNumberFormatOverride(NumberFormat.getInstance(locale)); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); int seriesIndex = 0; for (SolverBenchmark solverBenchmark : plannerBenchmark.getSolverBenchmarkList()) { String solverLabel = solverBenchmark.getNameWithFavoriteSuffix(); XYSeries series = new XYSeries(solverLabel); for (SingleBenchmark singleBenchmark : solverBenchmark.getSingleBenchmarkList()) { if (singleBenchmark.isSuccess()) { long problemScale = singleBenchmark.getProblemBenchmark().getProblemScale(); long averageCalculateCountPerSecond = singleBenchmark.getAverageCalculateCountPerSecond(); series.add((Long) problemScale, (Long) averageCalculateCountPerSecond); }/*from w w w . java 2 s. c o m*/ } XYSeriesCollection seriesCollection = new XYSeriesCollection(); seriesCollection.addSeries(series); plot.setDataset(seriesIndex, seriesCollection); XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); // Use dashed line renderer.setSeriesStroke(0, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); plot.setRenderer(seriesIndex, renderer); seriesIndex++; } plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart("Average calculate count summary (higher is better)", JFreeChart.DEFAULT_TITLE_FONT, plot, true); averageCalculateCountSummaryChartFile = writeChartToImageFile(chart, "averageCalculateCountSummary"); }
From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java
private void rebuildChart() { if (listModel.getSize() < 2) { JOptionPane.showMessageDialog(this, "Select 2 compounds.", "Error", JOptionPane.OK_OPTION); err = true;/*w w w .ja v a 2 s .c om*/ return; } if (listModel.getSize() > 2) { JOptionPane.showMessageDialog(this, "Select only 2 compounds.", "Error", JOptionPane.OK_OPTION); return; } double T = Double.parseDouble(temperature.getText()); if (T <= 0) { JOptionPane.showMessageDialog(this, "Invalid Temperature.", "Error", JOptionPane.OK_OPTION); return; } COSMOSAC cosmosac = (COSMOSAC) modelBox.getSelectedItem(); COSMOSACCompound comps[] = new COSMOSACCompound[2]; try { comps[0] = db.getComp((String) listModel.getElementAt(0)); comps[1] = db.getComp((String) listModel.getElementAt(1)); cosmosac.setComponents(comps); } catch (Exception e1) { e1.printStackTrace(); return; } if (comps[0] == null || comps[1] == null) return; cosmosac.setSigmaHB(Double.parseDouble(sigmaHB.getText())); cosmosac.setSigmaHB2(Double.parseDouble(sigmaHB2.getText())); cosmosac.setSigmaHB3(Double.parseDouble(sigmaHB3.getText())); // cosmosac.setSigmaHBUpper(Double.parseDouble(sigmaHBUpper.getText())); cosmosac.setCHB(Double.parseDouble(chargeHB.getText())); cosmosac.setSigmaDisp(Double.parseDouble(sigmaDisp.getText())); cosmosac.setCDisp(Double.parseDouble(chargeDisp.getText())); cosmosac.setBeta(Double.parseDouble(beta.getText())); cosmosac.setFpol(Double.parseDouble(fpol.getText())); cosmosac.setAnorm(Double.parseDouble(anorm.getText())); cosmosac.parametersChanged(); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // cosmosac.setParameters(cavityVolume, c1.charge, sigma); cosmosac.setTemperature(T); // testing several compositions XYSeriesCollection dataset = new XYSeriesCollection(); int n = 20; XYSeries lnGamma1 = new XYSeries(comps[0].name); XYSeries lnGamma2 = new XYSeries(comps[1].name); XYSeries ge_RT = new XYSeries("gE/RT"); for (int i = 0; i <= n; ++i) { z[0] = (double) i / n; z[1] = 1 - z[0]; cosmosac.setComposition(z); cosmosac.activityCoefficient(lnGamma); lnGamma1.add(z[0], lnGamma[0]); lnGamma2.add(z[0], lnGamma[1]); ge_RT.add(z[0], z[0] * lnGamma[0] + z[1] * lnGamma[1]); if (z[0] == 0) { lnGammaInf1Label.setText(String.format("%6.3g", lnGamma[0])); gammaInf1Label.setText(String.format("%6.3g", Math.exp(lnGamma[0]))); } if (z[1] == 0) { lnGammaInf2Label.setText(String.format("%6.3g", lnGamma[1])); gammaInf2Label.setText(String.format("%6.3g", Math.exp(lnGamma[1]))); } } dataset.addSeries(lnGamma1); dataset.addSeries(lnGamma2); dataset.addSeries(ge_RT); plot.setDataset(dataset); // now the segment gamma dataset = new XYSeriesCollection(); double[][] seggamma = cosmosac.getPureSegmentGamma(); n = comps[0].charge.length; XYSeries g1 = new XYSeries(comps[0].name); XYSeries g2 = new XYSeries(comps[1].name); XYSeries g1s = new XYSeries(comps[0].name + " * sigma"); XYSeries g2s = new XYSeries(comps[1].name + " * sigma"); for (int j = 0; j < n; ++j) { g1.add(comps[0].charge[j], Math.log(seggamma[0][j])); g2.add(comps[1].charge[j], Math.log(seggamma[1][j])); g1s.add(comps[0].charge[j], comps[0].area[j] * (Math.log(seggamma[1][j]) - Math.log(seggamma[0][j]))); g2s.add(comps[1].charge[j], comps[1].area[j] * (Math.log(seggamma[0][j]) - Math.log(seggamma[1][j]))); } dataset.addSeries(g1); dataset.addSeries(g2); dataset.addSeries(g1s); dataset.addSeries(g2s); plotSegGamma.setDataset(dataset); // adjust the plot properties plotSegGamma.getDomainAxis().setAutoRange(false); plotSegGamma.getDomainAxis().setRange(new Range(-0.025, 0.025)); XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plotSegGamma.getRenderer(); r.setSeriesStroke(0, new BasicStroke(2.5f)); r.setSeriesStroke(1, new BasicStroke(2.5f)); BasicStroke dashed = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f); r.setSeriesStroke(2, dashed); r.setSeriesStroke(3, dashed); r.setSeriesPaint(0, Color.RED); r.setSeriesPaint(1, Color.BLUE); r.setSeriesPaint(2, Color.RED); r.setSeriesPaint(3, Color.BLUE); // plotSegGamma.setRenderer(stepRenderer); // plotSegGamma.setRenderer(3, stepRenderer); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java
protected JFreeChart createXyLineChart() throws JRException { JFreeChart jfreeChart = super.createXyLineChart(); XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) jfreeChart.getXYPlot().getRenderer(); XYLine3DRenderer line3DRenderer = new XYLine3DRenderer(); line3DRenderer.setBaseToolTipGenerator(lineRenderer.getBaseToolTipGenerator()); line3DRenderer.setURLGenerator(lineRenderer.getURLGenerator()); line3DRenderer.setBaseStroke(new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); line3DRenderer.setBaseLinesVisible(lineRenderer.getBaseLinesVisible()); line3DRenderer.setBaseShapesVisible(lineRenderer.getBaseShapesVisible()); Stroke stroke = new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); XYDataset xyDataset = xyPlot.getDataset(); if (xyDataset != null) { for (int i = 0; i < xyDataset.getSeriesCount(); i++) { line3DRenderer.setSeriesStroke(i, stroke); line3DRenderer.setSeriesLinesVisible(i, lineRenderer.getBaseLinesVisible()); line3DRenderer.setSeriesShapesVisible(i, lineRenderer.getBaseShapesVisible()); }//from ww w . ja v a 2 s . c om } line3DRenderer.setXOffset(2); line3DRenderer.setYOffset(2); line3DRenderer.setWallPaint(ChartThemesConstants.GRAY_PAINT_134); xyPlot.setRenderer(line3DRenderer); return jfreeChart; }
From source file:business.ImageManager.java
public ImageIcon getArrow(double angle) { BufferedImage img = new BufferedImage(40, 40, BufferedImage.TRANSLUCENT); Graphics2D big = img.createGraphics(); //setup para os rastros big.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); big.setStroke(//from w w w .j a va2s . c o m new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f, new float[] { 5f }, 0f)); big.setColor(Color.red); int cx = this.getYellowBall().getIconWidth() / 2; int cy = this.getYellowBall().getIconHeight() / 2; AffineTransform at = AffineTransform.getTranslateInstance(cx, cy); at.rotate(Math.toRadians(angle)); // at.scale(2.0, 2.0); Shape shape = at.createTransformedShape(createArrow()); big.setPaint(Color.red); big.draw(shape); ImageIcon ret = new ImageIcon(img); return (ret); // tenta com o icone...angle. }