List of usage examples for org.jfree.data.xy CategoryTableXYDataset add
public void add(double x, double y, String seriesName)
From source file:ru.spbspu.viewer.DataView.java
public void buildFullOscillogram() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false);/* ww w. j a va 2 s . c o m*/ double step = 1.0 / getDiscretization(); double startPosition = step * getFramePosition(); double[] data = _presenter.getFullData(); for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step; } JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "g, /c^2", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); //plot.setRangeGridlinePaint(Color.BLACK); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); yAxis.setRange(_presenter.getMinMaxRange()); org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = getFramePosition() * 1.0 / getDiscretization(); double max = start + getFrameWidth() * 1.0 / getDiscretization(); xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); drawGraphOfSignal(chartPanel); }
From source file:ru.spbspu.viewer.DataView.java
/** * ? ? // w ww. j a va2 s . c o m */ public void buildEnergyGraph() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / getDiscretization(); double startPosition = step * getFramePosition(); double[] data = _presenter.getFrameEnergy(getFramePosition(), getFrameWidth(), getWindowWidth()); for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step * getFrameWidth() / (data.length - 1); } JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); String selection = scaling.getSelection().getActionCommand(); switch (selection) { case "max": { yAxis.setRange(_presenter.getMinMaxRangeEnergy()); } break; case "mean": { yAxis.setRange(_presenter.getMeanRangeEnergy()); } break; case "auto": break; } plot.setFixedRangeAxisSpace(GRAPHIC_SPACE); org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = getFramePosition() * 1.0 / getDiscretization(); double max = start + getFrameWidth() * 1.0 / getDiscretization(); xAxis.setRange(start, max); // yAxis.setRange(3.99, 4.01); ChartPanel chartPanel = new ChartPanel(chart); drawGraphOfEnergy(chartPanel); }
From source file:ru.spbspu.viewer.DataView.java
/** * ? ? ? ?/*from www . ja v a 2 s . co m*/ */ public void buildFullEnergyGraph() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / getDiscretization() * Integer.parseInt(spinnerWindowWidth.getValue().toString()) / 2; double startPosition = 0; double[] data = _presenter.getFullFrameEnergy(getWindowWidth()); for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step; } JFreeChart chart = ChartFactory.createXYLineChart("", "", "t,c", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); AxisSpace space = new AxisSpace(); space.setLeft(GRAPHIC_SPACE.getLeft() - 8); plot.setFixedRangeAxisSpace(space); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); String selection = scaling.getSelection().getActionCommand(); switch (selection) { case "max": { yAxis.setRange(_presenter.getMinMaxRangeEnergy()); } break; case "mean": { yAxis.setRange(_presenter.getMeanRangeEnergy()); } break; case "auto": break; } org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = 0; double max = _presenter.getFullData().length / Double.valueOf(spinnerDiscretization.getValue().toString()); xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); drawFullGraphOfEnergy(chartPanel); }
From source file:ru.spbspu.viewer.DataView.java
/** * ? /*from w w w .ja v a 2 s. co m*/ */ public void buildFourierTransformGraph() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double[] data = _presenter.getFourierTransform(getFramePosition(), getFrameWidth(), getWindowWidth()); JFreeChart chart = null; String select = v.getSelection().getActionCommand(); if (select.equalsIgnoreCase(vAcceleration.getActionCommand())) { for (int i = 0; i < data.length; i++) { serie.add(1.0 * i / getFrameWidth() * getDiscretization(), 2.0 * data[i], ""); } chart = ChartFactory.createXYLineChart("", "", "g, /?^2", serie); } else if (select.equalsIgnoreCase(vDisplacement.getActionCommand())) { for (int i = 0; i < data.length; i++) { double freq = 1.0 * i / getFrameWidth() * getDiscretization(); if (freq < 1.0) { continue; } double value = 2.0 * data[i] * Math.pow(10, 6) / Math.pow(freq, 2); serie.add(freq, value, ""); } chart = ChartFactory.createXYLineChart("", "", "?, ", serie); } else return; chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); // org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); // // org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); // yAxis.setRange(3.99, 4.01); ChartPanel chartPanel = new ChartPanel(chart); drawGraphOfEnergy(chartPanel); }
From source file:ru.spbspu.viewer.DataView.java
/** * ? ? /*from w w w .ja v a2 s . co m*/ */ public void buildOscillogram() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / getDiscretization(); double startPosition = step * getFramePosition(); double[] data = null; if (LPF.isSelected()) { data = _presenter.lpFilter(_presenter.getFrameData(getFramePosition(), getFrameWidth()), Double.parseDouble(spinnerLimitFreq.getValue().toString())); } else { data = _presenter.getFrameData(getFramePosition(), getFrameWidth()); } for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step; } JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "g, /c^2", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); plot.setFixedRangeAxisSpace(GRAPHIC_SPACE); //plot.setRangeGridlinePaint(Color.BLACK); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); Range range = _presenter.getMinMaxRange(); if (range.getLength() > 0) { yAxis.setRange(range); } org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = getFramePosition() * 1.0 / getDiscretization(); double max = start + getFrameWidth() * 1.0 / getDiscretization(); xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); drawGraphOfSignal(chartPanel); }