Example usage for org.jfree.data.xy CategoryTableXYDataset add

List of usage examples for org.jfree.data.xy CategoryTableXYDataset add

Introduction

In this page you can find the example usage for org.jfree.data.xy CategoryTableXYDataset add.

Prototype

public void add(double x, double y, String seriesName) 

Source Link

Document

Adds a data item to this dataset and sends a DatasetChangeEvent to all registered listeners.

Usage

From source file:com.marvelution.jira.plugins.hudson.charts.BuildResultsRatioChartGenerator.java

/**
 * {@inheritDoc}//w  w  w .  ja va  2  s . c o  m
 */
@Override
public ChartHelper generateChart() {
    final Map<Integer, Build> buildMap = new HashMap<Integer, Build>();
    final CategoryTableXYDataset dataSet = new CategoryTableXYDataset();
    for (Build build : builds) {
        buildMap.put(Integer.valueOf(build.getBuildNumber()), build);
        dataSet.add(Double.valueOf(build.getBuildNumber()), Double.valueOf(build.getDuration()),
                getI18n().getText("hudson.charts.duration"));
    }
    final JFreeChart chart = ChartFactory.createXYBarChart("", "", false,
            getI18n().getText("hudson.charts.duration"), dataSet, PlotOrientation.VERTICAL, false, false,
            false);
    chart.setBackgroundPaint(Color.WHITE);
    chart.setBorderVisible(false);
    final BuildResultRenderer renderer = new BuildResultRenderer(server, buildMap);
    renderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
    renderer.setBaseItemLabelsVisible(false);
    renderer.setMargin(0.0D);
    renderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
    renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    renderer.setBaseToolTipGenerator(renderer);
    renderer.setURLGenerator(renderer);
    final XYPlot xyPlot = chart.getXYPlot();
    xyPlot.setAxisOffset(new RectangleInsets(1.0D, 1.0D, 1.0D, 1.0D));
    xyPlot.setRenderer(renderer);
    final NumberAxis domainAxis = new NumberAxis();
    domainAxis.setLowerBound(Collections.min(buildMap.keySet()));
    domainAxis.setUpperBound(Collections.max(buildMap.keySet()));
    final TickUnitSource ticks = NumberAxis.createIntegerTickUnits();
    domainAxis.setStandardTickUnits(ticks);
    xyPlot.setDomainAxis(domainAxis);
    final DateAxis rangeAxis = new DateAxis();
    final DurationFormat durationFormat = new DurationFormat();
    rangeAxis.setDateFormatOverride(durationFormat);
    rangeAxis.setLabel(getI18n().getText("hudson.charts.duration"));
    xyPlot.setRangeAxis(rangeAxis);
    ChartUtil.setupPlot(xyPlot);
    return new ChartHelper(chart);
}

From source file:org.jfree.data.xy.junit.CategoryTableXYDatasetTest.java

/**
 * This is a test for bug 1312066 - adding a new series should trigger a
 * recalculation of the interval width, if it is being automatically
 * calculated./*from  ww  w  .  ja  v  a 2s . com*/
 */
public void testAddSeries() {
    CategoryTableXYDataset d1 = new CategoryTableXYDataset();
    d1.setAutoWidth(true);
    d1.add(3.0, 1.1, "Series 1");
    d1.add(7.0, 2.2, "Series 1");
    assertEquals(3.0, d1.getXValue(0, 0), EPSILON);
    assertEquals(7.0, d1.getXValue(0, 1), EPSILON);
    assertEquals(1.0, d1.getStartXValue(0, 0), EPSILON);
    assertEquals(5.0, d1.getStartXValue(0, 1), EPSILON);
    assertEquals(5.0, d1.getEndXValue(0, 0), EPSILON);
    assertEquals(9.0, d1.getEndXValue(0, 1), EPSILON);

    // now add some more data
    d1.add(7.5, 1.1, "Series 2");
    d1.add(9.0, 2.2, "Series 2");

    assertEquals(3.0, d1.getXValue(1, 0), EPSILON);
    assertEquals(7.0, d1.getXValue(1, 1), EPSILON);
    assertEquals(7.5, d1.getXValue(1, 2), EPSILON);
    assertEquals(9.0, d1.getXValue(1, 3), EPSILON);

    assertEquals(7.25, d1.getStartXValue(1, 2), EPSILON);
    assertEquals(8.75, d1.getStartXValue(1, 3), EPSILON);
    assertEquals(7.75, d1.getEndXValue(1, 2), EPSILON);
    assertEquals(9.25, d1.getEndXValue(1, 3), EPSILON);

    // and check the first series too...
    assertEquals(2.75, d1.getStartXValue(0, 0), EPSILON);
    assertEquals(6.75, d1.getStartXValue(0, 1), EPSILON);
    assertEquals(3.25, d1.getEndXValue(0, 0), EPSILON);
    assertEquals(7.25, d1.getEndXValue(0, 1), EPSILON);
}

