List of usage examples for org.jfree.chart.plot DefaultDrawingSupplier DEFAULT_PAINT_SEQUENCE
Paint[] DEFAULT_PAINT_SEQUENCE
To view the source code for org.jfree.chart.plot DefaultDrawingSupplier DEFAULT_PAINT_SEQUENCE.
Click Source Link
From source file:net.sourceforge.processdash.ui.web.reports.DashboardChartDefaults.java
public static void initialize() { // install the legacy theme for chart colors ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); // turn off shadows on bar charts by default BarRenderer.setDefaultShadowsVisible(false); XYBarRenderer.setDefaultShadowsVisible(false); // the standard set of colors includes yellow, which is nearly // impossible to see on a white background. Replace those yellows with // variations on orange. DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[3] = Color.orange; DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[18] = new Color(215, 170, 0); DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[31] = new Color(255, 200, 128); }
From source file:org.tsho.dmc2.core.chart.Bifurcation2DRenderer.java
public void render(final Graphics2D g2, final Rectangle2D dataArea, final PlotRenderingInfo info) { int numVar = model.getNVar(); if (model instanceof ODE) { boolean pointBeyondPoincareSection; ValueAxis domainAxis = plot.getDomainAxis(); ValueAxis rangeAxis = plot.getRangeAxis(); int dim = initialValue.length; final int colorArrayLen = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length; final Paint[] colorArray = new Color[colorArrayLen]; for (int i = 0; i < colorArrayLen; i++) { colorArray[i] = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i]; }//from w w w. java 2 s . c o m double[] fPars = new double[fixedParameters.length]; System.arraycopy(fixedParameters, 0, fPars, 0, fixedParameters.length); double[] initVars = new double[initialValue.length]; System.arraycopy(initialValue, 0, initVars, 0, initialValue.length); double[] result = new double[dim]; double[][] periodArray = new double[period][dim]; for (double i = dataArea.getMinX(); i <= dataArea.getMaxX(); i += 1) { fPars[firstParameterIdx] = domainAxis.java2DToValue(i, dataArea, RectangleEdge.BOTTOM); for (double j = dataArea.getMinY(); j < dataArea.getMaxY(); j += 1) { fPars[secondParameterIdx] = rangeAxis.java2DToValue(j, dataArea, RectangleEdge.LEFT); stepper.setParameters(fPars); stepper.setInitialValue(initVars); stepper.initialize(); stepper.step(); stepper.getCurrentValue(result); int h = 0; int transX, transY; double[] currentPoint = new double[numVar]; double[] previousPoint = new double[numVar]; stepper.getCurrentValue(currentPoint); stepper.getCurrentValue(previousPoint); pointBeyondPoincareSection = positionWrtPoincareSection(currentPoint); Paint color = Color.white; double[] cycleStartPoint = new double[numVar]; int actualPeriod = period + 1; for (int jj = 0; jj < time / step; jj++) { stepper.step(); stepper.getCurrentValue(currentPoint); if (positionWrtPoincareSection(currentPoint) == pointBeyondPoincareSection) { stepper.getCurrentValue(previousPoint); continue; } pointBeyondPoincareSection = !pointBeyondPoincareSection; double[] pointOnSection = pointOnPoincareSection(previousPoint, currentPoint); stepper.setInitialValue(pointOnSection); stepper.initialize(); stepper.getCurrentValue(currentPoint); stepper.getCurrentValue(previousPoint); h++; if (h == transients) { for (int kk = 0; kk < numVar; kk++) cycleStartPoint[kk] = currentPoint[kk]; } if (h > transients) { if (distance(currentPoint, cycleStartPoint) < epsilon) { actualPeriod = h - transients; break; } if (h >= transients + period) break; } } stepper.getCurrentValue(result); for (h = 0; h < dim; h++) { if (Math.abs(result[h]) > infinity || Double.isNaN(result[h])) { color = Color.black; // black == infinity } } if (stopped) { state = STATE_STOPPED; return; } if (actualPeriod <= period) { // found period color = colorArray[actualPeriod - 1]; } g2.setPaint(color); g2.drawRect((int) i, (int) j, 1, 1); if (stopped) { state = STATE_STOPPED; return; } } } state = STATE_FINISHED; } else { ValueAxis domainAxis = plot.getDomainAxis(); ValueAxis rangeAxis = plot.getRangeAxis(); int dim = initialValue.length; final int colorArrayLen = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length; final Paint[] colorArray = new Color[colorArrayLen]; for (int i = 0; i < colorArrayLen; i++) { colorArray[i] = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i]; } double[] fPars = new double[fixedParameters.length]; System.arraycopy(fixedParameters, 0, fPars, 0, fixedParameters.length); double[] initVars = new double[initialValue.length]; System.arraycopy(initialValue, 0, initVars, 0, initialValue.length); double[] result = new double[dim]; double[][] periodArray = new double[period + 1][dim]; for (double i = dataArea.getMinX(); i <= dataArea.getMaxX(); i += 1) { fPars[firstParameterIdx] = domainAxis.java2DToValue(i, dataArea, RectangleEdge.BOTTOM); for (double j = dataArea.getMinY(); j < dataArea.getMaxY(); j += 1) { fPars[secondParameterIdx] = rangeAxis.java2DToValue(j, dataArea, RectangleEdge.LEFT); stepper.setParameters(fPars); stepper.setInitialValue(initVars); stepper.initialize(); stepper.step(); stepper.getCurrentValue(result); for (int h = 1; h < transients; h++) { if (stopped) { state = STATE_STOPPED; return; } stepper.step(); } stepper.getCurrentValue(result); Paint color = Color.white; // white == longer period for (int h = 0; h < dim; h++) { if (Math.abs(result[h]) > infinity || Double.isNaN(result[h])) { color = Color.black; // black == infinity break; } } if (color != Color.black) { // get maxPeriod next values for (int h = 0; h <= period; h++) { if (stopped) { state = STATE_STOPPED; return; } stepper.step(); stepper.getCurrentValue(result); for (int k = 0; k < dim; k++) { periodArray[h][k] = result[k]; } } int h, k = -1; for (h = 1; h <= period; h++) { for (k = 0; k < dim; k++) { if (Math.abs(periodArray[0][k] - periodArray[h][k]) >= epsilon) { break; } } if (k == dim) { break; } } if (h <= period) { // found period color = colorArray[h - 1]; } } g2.setPaint(color); g2.drawRect((int) i, (int) j, 1, 1); if (stopped) { state = STATE_STOPPED; return; } } } state = STATE_FINISHED; } }
From source file:net.sourceforge.processdash.ui.lib.chart.DrawingSupplierFactory.java
public DrawingSupplierFactory() { this.paintSequence = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE; this.fillPaintSequence = DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE; this.outlinePaintSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE; this.strokeSequence = DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE; this.outlineStrokeSequence = DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE; this.shapeSequence = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE; }
From source file:org.matsim.contrib.dvrp.util.chart.RouteChartUtils.java
public static JFreeChart chartRoutesByStatus(List<? extends Vehicle> vehicles) { CoordDataset nData = new CoordDataset(); for (int i = 0; i < vehicles.size(); i++) { Schedule<?> schedule = vehicles.get(i).getSchedule(); Map<TaskStatus, CoordSource> vsByStatus = createLinkSourceByStatus(schedule); nData.addSeries(i + "-PR", vsByStatus.get(TaskStatus.PERFORMED)); nData.addSeries(i + "-ST", vsByStatus.get(TaskStatus.STARTED)); nData.addSeries(i + "-PL", vsByStatus.get(TaskStatus.PLANNED)); }/*from www . ja va2 s . com*/ JFreeChart chart = ChartFactory.createXYLineChart("Routes", "X", "Y", nData, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(Color.white); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesItemLabelsVisible(0, true); renderer.setBaseItemLabelGenerator(new LabelGenerator()); Paint[] paints = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE; Shape[] shapes = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE; for (int i = 0; i < vehicles.size(); i++) { int s = 3 * i; renderer.setSeriesItemLabelsVisible(s + 1, true); renderer.setSeriesItemLabelsVisible(s + 2, true); renderer.setSeriesItemLabelsVisible(s + 3, true); renderer.setSeriesShapesVisible(s + 1, true); renderer.setSeriesShapesVisible(s + 2, true); renderer.setSeriesShapesVisible(s + 3, true); renderer.setSeriesLinesVisible(s + 1, true); renderer.setSeriesLinesVisible(s + 2, true); renderer.setSeriesLinesVisible(s + 3, true); renderer.setSeriesPaint(s + 1, paints[(i + 1) % paints.length]); renderer.setSeriesPaint(s + 2, paints[(i + 1) % paints.length]); renderer.setSeriesPaint(s + 3, paints[(i + 1) % paints.length]); renderer.setSeriesShape(s + 1, shapes[(i + 1) % shapes.length]); renderer.setSeriesShape(s + 2, shapes[(i + 1) % shapes.length]); renderer.setSeriesShape(s + 3, shapes[(i + 1) % shapes.length]); renderer.setSeriesStroke(s + 2, new BasicStroke(3)); renderer.setSeriesStroke(s + 3, new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1, new float[] { 5f, 5f }, 0)); } return chart; }
From source file:org.tsho.dmc2.ui.bifurcation.BifurcationControlForm2.java
public BifurcationControlForm2(final Model model, AbstractPlotComponent frame) { super(frame); setOpaque(true);/*from ww w . j a va 2 s. c o m*/ this.model = model; type = TYPE_DOUBLE; parFields = FormHelper.createFields(model.getParNames(), "parameter"); varFields = FormHelper.createFields(model.getVarNames(), "initial value"); box1 = new JComboBox(model.getParNames()); box2 = new JComboBox(model.getParNames()); MyListener myListener = new MyListener(); box1.addItemListener(myListener); box2.addItemListener(myListener); transientsField = new GetInt("transients", FormHelper.FIELD_LENGTH, new Range(0, Integer.MAX_VALUE)); iterationsField = new GetInt("iterations", FormHelper.FIELD_LENGTH, new Range(1, Integer.MAX_VALUE)); periodField = new GetInt("maximal period", FormHelper.FIELD_LENGTH, new Range(0, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length)); epsilonField = new GetFloat("epsilon", FormHelper.FIELD_LENGTH, new Range(0, Double.MAX_VALUE)); infinityField = new GetFloat("infinity", FormHelper.FIELD_LENGTH, new Range(0, Double.MAX_VALUE)); lFirstParRange = new GetFloat("first parameter lower value", FormHelper.FIELD_LENGTH); uFirstParRange = new GetFloat("first parameter upper value", FormHelper.FIELD_LENGTH); lSecondParRange = new GetFloat("second parameter upper value", FormHelper.FIELD_LENGTH); uSecondParRange = new GetFloat("second parameter upper value", FormHelper.FIELD_LENGTH); lowerVRangeField = new GetFloat("lower vertical range", FormHelper.FIELD_LENGTH); upperVRangeField = new GetFloat("upper vertical range", FormHelper.FIELD_LENGTH); verticalBox = new JComboBox(model.getVarNames()); timeField = new GetFloat("time", FormHelper.FIELD_LENGTH); stepField = new GetFloat("step", FormHelper.FIELD_LENGTH); hyperplaneCoeffField = new GetVector("hyperplane coefficients", model.getNVar() + 1); FormLayout layout = new FormLayout("f:p:n", ""); setLayout(layout); layout.appendRow(new RowSpec("f:p:n")); add(createPanel(), new CellConstraints(1, 1)); if (model.getNPar() >= 2) { box1.setSelectedIndex(0); box2.setSelectedIndex(1); item1 = (String) box1.getSelectedItem(); item2 = (String) box2.getSelectedItem(); } }
From source file:org.matsim.contrib.dvrp.util.chart.RouteCharts.java
public static JFreeChart chartRoutesByStatus(List<? extends Vehicle> vehicles) { CoordDataset nData = new CoordDataset(); for (int i = 0; i < vehicles.size(); i++) { Schedule schedule = vehicles.get(i).getSchedule(); Map<TaskStatus, CoordSource> vsByStatus = createLinkSourceByStatus(schedule); nData.addSeries(i + "-PR", vsByStatus.get(TaskStatus.PERFORMED)); nData.addSeries(i + "-ST", vsByStatus.get(TaskStatus.STARTED)); nData.addSeries(i + "-PL", vsByStatus.get(TaskStatus.PLANNED)); }//from w ww . j a v a 2 s.com JFreeChart chart = ChartFactory.createXYLineChart("Routes", "X", "Y", nData, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(Color.white); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesItemLabelsVisible(0, true); renderer.setBaseItemLabelGenerator(new LabelGenerator()); Paint[] paints = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE; Shape[] shapes = DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE; for (int i = 0; i < vehicles.size(); i++) { int s = 3 * i; renderer.setSeriesItemLabelsVisible(s + 1, true); renderer.setSeriesItemLabelsVisible(s + 2, true); renderer.setSeriesItemLabelsVisible(s + 3, true); renderer.setSeriesShapesVisible(s + 1, true); renderer.setSeriesShapesVisible(s + 2, true); renderer.setSeriesShapesVisible(s + 3, true); renderer.setSeriesLinesVisible(s + 1, true); renderer.setSeriesLinesVisible(s + 2, true); renderer.setSeriesLinesVisible(s + 3, true); renderer.setSeriesPaint(s + 1, paints[(i + 1) % paints.length]); renderer.setSeriesPaint(s + 2, paints[(i + 1) % paints.length]); renderer.setSeriesPaint(s + 3, paints[(i + 1) % paints.length]); renderer.setSeriesShape(s + 1, shapes[(i + 1) % shapes.length]); renderer.setSeriesShape(s + 2, shapes[(i + 1) % shapes.length]); renderer.setSeriesShape(s + 3, shapes[(i + 1) % shapes.length]); renderer.setSeriesStroke(s + 2, new BasicStroke(3)); renderer.setSeriesStroke(s + 3, new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1, new float[] { 5f, 5f }, 0)); } return chart; }
From source file:com.fr3ts0n.ecu.gui.application.ObdDataPlotter.java
/** * add a new series to the graph/*from w w w . ja va2s . c om*/ * * @param series The new series to be added */ public synchronized void addSeries(TimeSeries series) { if (oneRangePerSeries) { // get paint for current axis/range/... Paint currPaint = DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[raIndex % DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length]; XYPlot plot = (XYPlot) chart.getPlot(); // set dataset plot.setDataset(raIndex, new TimeSeriesCollection(series)); // ** set axis NumberAxis axis = new NumberAxis(); axis.setTickLabelFont(legendFont); axis.setAxisLinePaint(currPaint); axis.setTickLabelPaint(currPaint); axis.setTickMarkPaint(currPaint); // ** set axis in plot plot.setRangeAxis(raIndex, axis); plot.setRangeAxisLocation(raIndex, raIndex % 2 == 0 ? AxisLocation.TOP_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT); plot.mapDatasetToRangeAxis(raIndex, raIndex); // ** create renderer XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); renderer.setBaseToolTipGenerator(toolTipGen); renderer.setSeriesPaint(0, currPaint); // ** set renderer in plot plot.setRenderer(raIndex, renderer); raIndex++; } dataset.addSeries(series); }
From source file:com.sun.japex.report.ChartGenerator.java
static protected void configureLineChart(JFreeChart chart) { CategoryPlot plot = chart.getCategoryPlot(); final DrawingSupplier supplier = new DefaultDrawingSupplier(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, // Draw a small diamond new Shape[] { new Polygon(new int[] { 3, 0, -3, 0 }, new int[] { 0, 3, 0, -3 }, 4) }); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDrawingSupplier(supplier);//from ww w .j a v a 2s.c o m LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setStroke(new BasicStroke(2.0f)); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); }
From source file:org.jfree.chart.demo.LineChartDemo5.java
/** * Creates a sample chart.//from w ww . ja v a 2 s.c o m * * @param dataset the dataset. * * @return a chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createLineChart("Line Chart Demo 5", // chart title "Type", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); final Shape[] shapes = new Shape[3]; int[] xpoints; int[] ypoints; // right-pointing triangle xpoints = new int[] { -3, 3, -3 }; ypoints = new int[] { -3, 0, 3 }; shapes[0] = new Polygon(xpoints, ypoints, 3); // vertical rectangle shapes[1] = new Rectangle2D.Double(-2, -3, 3, 6); // left-pointing triangle xpoints = new int[] { -3, 3, 3 }; ypoints = new int[] { 0, -3, 3 }; shapes[2] = new Polygon(xpoints, ypoints, 3); final DrawingSupplier supplier = new DefaultDrawingSupplier(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, shapes); final CategoryPlot plot = chart.getCategoryPlot(); plot.setDrawingSupplier(supplier); chart.setBackgroundPaint(Color.yellow); // set the stroke for each series... plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); // customise the renderer... final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); // renderer.setDrawShapes(true); renderer.setItemLabelsVisible(true); // renderer.setLabelGenerator(new StandardCategoryLabelGenerator()); // customise the range axis... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setUpperMargin(0.12); return chart; }
From source file:de.uka.aifb.com.systemDynamics.gui.ModelExecutionChartPanel.java
/** * Creates panel.//from w ww . j a va2 s .co m */ private void createPanel() { setLayout(new BorderLayout()); // CENTER: chart ChartPanel chartPanel = new ChartPanel(createChart()); // no context menu chartPanel.setPopupMenu(null); // not zoomable chartPanel.setMouseZoomable(false); add(chartPanel, BorderLayout.CENTER); // LINE_END: series table JPanel tablePanel = new JPanel(new GridBagLayout()); String[] columnNames = { messages.getString("ModelExecutionChartPanel.Table.ColumnNames.ExtraAxis"), messages.getString("ModelExecutionChartPanel.Table.ColumnNames.LevelNode") }; final MyTableModel tableModel = new MyTableModel(columnNames, xySeriesArray.length); for (int i = 0; i < xySeriesArray.length; i++) { tableModel.addEntry((String) xySeriesArray[i].getKey()); } JTable table = new JTable(tableModel); table.setRowSelectionAllowed(false); JScrollPane tableScrollPane = new JScrollPane(table); int width = (int) Math.min(300, table.getPreferredSize().getWidth()); int height = (int) Math.min(200, table.getPreferredSize().getHeight()); tableScrollPane.getViewport().setPreferredSize(new Dimension(width, height)); tableScrollPane.setMaximumSize(tableScrollPane.getViewport().getPreferredSize()); axesButton = new JButton(messages.getString("ModelExecutionChartPanel.AxesButton.Text")); axesButton.setToolTipText(messages.getString("ModelExecutionChartPanel.AxesButton.ToolTipText")); axesButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // create XYSeriesCollections (and renderer) XYSeriesCollection standardData = new XYSeriesCollection(); XYLineAndShapeRenderer standardRenderer = new XYLineAndShapeRenderer(true, false); LinkedList<XYSeriesCollection> extraDataList = new LinkedList<XYSeriesCollection>(); LinkedList<XYLineAndShapeRenderer> extraRendererList = new LinkedList<XYLineAndShapeRenderer>(); for (int i = 0; i < tableModel.getRowCount(); i++) { if (tableModel.getValueAt(i, 0).equals(Boolean.FALSE)) { standardData.addSeries(xySeriesArray[i]); standardRenderer.setSeriesPaint(standardData.getSeriesCount() - 1, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i % DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length]); } else { // extra axis XYSeriesCollection extraData = new XYSeriesCollection(); extraData.addSeries(xySeriesArray[i]); extraDataList.add(extraData); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); extraRendererList.add(renderer); renderer.setSeriesPaint(0, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i % DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length]); } } LinkedList<XYSeriesCollection> dataList = new LinkedList<XYSeriesCollection>(); LinkedList<XYLineAndShapeRenderer> rendererList = new LinkedList<XYLineAndShapeRenderer>(); if (!standardData.getSeries().isEmpty()) { dataList.add(standardData); rendererList.add(standardRenderer); } for (XYSeriesCollection data : extraDataList) { dataList.add(data); } for (XYLineAndShapeRenderer renderer : extraRendererList) { rendererList.add(renderer); } // creates axes LinkedList<NumberAxis> axesList = new LinkedList<NumberAxis>(); if (!standardData.getSeries().isEmpty()) { NumberAxis axis = new NumberAxis(messages.getString("ModelExecutionChartPanel.Value")); axis.setNumberFormatOverride(NumberFormat.getInstance(locale)); axesList.add(axis); } for (XYSeriesCollection data : extraDataList) { NumberAxis axis = new NumberAxis((String) data.getSeries(0).getKey()); axis.setNumberFormatOverride(NumberFormat.getInstance(locale)); axesList.add(axis); } // store data and axes in plot XYPlot plot = chart.getXYPlot(); plot.clearRangeAxes(); plot.setRangeAxes(axesList.toArray(new NumberAxis[0])); for (int i = 0; i < plot.getDatasetCount(); i++) { plot.setDataset(i, null); } int datasetIndex = 0; Iterator<XYSeriesCollection> datasetIterator = dataList.iterator(); Iterator<XYLineAndShapeRenderer> rendererIterator = rendererList.iterator(); while (datasetIterator.hasNext()) { plot.setDataset(datasetIndex, datasetIterator.next()); plot.setRenderer(datasetIndex, rendererIterator.next()); datasetIndex++; } for (int i = 0; i < plot.getDatasetCount(); i++) { plot.mapDatasetToRangeAxis(i, i); } } }); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 0; c.insets = new Insets(0, 0, 10, 0); tablePanel.add(tableScrollPane, c); c.gridx = 0; c.gridy = 1; tablePanel.add(axesButton, c); add(tablePanel, BorderLayout.LINE_END); // PAGE_END: number of rounds and execution button JPanel commandPanel = new JPanel(); commandPanel.add(new JLabel(messages.getString("ModelExecutionChartPanel.NumberRounds"))); final JTextField numberRoundsField = new JTextField("1", 5); numberRoundsField.addFocusListener(this); commandPanel.add(numberRoundsField); executionButton = new JButton(messages.getString("ModelExecutionChartPanel.ExecutionButton.Text")); executionButton.setToolTipText(messages.getString("ModelExecutionChartPanel.ExecutionButton.ToolTipText")); executionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int numberRounds = 0; boolean correctNumber = false; try { numberRounds = integerNumberFormatter.parse(numberRoundsField.getText()).intValue(); } catch (ParseException parseExcep) { // do nothing } if (numberRounds >= 1) { correctNumber = true; } if (correctNumber) { ModelExecutionThread executionThread = new ModelExecutionThread(numberRounds); executionThread.start(); } else { JOptionPane.showMessageDialog(null, messages.getString("ModelExecutionChartPanel.Error.Message"), messages.getString("ModelExecutionChartPanel.Error.Title"), JOptionPane.ERROR_MESSAGE); } } }); commandPanel.add(executionButton); add(commandPanel, BorderLayout.PAGE_END); }