List of usage examples for java.awt BasicStroke JOIN_ROUND
int JOIN_ROUND
To view the source code for java.awt BasicStroke JOIN_ROUND.
Click Source Link
From source file:view.FuzzySetView.java
/** * */// w w w .j a v a2s. c om public void showFuzzyValues() { clearMarkers(); BasicStroke dashedStroke = new BasicStroke(1.7f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 6f, new float[] { 6f }, 0); double crispValue = 0; FuzzySet fuzzySet = getFuzzySet(); for (int i = 0; i < fuzzySet.getMembershipValuesLength(); i++) { MembershipValue value = fuzzySet.getMembershipValueAt(i); if (value != null) { ValueMarker marker = new ValueMarker(value.getValue(), colors[i], dashedStroke); plot.addRangeMarker(marker); crispValue = value.getCrispValue(); } } plot.addDomainMarker(new ValueMarker(crispValue, Color.BLACK, dashedStroke)); }
From source file:org.fhaes.jsea.JSEABarChart.java
/** * Creates a demo chart./* www . j ava2 s. c om*/ * * @return A chart. */ @SuppressWarnings("deprecation") public static JFreeChart createChart(String title, double[] meanByWindow, int lengthOfWindow, int yearsPriorOfEvent, int yearsAfterEvent, double[][] leftEndPointSim, double[][] rightEndPointSim, String outputFilePrefix, int alphaLevel, int segmentIndex) { JSEABarChart.meanByWindow = meanByWindow; JSEABarChart.lengthOfWindow = lengthOfWindow; JSEABarChart.yearsPriorOfEvent = yearsPriorOfEvent; JSEABarChart.leftEndPointSim = leftEndPointSim; JSEABarChart.rightEndPointSim = rightEndPointSim; JSEABarChart.alphaLevel = alphaLevel; CategoryPlot plot = new CategoryPlot(); plot.setDataset(0, createDataset()); plot.setOrientation(PlotOrientation.VERTICAL); CustomBarRenderer renderer = new CustomBarRenderer(createPaint(lengthOfWindow, Color.gray)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(false); renderer.setOutlinePaint(Color.yellow); renderer.setOutlineStroke(new BasicStroke(1.1f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL)); renderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL)); plot.setRenderer(0, renderer); Color allcolors[] = { Color.red, Color.green, Color.blue }; System.out.println("here is the alphlevel " + alphaLevel); // for (int k = 0; k <= 5; k++) { // if (k <= 2) { // / plot.setDataset(k + 1, createEndDataset(k, true)); // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k], k)); // } else { // plot.setDataset(k + 1, createEndDataset(k - 3, false)); // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k - 3], k - 3)); // } // } // for (int k = 0; k <1; k++) { // if (k <= 2) { plot.setDataset(1, createEndDataset(alphaLevel, true)); plot.setRenderer(1, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel)); // } else { plot.setDataset(4, createEndDataset(alphaLevel, false)); plot.setRenderer(4, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel)); // } // } plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // plot.setBackgroundPaint(Color.WHITE); plot.setDomainAxis(new CategoryAxis("LAG")); plot.addRangeMarker(new ValueMarker(0)); plot.setRangeAxis(new NumberAxis(outputFilePrefix)); plot.setRangeGridlinesVisible(true); JFreeChart chart = new JFreeChart(plot); chart.setTitle(title); chart.removeLegend(); chart.setBackgroundPaint(Color.WHITE); return chart; }
From source file:application.BrokersMouseListener.java
@Override public void graphClicked(Object arg0, MouseEvent arg1) { //Reset the selected variable for all the broker ListIterator<Broker> it = state.getBrokersList(); while (it.hasNext()) { it.next().resetSelected();// w ww.j a v a 2 s . c o m } Broker broker = (Broker) arg0; //SET the selected variable for THE SPECIFIC broker broker.setSelected(); Transformer<Broker, Paint> vertexPaint = new Transformer<Broker, Paint>() { public Paint transform(Broker b) { if (b.selected()) { return Color.GREEN; } return Color.GRAY; } }; //Reset the selected variable for all the link it = state.getBrokersList(); while (it.hasNext()) { Broker b = it.next(); ListIterator<Interface> intit = b.getInterfaces(); while (intit.hasNext()) { Interface ix = intit.next(); ix.getLink().resetSelected(); } } //SET the selected variable for THE SPECIFIC links it = state.getBrokersList(); while (it.hasNext()) { Broker b = it.next(); ListIterator<Interface> intit = b.getInterfaces(); if (b.equals(broker)) { while (intit.hasNext()) { Interface ix = intit.next(); ix.getLink().setSelected(); } } else { while (intit.hasNext()) { Interface ix = intit.next(); ix.getLink().setSelectedBcastFunction(state.getBrokerPosition(broker)); } } } Transformer<Link, Stroke> edgeStrokeTransformer = new Transformer<Link, Stroke>() { public Stroke transform(Link link) { if (link.selected()) { final Stroke edgeStroke = new BasicStroke(2); return edgeStroke; } else { float[] dot = { 1.0f, 3.0f }; final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, dot, 0f); return edgeStroke; } } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); //((FRLayout)layout).initialize(); //((FRLayout)layout).step(); vv.repaint(); }
From source file:edu.coeia.charts.LineChartPanel.java
/** * Creates a sample chart.// w w w .j a v a 2 s. com * * @param dataset a dataset. * * @return The chart. */ private static JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createLineChart("Frequency of Messages", // chart title "Time of Messages", // domain axis label "Number of Messages", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); // customise the range axis... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); // customise the renderer... final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f)); renderer.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); renderer.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); return chart; }
From source file:fr.ign.cogit.simplu3d.rjmcmc.generic.visitor.StatsVisitor.java
/** * Creates a sample chart.// w ww .ja va2 s . co m * * @param dataset * the dataset. * @return A sample chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createXYLineChart("volution de l'nergie", "Itration", "nergie", dataset, PlotOrientation.VERTICAL, true, true, true); result.setBorderPaint(Color.white); result.setBackgroundPaint(Color.white); final XYPlot plot = result.getXYPlot(); Font font = new Font("Verdana", Font.PLAIN, 32); Font font2 = new Font("Verdana", Font.PLAIN, 28); // axe x ValueAxis axis = plot.getDomainAxis(); axis.setLabelFont(font); axis.setTickLabelFont(font2); axis.setAutoRange(true); // axis.setFixedAutoRange(60000.0); // 60 seconds axis = plot.getRangeAxis(); // axe y ValueAxis axis2 = plot.getRangeAxis(); axis2.setLabelFont(font); axis2.setTickLabelFont(font2); axis2.setAutoRange(true); // axis.setFixedAutoRange(60000.0); // 60 seconds axis2 = plot.getRangeAxis(); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setBackgroundPaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, new Color(255, 0, 0)); renderer.setSeriesStroke(0, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(0, font2); renderer.setSeriesPaint(1, new Color(2, 157, 116)); renderer.setSeriesStroke(1, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(1, font2); renderer.setSeriesPaint(2, new Color(112, 147, 219)); renderer.setSeriesStroke(2, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(2, font2); renderer.setSeriesPaint(3, new Color(140, 23, 23)); renderer.setSeriesStroke(3, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); renderer.setLegendTextFont(3, font2); // axis.setRange(0.0, 200.0); return result; }
From source file:com.rapidminer.gui.plotter.charts.DeviationChartPlotter.java
private JFreeChart createChart(XYDataset dataset, boolean createLegend) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, createLegend, // include legend true, // tooltips false // urls );/*from www . ja va 2 s. c om*/ chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customization... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); 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); plot.setRenderer(renderer); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(LABEL_FONT_BOLD); valueAxis.setTickLabelFont(LABEL_FONT); return chart; }
From source file:org.encog.workbench.tabs.rbf.RadialBasisFunctionsTab.java
public JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart(null, "input (x)", "output (y)", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainPannable(true);/*from www . j a v a 2s . co m*/ plot.setRangePannable(true); ValueAxis xAxis = plot.getDomainAxis(); xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer(); r.setDrawSeriesLineAsPath(true); r.setSeriesStroke(0, new BasicStroke(1.5f)); r.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 4.0f }, 0.0f)); r.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 4.0f, 3.0f, 3.0f }, 0.0f)); r.setSeriesStroke(3, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 4.0f, 4.0f }, 0.0f)); return chart; }
From source file:com.rapidminer.gui.viewer.ROCChartPlotter.java
private JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/* w w w .j av a 2s. c o m*/ chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); 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 if (dataset.getSeriesCount() == 2) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); renderer.setSeriesStroke(1, stroke); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesFillPaint(1, Color.BLUE); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(PlotterAdapter.LABEL_FONT); } return chart; }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.time.SurefirePercentAxisDecorator.java
/** * */// ww w .ja va2 s . com public void createChart() { XYPlot xyplot = (XYPlot) report.getPlot(); if (this.decoratedChart instanceof TimeChartRenderer && this.results != null && !this.results.isEmpty()) { Iterator iter = this.results.iterator(); TimeSeriesCollection defaultdataset = new TimeSeriesCollection(); TimeSeries s1 = new TimeSeries("% success", Day.class); while (iter.hasNext()) { SurefireReportBean surefire = (SurefireReportBean) iter.next(); Date date = surefire.getDateGeneration(); s1.addOrUpdate(new Day(TimePeriod.DAY.normalize(date)), surefire.getSucessRate() / PCENT); } defaultdataset.addSeries(s1); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setSeriesPaint(0, ChartColor.DARK_BLUE); renderer.setBaseShapesVisible(true); renderer.setDrawOutlines(true); StandardXYItemLabelGenerator labelgenerator = new StandardXYItemLabelGenerator( StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT, TimePeriod.DAY.getDateFormat(), NumberFormat.getPercentInstance(Locale.getDefault())); renderer.setBaseItemLabelGenerator(labelgenerator); renderer.setBaseItemLabelFont(new Font("SansSerif", Font.BOLD, ITEM_LABEL_FONT_SIZE)); renderer.setBaseItemLabelsVisible(true); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE10, TextAnchor.BASELINE_RIGHT)); renderer.setBaseStroke(new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); LegendTitle legendtitle = new LegendTitle(xyplot.getRenderer(0)); legendtitle.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendtitle.setFrame(new BlockBorder()); legendtitle.setBackgroundPaint(ChartColor.WHITE); LegendTitle legendtitle1 = new LegendTitle(renderer); legendtitle1.setMargin(new RectangleInsets(2D, 2D, 2D, 2D)); legendtitle1.setFrame(new BlockBorder()); legendtitle1.setBackgroundPaint(ChartColor.WHITE); BlockContainer blockcontainer = new BlockContainer(new BorderArrangement()); blockcontainer.add(legendtitle, RectangleEdge.LEFT); blockcontainer.add(legendtitle1, RectangleEdge.RIGHT); blockcontainer.add(new EmptyBlock(BLOCK_CONTAINER_WIDTH, 0.0D)); CompositeTitle compositetitle = new CompositeTitle(blockcontainer); compositetitle.setPosition(RectangleEdge.BOTTOM); report.clearSubtitles(); report.addSubtitle(compositetitle); xyplot.setDataset(1, defaultdataset); NumberAxis valueaxis = new NumberAxis("% success"); valueaxis.setLowerMargin(0.0D); valueaxis.setUpperMargin(AXIS_UPPER_MARGIN); valueaxis.setRangeWithMargins(0.0D, 1.0D); valueaxis.setNumberFormatOverride(NumberFormat.getPercentInstance()); xyplot.setRangeAxis(1, valueaxis); xyplot.mapDatasetToRangeAxis(1, 1); xyplot.setRenderer(1, renderer); } }
From source file:playground.artemc.socialCost.SocialCostWriter.java
private ChartUtil getGraphic(String yAxisTitle, double[] meanData, double[] medianData, double[] quantil25Data, double[] quantil75Data) { double[] iterations = new double[iteration + 1]; for (int i = 0; i <= iteration; i++) { iterations[i] = i;/* ww w . j av a2 s . com*/ } XYLineChart chart = new XYLineChart("Social Costs", "iteration", yAxisTitle); chart.addSeries("mean", iterations, meanData); chart.addSeries("median", iterations, medianData); chart.addSeries("25% quantil", iterations, quantil25Data); chart.addSeries("75% qunatil", iterations, quantil75Data); XYPlot plot = chart.getChart().getXYPlot(); plot.getRenderer().setSeriesPaint(0, Color.red); plot.getRenderer().setSeriesPaint(1, Color.blue); plot.getRenderer().setSeriesPaint(2, Color.blue); plot.getRenderer().setSeriesPaint(3, Color.blue); plot.getRenderer().setSeriesStroke(2, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 8.0f, 4.0f }, 0.0f)); plot.getRenderer().setSeriesStroke(3, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 4.0f }, 0.0f)); chart.addMatsimLogo(); return chart; }