From source file:cachedataanalysis.FlowCache.java

public XYSeries exportReportChart() throws IOException {

    File outputHitRate = new File("report/" + name + "_" + policy + "_hitrate.txt");

    FileWriter fw = new FileWriter(outputHitRate);

    XYSeries hitRateCount = new XYSeries(name + "(" + size + " entries)");

    for (int i = 0; i < hitRateRecord.size(); i++) {
        hitRateCount.add(i, hitRateRecord.get(i));
        fw.write(i + "," + hitRateRecord.get(i) + "\n");
        fw.flush();// ww w . j  ava2  s .c  om
    }
    fw.close();

    XYSeriesCollection HitRateData = new XYSeriesCollection();
    HitRateData.addSeries(hitRateCount);
    JFreeChart hitRateStat = ChartFactory.createXYLineChart(
            "Hit Rate variatoion throughout recording in " + name, "Seconds", "HitRate", HitRateData,
            PlotOrientation.VERTICAL, true, true, false);

    ChartUtilities.saveChartAsJPEG(new File("report/" + name + "_hitRate" + size + ".jpg"), hitRateStat, 1500,
            900);

    //-------------------------------

    if (!fullReport) {
        return hitRateCount;
    }

    DefaultPieDataset hitProtoData = new DefaultPieDataset();
    DefaultPieDataset missProtoData = new DefaultPieDataset();

    CategoryTableXYDataset hitProtoDataRec = new CategoryTableXYDataset();
    for (int i = 0; i < hitProtoRec.size(); i++) {
        if (i % 120 != 0) {
            continue;
        }
        HashMap<String, Integer> _map = hitProtoRec.get(i);
        for (String _str : _map.keySet()) {
            hitProtoDataRec.add(i, _map.get(_str), _str);
        }

    }

    CategoryTableXYDataset missProtoDataRec = new CategoryTableXYDataset();
    for (int i = 0; i < missProtoRec.size(); i++) {
        if (i % 120 != 0) {
            continue;
        }
        HashMap<String, Integer> _map = missProtoRec.get(i);
        for (String _str : _map.keySet()) {
            missProtoDataRec.add(i, _map.get(_str), _str);
        }

    }

    XYSeries hitCountData = new XYSeries("Hit");
    XYSeries allCountData = new XYSeries("All");

    for (int i = 0; i < hitCount.size(); i++) {
        hitCountData.add(i, hitCount.get(i));
        //hitRateCount.add(i,(float)hitCount.get(i)/(hitCount.get(i)+allCount.get(i)));
    }

    for (int i = 0; i < allCount.size(); i++) {
        allCountData.add(i, allCount.get(i));

    }

    XYSeriesCollection CountStatData = new XYSeriesCollection();

    CountStatData.addSeries(hitCountData);
    CountStatData.addSeries(allCountData);

    for (String protocol : hitProto.keySet()) {
        hitProtoData.setValue(protocol, hitProto.get(protocol));
    }

    for (String protocol : missProto.keySet()) {
        missProtoData.setValue(protocol, missProto.get(protocol));
    }

    JFreeChart hitStatRec = ChartFactory.createStackedXYAreaChart(
            "Hit Protocol Fraction throughout record in " + name, "Seconds", "Count", hitProtoDataRec);

    JFreeChart missStatRec = ChartFactory.createStackedXYAreaChart(
            "Miss Protocol Fraction throughout record in " + name, "Seconds", "Count", missProtoDataRec);

    JFreeChart hitStat = ChartFactory.createPieChart3D("Protocal Fraction of Hit Flows in " + name,
            hitProtoData, true, true, false);
    JFreeChart missStat = ChartFactory.createPieChart3D("Protocal Fraction of Miss Flows in " + name,
            missProtoData, true, true, false);
    JFreeChart countStat = ChartFactory.createXYAreaChart("Hit Count to All Packet lookup in " + name,
            "Seconds", "Count", CountStatData, PlotOrientation.VERTICAL, true, true, false);

    ChartUtilities.saveChartAsJPEG(new File("report/" + name + "_hitProto" + size + ".jpg"), hitStat, 1500,
            900);
    ChartUtilities.saveChartAsJPEG(new File("report/" + name + "_missProto" + size + ".jpg"), missStat, 1500,
            900);
    ChartUtilities.saveChartAsJPEG(new File("report/" + name + "_hitCount" + size + ".jpg"), countStat, 1500,
            900);

    ChartUtilities.saveChartAsJPEG(new File("report/" + name + "_hitProtoRecord" + size + ".jpg"), hitStatRec,
            1500, 900);
    ChartUtilities.saveChartAsJPEG(new File("report/" + name + "_missProtoRecord" + size + ".jpg"), missStatRec,
            1500, 900);

    return hitRateCount;
}

