List of usage examples for org.jfree.data.xy CategoryTableXYDataset setNotify
public void setNotify(boolean notify)
From source file:LowPassFilterTest.java
@Test public void test() throws InterruptedException { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / discretization; double startPosition = step * framePosition; //100 ? - 100 , 50 ? - 50 , 25 ?- 25 double[] data = math.convolve( math.HammingWindow(testData.get1DPolyharmSignal(4, 200, frameWidth, discretization), frameWidth), math.lpf(60, step, 1024));/*from w w w.ja va 2 s. c o m*/ // double[] data = math.convolve(testData.get1DSignal(100, 200, frameWidth, discretization), math.lpf(70, step, 128)); // double[] data = math.convolve(testData.get1DSignal(100, 200, 32768, 10000), math.lpf(70, 1./10000, 32)); // double[] data = testData.get1DSignal(100, 200, frameWidth, discretization); // double[] data = math.lpf(70, step,128); 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(); org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = framePosition * 1.0 / discretization; double max = start + frameWidth * 1.0 / discretization; xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); JPanel p = new JPanel(new BorderLayout()); p.removeAll(); p.add(chartPanel); p.validate(); //1. Create the frame. JFrame frame = new JFrame("FrameDemo"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //3. Create components and put them in the frame. //...create emptyLabel... frame.getContentPane().add(new Label("olol"), BorderLayout.CENTER); frame.getContentPane().add(p, BorderLayout.CENTER); //4. Size the frame. frame.pack(); //5. Show it. frame.setVisible(true); }
From source file:D1WaveletTransform.java
@Test public void test() throws InterruptedException, JWaveException { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / discretization; double startPosition = step * framePosition; //100 ? - 100 , 50 ? - 50 , 25 ?- 25 WaveletTransform t = new FastWaveletTransform((new Haar1())); double[] data = t.forward(testData.get1DSimpleSignal(1, 3, frameWidth, discretization), 128); // double[] data = math.convolve(testData.get1DSignal(100, 200, frameWidth, discretization), math.lpf(70, step, 128)); // double[] data = math.convolve(testData.get1DSignal(100, 200, 32768, 10000), math.lpf(70, 1./10000, 32)); // double[] data = testData.get1DSignal(100, 200, frameWidth, discretization); // double[] data = math.lpf(70, step,128); for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step;/*from w w w. jav a2 s . co m*/ } JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "wave", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); //plot.setRangeGridlinePaint(Color.BLACK); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = framePosition * 1.0 / discretization; double max = start + frameWidth * 1.0 / discretization; xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); JPanel p = new JPanel(new BorderLayout()); p.removeAll(); p.add(chartPanel); p.validate(); //1. Create the frame. JFrame frame = new JFrame("FrameDemo"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //3. Create components and put them in the frame. //...create emptyLabel... frame.getContentPane().add(new Label("olol"), BorderLayout.CENTER); frame.getContentPane().add(p, BorderLayout.CENTER); //4. Size the frame. frame.pack(); //5. Show it. frame.setVisible(true); }
From source file:CorrelationLambdaTest.java
@Test public void crossCorrelationGraphicTest() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / discretization; double startPosition = step * framePosition; //100 ? - 100 , 50 ? - 50 , 25 ?- 25 Transform t = new Transform(new FastWaveletTransform(new Haar1())); double[] signal = testData.get1DSimpleSignal(1.5, 500, 32768, 5000); double[] data = crossCorrelationCoefficient(signal, window); // double[] data = math.convolve(testData.get1DSignal(100, 200, frameWidth, discretization), math.lpf(70, step, 128)); // double[] data = math.convolve(testData.get1DSignal(100, 200, 32768, 10000), math.lpf(70, 1./10000, 32)); // double[] data = testData.get1DSignal(100, 200, frameWidth, discretization); // double[] data = math.lpf(70, step,128); for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step;//from w ww. java 2s . c o m } JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "wave", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); //plot.setRangeGridlinePaint(Color.BLACK); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = framePosition * 1.0 / discretization; double max = start + frameWidth * 1.0 / discretization; xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); JPanel p = new JPanel(new BorderLayout()); p.removeAll(); p.add(chartPanel); p.validate(); //1. Create the frame. JFrame frame = new JFrame("FrameDemo"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //3. Create components and put them in the frame. //...create emptyLabel... frame.getContentPane().add(new Label("olol"), BorderLayout.CENTER); frame.getContentPane().add(p, BorderLayout.CENTER); //4. Size the frame. frame.pack(); //5. Show it. frame.setVisible(true); }
From source file:ru.spbspu.viewer.DataView.java
public void buildFullOscillogram() { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); 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;//from ww w . jav a 2s.c o m } 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
@Deprecated public void buildEnergyGraph2() { double[] data = _presenter.getFrameEnergy(getFramePosition(), getWindowWidth(), getWindowWidth()); CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false); double step = 1.0 / getDiscretization(); double startPosition = step * getFramePosition(); for (int i = 0; i < data.length - 1; i++) { serie.add(startPosition, data[i], ""); startPosition += step;/*ww w . j a v a 2 s . c o m*/ //1.0 / getDiscretization() * getFrameWidth() / (data.length - 1); } JFreeChart chart = ChartFactory.createXYLineChart("", "", "", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); 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); drawGraphOfEnergy(chartPanel); }
From source file:ru.spbspu.viewer.DataView.java
/** * ? ? // w w w .j a v a 2 s . c o 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); }
From source file:ru.spbspu.viewer.DataView.java
/** * ? /*from ww w . j a va2s . c om*/ */ 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
/** * ? ? ? ?//w ww . j ava 2s.com */ 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 ww . j a v a2 s.co 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); }