List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection
public XYSeriesCollection()
From source file:org.matsim.counts.algorithms.graphs.CountsSimReal24Graph.java
@Override public JFreeChart createChart(final int nbr) { XYSeriesCollection dataset0 = new XYSeriesCollection(); XYSeries series = new XYSeries("MATSim volumes"); // easier to use another dataset XYSeriesCollection dataset_outliers = new XYSeriesCollection(); XYSeries series_outliers = new XYSeries("MATSim outliers"); CustomXYURLGenerator url_gen = new CustomXYURLGenerator(); CustomXYToolTipGenerator tt_gen = new CustomXYToolTipGenerator(); final ArrayList<String> urls = new ArrayList<>(); final ArrayList<String> tooltips = new ArrayList<>(); List<Comp> comps = new Vector<>(); //-------------------- CountSimComparisonLinkFilter linkFilter = new CountSimComparisonLinkFilter(this.ccl_); final Vector<Id<Link>> linkIds = new CountSimComparisonLinkFilter(this.ccl_).getLinkIds(); Iterator<Id<Link>> id_it = linkIds.iterator(); double maxCountValue = 0.1; double maxSimValue = 0.1; // yyyy PtCountsKMLWriterTest.testPtAlightKMLCreation never touches these and then leads to an exception later // when they are zero. Don't know why. kai, sep'16 while (id_it.hasNext()) { Id<Link> id = id_it.next(); double countVal = linkFilter.getAggregatedCountValue(id); double simVal = linkFilter.getAggregatedSimValue(id); if (countVal > 100.0 && simVal > 100.0) { if (countVal > maxCountValue) maxCountValue = countVal; if (simVal > maxSimValue) maxSimValue = simVal;/*from w w w .j a v a 2 s. co m*/ series.add(countVal, simVal); comps.add(new Comp(countVal, "link" + id + ".html", "Link " + id + "; " + "Count: " + countVal + ", Sim: " + simVal)); } else { /* values with simVal<100.0 or countVal<100.0 are drawn on the x==100 or/and y==100-line */ countVal = Math.max(100.0, countVal); simVal = Math.max(100.0, simVal); series_outliers.add(countVal, simVal); if (countVal > maxCountValue) maxCountValue = countVal; if (simVal > maxSimValue) maxSimValue = simVal; } } //while dataset0.addSeries(series); dataset_outliers.addSeries(series_outliers); Collections.sort(comps, new MyComparator()); for (Iterator<Comp> iter = comps.iterator(); iter.hasNext();) { Comp cp = iter.next(); urls.add(cp.getURL()); tooltips.add(cp.getTooltip()); } url_gen.addURLSeries(urls); tt_gen.addToolTipSeries(tooltips); String title = "Avg. Weekday Traffic Volumes, Iteration: " + this.iteration_; this.setChartTitle(title); this.chart_ = ChartFactory.createXYLineChart(title, "Count Volumes", // x axis label "Sim Volumes", // y axis label dataset0, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips true // urls ); XYPlot plot = this.chart_.getXYPlot(); final LogarithmicAxis axis_x = new LogarithmicAxis("Count Volumes [veh/24h]"); final LogarithmicAxis axis_y = new LogarithmicAxis("Sim Volumes [veh/24h]"); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); //regular values XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setLinesVisible(false); renderer.setURLGenerator(url_gen); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesToolTipGenerator(0, tt_gen); renderer.setSeriesShape(0, new Rectangle2D.Double(-1.5, -1.5, 3.0, 3.0)); //outliers XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setLinesVisible(false); renderer2.setSeriesPaint(0, Color.red); renderer2.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0)); // error band DefaultXYDataset dataset1 = new DefaultXYDataset(); Gbl.assertIf(maxCountValue > 0.); dataset1.addSeries("f1x", new double[][] { { 100.0, maxCountValue }, { 100.0, maxCountValue } }); dataset1.addSeries("f2x", new double[][] { { 100.0, maxCountValue }, { 200.0, 2 * maxCountValue } }); dataset1.addSeries("f05x", new double[][] { { 200.0, maxCountValue }, { 100.0, 0.5 * maxCountValue } }); XYLineAndShapeRenderer renderer3 = new XYLineAndShapeRenderer(); renderer3.setShapesVisible(false); renderer3.setSeriesPaint(0, Color.blue); renderer3.setSeriesPaint(1, Color.blue); renderer3.setSeriesPaint(2, Color.blue); renderer3.setBaseSeriesVisibleInLegend(false); renderer3.setSeriesItemLabelsVisible(0, true); renderer3.setSeriesItemLabelsVisible(1, false); renderer3.setSeriesItemLabelsVisible(2, false); XYTextAnnotation annotation0 = new XYTextAnnotation("2.0 count", maxCountValue, 2 * maxCountValue); annotation0.setFont(new Font("SansSerif", Font.BOLD, 11)); plot.addAnnotation(annotation0); XYTextAnnotation annotation1 = new XYTextAnnotation("count", maxCountValue, maxCountValue); annotation1.setFont(new Font("SansSerif", Font.BOLD, 11)); plot.addAnnotation(annotation1); XYTextAnnotation annotation2 = new XYTextAnnotation("0.5 count", maxCountValue, 0.5 * maxCountValue); annotation2.setFont(new Font("SansSerif", Font.BOLD, 11)); plot.addAnnotation(annotation2); plot.setDomainAxis(axis_x); plot.setRangeAxis(axis_y); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer2); plot.setDataset(1, dataset_outliers); plot.setRenderer(2, renderer3); plot.setDataset(2, dataset1); //plot.getRangeAxis().setRange(1.0, 19000.0); //plot.getDomainAxis().setRange(1.0, 19000.0); return this.chart_; }
From source file:iad_2_gg.gui.ChartDialog.java
private XYDataset createDataset(List<Double> values, String name, int interval) { XYSeries serie = new XYSeries(name); int i = 1;/*from ww w .j a va2s .c o m*/ for (double v : values) { serie.add((i * interval), v); i++; } XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(serie); return data; }
From source file:edu.wustl.cab2b.client.ui.visualization.charts.LineChart.java
@Override protected Dataset createRowWiseData() { List<String> selectedColumnNames = chartModel.getSelectedColumnsNames(); List<String> selectedRowNames = chartModel.getSelectedRowNames(); XYSeries xySeries = null;// w ww . jav a 2 s . c o m XYSeriesCollection xySeriesCollection = new XYSeriesCollection(); for (int i = 0; i < selectedRowNames.size(); i++) { String seriesName = selectedRowNames.get(i) + ""; xySeries = new XYSeries(seriesName); for (int j = 0; j < selectedColumnNames.size(); j++) { Object value = chartModel.getValueAt(i, j); xySeries.add(convertValue(selectedColumnNames.get(j)), convertValue(value)); } xySeriesCollection.addSeries(xySeries); } return xySeriesCollection; }
From source file:org.matsim.counts.algorithms.graphs.CountsSimRealPerHourGraph.java
/** * @param hour A value in 1..24, 1 for 0 a.m. to 1 a.m., 2 for 1 a.m. to 2 a.m. ... *///from w w w . j a v a2 s .c o m @Override public JFreeChart createChart(final int hour) { this.hour = hour; XYSeriesCollection dataset0 = new XYSeriesCollection(); XYSeries series = new XYSeries("MATSim volumes"); // easier to use another dataset XYSeriesCollection dataset_outliers = new XYSeriesCollection(); XYSeries series_outliers = new XYSeries("MATSim outliers"); CustomXYURLGenerator url_gen = new CustomXYURLGenerator(); CustomXYToolTipGenerator tt_gen = new CustomXYToolTipGenerator(); final ArrayList<String> urls = new ArrayList<String>(); final ArrayList<String> tooltips = new ArrayList<String>(); List<Comp> comps = new Vector<Comp>(); Iterator<CountSimComparison> l_it = this.ccl_.iterator(); //int elementCounter=0; while (l_it.hasNext()) { CountSimComparison cc = l_it.next(); /* values with simVal==0.0 or countVal==0.0 are drawn on the x==1 or/and y==1-line * Such values are the result of a poor simulation run, but they can also represent * a valid result (closing summer road during winter time) * */ if (cc.getHour() == hour) { //elementCounter++; double realVal = 1.0; double simVal = 1.0; if (cc.getCountValue() > 0.0 && cc.getSimulationValue() > 0.0) { realVal = cc.getCountValue(); simVal = cc.getSimulationValue(); series.add(realVal, simVal); comps.add(new Comp(realVal, "link" + cc.getId() + ".html", "Link " + cc.getId() + "; " + "Count: " + realVal + ", Sim: " + simVal)); } else { realVal = Math.max(1.0, cc.getCountValue()); simVal = Math.max(1.0, cc.getSimulationValue()); series_outliers.add(realVal, simVal); } } //if } //while dataset0.addSeries(series); dataset_outliers.addSeries(series_outliers); /* first we have to sort the vector according to the rendering ordering * (which is the x value). * REALLY??? After hours of searching no better solution found! * please help! */ Collections.sort(comps, new MyComparator()); for (Iterator<Comp> iter = comps.iterator(); iter.hasNext();) { Comp cp = iter.next(); urls.add(cp.getURL()); tooltips.add(cp.getTooltip()); } url_gen.addURLSeries(urls); tt_gen.addToolTipSeries(tooltips); String title = "Volumes " + (hour - 1) + ":00 - " + (hour) + ":00, Iteration: " + this.iteration_; this.setChartTitle(title); this.chart_ = ChartFactory.createXYLineChart(title, "Count Volumes [veh/h]", // x axis label "Sim Volumes [veh/h]", // y axis label dataset0, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips true // urls ); XYPlot plot = this.chart_.getXYPlot(); final LogarithmicAxis axis_x = new LogarithmicAxis("Count Volumes [veh/h]"); final LogarithmicAxis axis_y = new LogarithmicAxis("Sim Volumes [veh/h]"); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); //regular values XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setLinesVisible(false); renderer.setURLGenerator(url_gen); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesToolTipGenerator(0, tt_gen); renderer.setSeriesShape(0, new Rectangle2D.Double(-1.5, -1.5, 3.0, 3.0)); //outliers XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setLinesVisible(false); renderer2.setSeriesPaint(0, Color.red); renderer2.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0)); // error band DefaultXYDataset dataset1 = new DefaultXYDataset(); dataset1.addSeries("f1x", new double[][] { { 1.0, 10000.0 }, { 1.0, 10000.0 } }); dataset1.addSeries("f2x", new double[][] { { 1.0, 10000.0 }, { 2.0, 20000.0 } }); dataset1.addSeries("f05x", new double[][] { { 2.0, 10000.0 }, { 1.0, 5000.0 } }); XYLineAndShapeRenderer renderer3 = new XYLineAndShapeRenderer(); renderer3.setShapesVisible(false); renderer3.setSeriesPaint(0, Color.blue); renderer3.setSeriesPaint(1, Color.blue); renderer3.setSeriesPaint(2, Color.blue); renderer3.setBaseSeriesVisibleInLegend(false); renderer3.setSeriesItemLabelsVisible(0, true); renderer3.setSeriesItemLabelsVisible(1, false); renderer3.setSeriesItemLabelsVisible(2, false); XYTextAnnotation annotation0 = new XYTextAnnotation("2.0 count", 12000.0, 15500.0); annotation0.setFont(new Font("SansSerif", Font.BOLD, 11)); plot.addAnnotation(annotation0); XYTextAnnotation annotation1 = new XYTextAnnotation("count", 13000.0, 10000.0); annotation1.setFont(new Font("SansSerif", Font.BOLD, 11)); plot.addAnnotation(annotation1); XYTextAnnotation annotation2 = new XYTextAnnotation("0.5 count", 11000.0, 3500.0); annotation2.setFont(new Font("SansSerif", Font.BOLD, 11)); plot.addAnnotation(annotation2); plot.setDomainAxis(axis_x); plot.setRangeAxis(axis_y); plot.setRenderer(0, renderer); plot.setRenderer(1, renderer2); plot.setDataset(1, dataset_outliers); plot.setRenderer(2, renderer3); plot.setDataset(2, dataset1); plot.getRangeAxis().setRange(1.0, 19000.0); plot.getDomainAxis().setRange(1.0, 19000.0); return this.chart_; }
From source file:org.fhcrc.cpl.viewer.gui.SpectrumChartFactory.java
protected static XYPlot createXYPlot(XYDataset dataset, Color[] colors) { // break up into two datasets, one for bars one for lines //LinkedList lines =new LinkedList(); //LinkedList bars = new LinkedList(); XYDataset seriesLines = new XYSeriesCollection(); XYDataset seriesBars = new XYSeriesCollection(); ((XYSeriesCollection) seriesBars).setIntervalWidth(0.0); if (dataset instanceof XYSeriesCollection) { while (0 < dataset.getSeriesCount()) { XYSeries s = ((XYSeriesCollection) dataset).getSeries(0); ((XYSeriesCollection) dataset).removeSeries(0); Comparable key = s.getKey(); boolean lines = false; if (key instanceof String) lines = ((String) key).startsWith("-"); if (lines) ((XYSeriesCollection) seriesLines).addSeries(s); else/*from w ww. j a v a 2 s. co m*/ ((XYSeriesCollection) seriesBars).addSeries(s); } } else { seriesBars = dataset; } NumberAxis axisDomain = new NumberAxis(); axisDomain.setAutoRange(true); axisDomain.setAutoRangeIncludesZero(false); // axisDomain.setRange(400.0, 1600.0); // NOTE: zooming in too far kills the chart, prevent this axisDomain.addChangeListener(new AxisChangeListener() { public void axisChanged(AxisChangeEvent event) { NumberAxis axis = (NumberAxis) event.getSource(); Range range = axis.getRange(); if (range.getLength() < 2.0) { //_log.info("AxisChangeListener " + range.getLength() + " " + range.toString()); double middle = range.getLowerBound() + range.getLength() / 2.0; axis.setRange(new Range(middle - 1.1, middle + 1.1)); } } }); NumberAxis axisRange = new NumberAxis(); axisRange.setAutoRange(true); axisRange.setAutoRangeIncludesZero(true); XYToolTipGenerator toolTipGenerator = new XYToolTipGenerator() { public String generateToolTip(XYDataset xyDataset, int s, int i) { double X = Math.round(xyDataset.getXValue(s, i) * 1000.0) / 1000.0; double Y = Math.round(xyDataset.getYValue(s, i) * 1000.0) / 1000.0; return "(" + X + ", " + Y + ")"; } }; XYBarRenderer barRenderer = new XYBarRenderer(); //dhmay adding 2009/09/14. As of jfree 1.0.13, shadows on by default barRenderer.setShadowVisible(false); //dhmay adding for jfreechart 1.0.6 upgrade. If this isn't here, we get a //nullPointerException in XYBarRenderer.drawItemLabel barRenderer.setBaseItemLabelGenerator(new NullLabelGenerator()); barRenderer.setSeriesItemLabelsVisible(0, true); barRenderer.setBaseToolTipGenerator(toolTipGenerator); XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(); lineRenderer.setBaseToolTipGenerator(toolTipGenerator); XYPlot xy = new XYPlot(null, axisDomain, axisRange, null); int ds = 0; if (seriesLines.getSeriesCount() > 0) { xy.setDataset(ds, seriesLines); xy.setRenderer(ds, lineRenderer); xy.mapDatasetToRangeAxis(ds, 0); ds++; for (int i = 0; i < seriesLines.getSeriesCount(); i++) { Comparable key = ((XYSeriesCollection) seriesLines).getSeriesKey(i); boolean lines = false; if (key instanceof String) lines = ((String) key).startsWith("-"); lineRenderer.setSeriesLinesVisible(i, lines); lineRenderer.setSeriesShapesVisible(i, !lines); } } if (seriesBars.getSeriesCount() > 0) { xy.setDataset(ds, seriesBars); xy.setRenderer(ds, barRenderer); xy.mapDatasetToRangeAxis(ds, 0); ds++; } setColors(xy, colors); return xy; }
From source file:org.gwaspi.gui.qqPlot.java
/** * Runs the test./*from ww w . j a va 2 s .c o m*/ */ public void run() { this.finished = false; List<XYSeries> seriesArray = new ArrayList<XYSeries>(); Random generator = new Random(); int seriesNb = -1; XYSeriesCollection dataSeries = new XYSeriesCollection(); XYSeries seriesData = new XYSeries("X"); XYSeries seriesUpper = new XYSeries("Upper bound"); XYSeries seriesLower = new XYSeries("Lower bound"); int N = 10000; List<Double> rndChiSqrDist1 = org.gwaspi.statistics.Chisquare.getChiSquareDistributionDf1(N, 1.0f); Collections.sort(rndChiSqrDist1); List<Double> rndChiSqrDist2 = org.gwaspi.statistics.Chisquare.getChiSquareDistributionDf1(N, 1.0f); Collections.sort(rndChiSqrDist2); for (int i = 0; i < rndChiSqrDist1.size(); i++) { double obsVal = rndChiSqrDist1.get(i) + (generator.nextDouble() * 0.00001); double expVal = rndChiSqrDist2.get(i); // constant chi-square boundaries // double upperVal = expVal*1.05; // double lowerVal = expVal*0.95; // double upperVal = expVal+Math.pow(Math.E,(1.96*Math.sqrt(1/expVal))); // double lowerVal = expVal-Math.pow(Math.E,(1.96*Math.sqrt(1/expVal))); double upperVal = expVal + 1.96 * Math.sqrt(0.05 * (1 - 0.05 / N)); double lowerVal = expVal - 1.96 * Math.sqrt(0.05 * (1 - 0.05 / N)); seriesData.add(obsVal, expVal); seriesLower.add(expVal, lowerVal); seriesUpper.add(expVal, upperVal); } dataSeries.addSeries(seriesData); dataSeries.addSeries(seriesLower); dataSeries.addSeries(seriesUpper); final XYDataset data = dataSeries; // create a scatter chart... final boolean withLegend = true; JFreeChart chart = ChartFactory.createScatterPlot("QQ-plot", "Obs X", "Exp X", data, PlotOrientation.VERTICAL, withLegend, false, false); final XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.gray); renderer.setSeriesPaint(2, Color.gray); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setSeriesShape(0, new Rectangle2D.Double(-1.0, -1.0, 2.0, 2.0)); renderer.setSeriesShape(1, new Rectangle2D.Double(-2.0, 0.0, 4.0, 0.0)); renderer.setSeriesShape(2, new Rectangle2D.Double(-2.0, 0.0, 4.0, 0.0)); plot.setRenderer(renderer); try { ChartUtilities.saveChartAsPNG(new File(System.getProperty("user.home") + "/Desktop/QQ_plot.png"), chart, 400, 400); } catch (IOException ex) { log.error("Problem occurred creating chart", ex); } }
From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsModeGroupChart.java
@Override protected XYSeriesCollection createDatasets(String runId1, String runId2) { DgModeSwitchPlanTypeAnalyzer modeSwitchAnalysis = new DgModeSwitchPlanTypeAnalyzer(this.ana, runId1, runId2);//from ww w . j av a2 s .c o m DgAnalysisPopulation car2carPop = modeSwitchAnalysis .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.car, TransportMode.car)); DgAnalysisPopulation pt2ptPop = modeSwitchAnalysis .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.pt, TransportMode.pt)); DgAnalysisPopulation pt2carPop = modeSwitchAnalysis .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.pt, TransportMode.car)); DgAnalysisPopulation car2ptPop = modeSwitchAnalysis .getPersonsForModeSwitch(new Tuple<String, String>(TransportMode.car, TransportMode.pt)); XYSeriesCollection ds = new XYSeriesCollection(); ds.addSeries( this.createXYSeries("Mean " + '\u0394' + "Utility Car2Car", car2carPop, runId1, runId2).getFirst()); ds.addSeries( this.createXYSeries("Mean " + '\u0394' + "Utility Pt2Pt", pt2ptPop, runId1, runId2).getFirst()); ds.addSeries( this.createXYSeries("Mean " + '\u0394' + "Utility Pt2Car", pt2carPop, runId1, runId2).getFirst()); ds.addSeries( this.createXYSeries("Mean " + '\u0394' + "Utility Car2Pt", car2ptPop, runId1, runId2).getFirst()); return ds; }
From source file:gov.sandia.umf.platform.ui.jobs.Plot.java
public XYDataset createDataset() { XYSeriesCollection dataset = new XYSeriesCollection(); Column time = columns.get(0); // fallback, in case we don't find it by name int timeMatch = 0; for (Column c : columns) { int potentialMatch = 0; if (c.header.equals("t")) potentialMatch = 1;/*from ww w .j a va 2 s . c o m*/ else if (c.header.equals("TIME")) potentialMatch = 2; else if (c.header.equals("$t")) potentialMatch = 3; if (potentialMatch > timeMatch) { timeMatch = potentialMatch; time = c; } } for (Column c : columns) { if (c == time) continue; if (isXycePRN && c == columns.get(0)) continue; XYSeries series = new XYSeries(c.header); for (int r = 0; r < c.values.size(); r++) { series.add(time.values.get(r + c.startRow), c.values.get(r)); } dataset.addSeries(series); } return dataset; }
From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithLineChart.java
protected void init() { dataset = new XYSeriesCollection(); renderer = new StandardXYItemRenderer(); renderer.setPlotLines(true);/*from w ww .j a v a2 s . c o m*/ renderer.setBaseShapesVisible(false); //set all possible series to the default shape for (int i = 0; i < 10; i++) renderer.setSeriesShape(i, defaultShape); XYToolTipGenerator toolTipGenerator = new XYToolTipGenerator() { public String generateToolTip(XYDataset xyDataset, int s, int i) { double X = Math.round(xyDataset.getXValue(s, i) * 1000.0) / 1000.0; double Y = Math.round(xyDataset.getYValue(s, i) * 1000.0) / 1000.0; return "(" + X + ", " + Y + ")"; } }; //dhmay adding for jfreechart 1.0.6 upgrade. If this isn't here, we get a //nullPointerException in XYBarRenderer.drawItemLabel renderer.setBaseItemLabelGenerator(new NullLabelGenerator()); renderer.setSeriesItemLabelsVisible(0, true); renderer.setBaseToolTipGenerator(toolTipGenerator); _chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, false); _chart.getXYPlot().setRenderer(renderer); init(_chart); }
From source file:techtonic.PlotGraphListener.java
@Override public void actionPerformed(ActionEvent e) { Vector<String> v = new Vector<String>(Arrays.asList(trajectoryQuality)); Techtonic.setEnablejcbX_Axis(true);//from w w w . java2 s . com Techtonic.setEnablejcbY_Axis(true); Techtonic.setjcbX_Axis(v); Techtonic.setjcbY_Axis(v); List<WitsmlTrajectoryStation> stationsAsList = Arrays .asList(new WitsmlTrajectoryStation[trajectory.getStations().size()]); for (WitsmlTrajectoryStation s : trajectory.getStations()) { stationsAsList.set(s.getStationNo(), s); } Techtonic.setEnablejcbX_Axis(true); Techtonic.setPropertyBtn(true); Techtonic.setEnablejcbY_Axis(true); Techtonic.setjcbX_Axis(v); Techtonic.setjcbY_Axis(v); Techtonic.setEnableRenderBtn(true); XYSeries series = new XYSeries(trajectory.getName()); String xu = ""; String yu = ""; // add data to Dataset (here assume data is in ArrayLists x and y int count = 1; for (WitsmlTrajectoryStation station : stationsAsList) { Value tvd = station.getTvd(); if (tvd == null) { continue; } xu = tvd.getUnit(); Value md = station.getNorth(); if (md == null) { continue; } yu = md.getUnit(); // System.out.println(count + " : ===>> tvd : "+tvd.getValue()+ "; md "+md.getValue()); series.add(md.getValue(), tvd.getValue()); count++; } XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(series); Techtonic.setCurrentStations(stationsAsList); // create a chart using the createYLineChart method... JFreeChart chart = ChartFactory.createXYLineChart(trajectory.getName(), // chart title xu, yu, // x and y axis labels data); // XYPlot plot = (XYPlot) chart.getPlot(); // XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // renderer.setSeriesLinesVisible(0, true); // renderer.setSeriesShapesVisible(1, true); // renderer.setSeriesLinesVisible(1, false); // renderer.setSeriesShapesVisible(1, true); // plot.setRenderer(renderer); ChartPanel cp = new ChartPanel(chart); // JFrame fr = new JFrame(); // fr.add(cp); // fr.pack(); // fr.setVisible(true); //cp.setMouseZoomable(true, true); // Techtonic.setTrajName(trajectory.getName()); Techtonic.setFreeChart(chart); Techtonic.setDisplayArea(cp); // chartPanel.setLayout(new java.awt.BorderLayout()); // chartPanel.add(cp,BorderLayout.CENTER); // chartPanel.validate(); // chartPanel.repaint();` }