From source file:com.marvelution.jira.plugins.hudson.charts.BuildTestResultsRatioChartGenerator.java

/**
 * {@inheritDoc}//from  www  .  j ava2s .  c  om
 */
@Override
public ChartHelper generateChart() {
    buildMap = new HashMap<Integer, Build>();
    final CategoryTableXYDataset dataset = new CategoryTableXYDataset();
    for (Build build : builds) {
        final TestResult results = build.getTestResult();
        double percentagePass = 0.0D, percentageFail = 0.0D, percentageSkipped = 0.0D;
        if (results != null && results.getTotal() > 0) {
            percentagePass = Double.valueOf(results.getPassed()) / Double.valueOf(results.getTotal()) * 100.0D;
            percentageFail = Double.valueOf(results.getFailed()) / Double.valueOf(results.getTotal()) * 100.0D;
            percentageSkipped = Double.valueOf(results.getSkipped()) / Double.valueOf(results.getTotal())
                    * 100.0D;
        }
        dataset.add(Double.valueOf(build.getBuildNumber()), percentagePass, seriesNames[0]);
        dataset.add(Double.valueOf(build.getBuildNumber()), percentageFail, seriesNames[1]);
        dataset.add(Double.valueOf(build.getBuildNumber()), percentageSkipped, seriesNames[2]);
        buildMap.put(Integer.valueOf(build.getBuildNumber()), build);
    }
    final JFreeChart chart = ChartFactory.createStackedXYAreaChart("", "",
            getI18n().getText("hudson.charts.tests"), dataset, PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(Color.WHITE);
    chart.setBorderVisible(false);
    XYPlot xyPlot = chart.getXYPlot();
    xyPlot.setDataset(1, dataset);
    if (dataset.getItemCount() > 0) {
        XYLineAndShapeRenderer shapeRenderer = new XYLineAndShapeRenderer(false, true);
        shapeRenderer.setSeriesShapesVisible(1, false);
        shapeRenderer.setSeriesLinesVisible(1, false);
        shapeRenderer.setSeriesShapesVisible(2, false);
        shapeRenderer.setSeriesLinesVisible(2, false);
        shapeRenderer.setSeriesShape(0, new Ellipse2D.Double(-3.0D, -3.0D, 6.0D, 6.0D));
        shapeRenderer.setSeriesPaint(0, GREEN_PAINT);
        shapeRenderer.setSeriesShapesFilled(0, true);
        shapeRenderer.setBaseToolTipGenerator(this);
        shapeRenderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
        shapeRenderer.setBaseItemLabelsVisible(false);
        xyPlot.setRenderer(0, shapeRenderer);
        StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
        renderer.setSeriesPaint(0, GREEN_PAINT);
        renderer.setSeriesPaint(1, RED_PAINT);
        renderer.setSeriesPaint(2, YELLOW_PAINT);
        renderer.setBaseItemLabelFont(ChartDefaults.defaultFont);
        renderer.setBaseItemLabelsVisible(false);
        xyPlot.setRenderer(1, renderer);
        renderer.setBaseToolTipGenerator(this);
    }
    ValueAxis rangeAxis = xyPlot.getRangeAxis();
    rangeAxis.setLowerBound(0.0D);
    rangeAxis.setUpperBound(100.0D);
    final NumberAxis domainAxis = new NumberAxis();
    domainAxis.setLowerBound(Collections.min(buildMap.keySet()));
    domainAxis.setUpperBound(Collections.max(buildMap.keySet()));
    final TickUnitSource ticks = NumberAxis.createIntegerTickUnits();
    domainAxis.setStandardTickUnits(ticks);
    xyPlot.setDomainAxis(domainAxis);
    ChartUtil.setupPlot(xyPlot);
    return new ChartHelper(chart);
}

From source file:LowPassFilterTest.java

@Test
public void test() throws InterruptedException {
    CategoryTableXYDataset serie = new CategoryTableXYDataset();
    serie.setNotify(false);//from   w  ww .  j  a  v  a  2  s .  c om
    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));
    //        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);/*  w w  w .j av a2  s. c  o  m*/
    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;
    }
    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);//from   w  w w  . j a v  a 2  s .  c  o  m
    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;
    }
    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:edu.emory.library.tast.database.graphs.GraphTypeScatter.java

public JFreeChart createChart(Object[] data) {

    CategoryTableXYDataset dataset = new CategoryTableXYDataset();

    JFreeChart chart = ChartFactory.createScatterPlot(null, getSelectedIndependentVariable().getLabel(),
            TastResource.getText("components_charts_barvalue"), dataset, PlotOrientation.VERTICAL, true, true,
            false);//from ww w  . j ava2s.co m

    //getSelectedIndependentVariable().getFormat();

    XYPlot plot = chart.getXYPlot();
    ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride(new DecimalFormat("0"));

    chart.setBackgroundPaint(Color.white);

    List allDataSeries = getDataSeries();
    for (int j = 0; j < allDataSeries.size(); j++) {
        DataSeries dataSearies = (DataSeries) allDataSeries.get(j);
        String dataSeriesLabel = dataSearies.formatForDisplay();
        for (int i = 0; i < data.length; i++) {
            Object[] row = (Object[]) data[i];
            Number x = (Number) row[0];
            Number y = (Number) row[j + 1];
            if (x != null && y != null)
                dataset.add(x.doubleValue(), y.doubleValue(), dataSeriesLabel);
        }
    }

    return chart;

}

From source file:edu.emory.library.tast.database.graphs.GraphTypeXY.java

public JFreeChart createChart(Object[] data) {

    CategoryTableXYDataset dataset = new CategoryTableXYDataset();

    JFreeChart chart = ChartFactory.createXYLineChart(null, getSelectedIndependentVariable().getLabel(),
            TastResource.getText("components_charts_barvalue"), dataset, PlotOrientation.VERTICAL, true, true,
            false);//  www.  jav  a 2s  .  co  m

    Format formatter = getSelectedIndependentVariable().getFormat();

    XYPlot plot = chart.getXYPlot();
    if (formatter != null)
        ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride((NumberFormat) formatter);

    chart.setBackgroundPaint(Color.white);

    List allDataSeries = getDataSeries();
    for (int j = 0; j < allDataSeries.size(); j++) {
        DataSeries dataSearies = (DataSeries) allDataSeries.get(j);
        String dataSeriesLabel = dataSearies.formatForDisplay();
        for (int i = 0; i < data.length; i++) {
            Object[] row = (Object[]) data[i];
            Number x = (Number) row[0];
            Number y = (Number) row[j + 1];
            if (x != null && y != null)
                dataset.add(x.doubleValue(), y.doubleValue(), dataSeriesLabel);
        }
    }

    LegendItemCollection legendItems = chart.getPlot().getLegendItems();
    for (int i = 0; i < legendItems.getItemCount(); i++) {
        LegendItem legendItem = legendItems.get(i);
        DataSeries dataSearies = (DataSeries) allDataSeries.get(i);
        if (legendItem.getFillPaint() instanceof Color) {
            dataSearies.setColor(((Color) legendItem.getFillPaint()));
        }
    }

    return chart;

}

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);//from   w ww  . j av  a2s . c  om
    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;
        //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);
}