Example usage for org.jfree.chart.renderer.xy XYLineAndShapeRenderer XYLineAndShapeRenderer

List of usage examples for org.jfree.chart.renderer.xy XYLineAndShapeRenderer XYLineAndShapeRenderer

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYLineAndShapeRenderer XYLineAndShapeRenderer.

Prototype

public XYLineAndShapeRenderer() 

Source Link

Document

Creates a new renderer with both lines and shapes visible.

Usage

From source file:techtonic.Onview.java

private void btnRenderActionPerformed(java.awt.event.ActionEvent evt) {
    // get the axis first

    String x = jcbX_Axis.getSelectedItem().toString();
    String y = jcbY_Axis.getSelectedItem().toString();

    if (y.equals("Depth")) {
        //log plot

        WitsmlLogCurve ydata = currentCurves.get(0);
        WitsmlLogCurve xdata = null;/*from  w  ww  .  j ava2 s.  c  o m*/
        // the selected value by looping through the curve object

        for (int i = 1; i < currentCurves.size(); i++) {
            if (x.equals(currentCurves.get(i).getDescription())) {
                xdata = currentCurves.get(i);
                //      System.out.println("got "+currentCurves.get(i).getDescription());
                break;
            }
        }

        List<Object> yvalues = ydata.getValues();
        List<Object> xvalues = xdata.getValues();

        String title = "Depth against " + xdata.getDescription();
        XYSeries series = new XYSeries(title);
        for (int i = 0; i < yvalues.size(); i++) {
            Object vx = xvalues.get(i);
            Object vy = yvalues.get(i);
            double dx = Double.parseDouble(vx.toString());
            double dy = Double.parseDouble(vy.toString());
            //     System.out.println("depth : "+dy +" : "+title+" : "+dx);
            series.add(dx, dy);
        }
        XYSeriesCollection data = new XYSeriesCollection();
        data.addSeries(series);

        // create a chart using the createYLineChart method...
        JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
                xdata.getDescription(), "Depth", // x and y axis labels
                data); // data

        XYPlot plot = (XYPlot) chart.getPlot();
        XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
        renderer.setSeriesLinesVisible(0, true);
        renderer.setSeriesShapesVisible(0, false);
        renderer.setSeriesLinesVisible(1, false);
        renderer.setSeriesShapesVisible(1, true);
        plot.setRenderer(renderer);
        ChartPanel cp = new ChartPanel(chart);
        setDisplayArea(cp);

    } else {
        // trajectory

        ArrayList<Double> ax = getValues(x);
        ArrayList<Double> ay = getValues(y);

        XYSeries series = new XYSeries(trajName);
        for (int i = 0; i < ax.size(); i++) {
            series.add(ax.get(i), ay.get(i));
        }
        XYSeriesCollection data = new XYSeriesCollection();
        data.addSeries(series);
        JFreeChart chart = ChartFactory.createXYLineChart(trajName, // chart title
                x, y, // x and y axis labels
                data);
        ChartPanel cp = new ChartPanel(chart);
        setDisplayArea(cp);
        // call a method to select the method here  
    }
}

From source file:de.fau.amos.ChartRenderer.java

/**
 * Creates Chart (JFreeChart object) using TimeSeriesCollection. Used for forecast only.
 * /* ww w  .j  ava 2  s .  c  om*/
 * @param collection TimeSeriesCollection that provides basis for chart.
 * @param time Time where "real" data ends.
 * @param unit Unit of displayed values (kWh,TNF,kWh/TNF)
 * @return Returns finished JFreeChart.
 */
private JFreeChart createForecastChart(final TimeSeriesCollection collection, String time, String unit) {

    // Modification of X-Axis Label
    int day = Integer.parseInt(time.substring(8, 10));
    int month = Integer.parseInt(time.substring(5, 7));
    int year = Integer.parseInt(time.substring(0, 4));
    //get Weekday
    Calendar c = Calendar.getInstance();
    c.set(year, month - 1, day, 0, 0);
    int weekDay = c.get(Calendar.DAY_OF_WEEK);

    String dayString = new DateFormatSymbols(Locale.US).getWeekdays()[weekDay] + ", " + day + ". ";
    String monthString = new DateFormatSymbols(Locale.US).getMonths()[month - 1];
    String xAxisLabel = "" + dayString + monthString + "  " + time.substring(0, 4);

    //Creation of the lineChart
    JFreeChart lineChart = ChartFactory.createTimeSeriesChart("Forecast", // title
            xAxisLabel, // x-axis label
            //            "Energy Consumption "+("1".equals(unit)?"[kWh]":("2".equals(unit)?"[kWh/TNF]":("3".equals(unit)?"[TNF]":""))),       // y-axis label
            ("1".equals(unit) ? "Energy Consumption [kWh]"
                    : ("2".equals(unit) ? "Energy Consumption [kWh/TNF]"
                            : ("3".equals(unit) ? "Produced Pieces [TNF]" : ""))),
            collection, // data
            true, // create legend?
            false, // generate tooltips?
            false // generate URLs?
    );

    //graphical modifications for LineChart
    lineChart.setBackgroundPaint(Color.white);

    XYPlot plot = lineChart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0));

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer() {
        private static final long serialVersionUID = 1L;
        //         Stroke soild = new BasicStroke(2.0f);
        Stroke dashed = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f,
                new float[] { 10.0f }, 0.0f);

        @Override
        public Stroke getItemStroke(int row, int column) {
            //third series in collection -> forecast collection
            if (row == 2) {
                return dashed;
                //partial dashed->not needed now, maybe later

                //               double x = collection.getXValue(row, column);
                //               
                //               if ( x > 4){
                //                  return dashed;
                //               } else {
                //                  return soild;
                //               } 
            } else
                return super.getItemStroke(row, column);
        }
    };
    renderer.setBaseShapesVisible(false);
    renderer.setBaseShapesFilled(true);
    renderer.setBaseStroke(new BasicStroke(3));
    plot.setRenderer(renderer);

    return lineChart;
}

From source file:com.zigabyte.stock.stratplot.StrategyPlotter.java

/** Build combined chart containing the account cash/stocks/total
    values chart over dates on bottom and the percentage change
    over dates chart on top. //from w  w w  . j  av a 2s .  com
    @return y-axes that need to be re-ranged when data changes. **/
private NumberAxis[] plotAccountHistory(XYDataset accountData, String title, Date startDate, Date endDate) {
    final DateAxis dateAxis = new DateAxis();
    dateAxis.setRange(startDate, endDate);
    final NumberAxis percentAxis = new NumberAxis("% change");
    percentAxis.setAutoRangeIncludesZero(false);
    final NumberAxis priceAxis = new NumberAxis("US$");
    priceAxis.setAutoRangeIncludesZero(true);

    boolean useShapes = // use shapes if 3 months or less
            (endDate.getTime() - startDate.getTime() < 93 * 24 * 60 * 60 * 1000L);
    XYLineAndShapeRenderer accountRenderer = new XYLineAndShapeRenderer();
    accountRenderer.setShapesVisible(useShapes);
    XYPlot accountPlot = new XYPlot(accountData, dateAxis, priceAxis, accountRenderer);
    // compare only total percent data to zoom in on its fluctuations
    // for comparison with the compare index such as S&P500 index.
    // Stock value starts at zero, and cash value becomes close to zero,
    // so they fluctuation widely, so leave them out.
    XYDataset accountTotalPercentData = new XYDatasetPercentChangeAdapter(
            new SubSeriesDataset(accountData, BalanceHistoryXYDataset.TOTAL_SERIES));
    XYLineAndShapeRenderer compareRenderer = new XYLineAndShapeRenderer();
    compareRenderer.setShapesVisible(useShapes);
    XYPlot comparePlot = new XYPlot(accountTotalPercentData, dateAxis, percentAxis, compareRenderer);

    String compareIndexSymbol = this.compareIndexSymbolField.getText();
    StockHistory compareHistory = this.histories.get(compareIndexSymbol);
    if (compareHistory != null) {
        XYDataset comparePercentData = new OHLCDatasetPercentChangeAdapter(new OHLCDatasetSubdomainAdapter(
                new OHLCDatasetOfStockHistory(compareHistory), startDate, endDate));
        int compareIndex = 1;
        comparePlot.setDataset(compareIndex, comparePercentData);
        XYLineAndShapeRenderer percentRenderer = new XYLineAndShapeRenderer();
        percentRenderer.setShapesVisible(useShapes);
        comparePlot.setRenderer(compareIndex, percentRenderer);
    }
    // share date axis
    CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(dateAxis);
    combinedPlot.add(comparePlot, 1);
    combinedPlot.add(accountPlot, 1);

    this.chartPanel.setChart(new JFreeChart(title, null, combinedPlot, true));
    return new NumberAxis[] { priceAxis, percentAxis };
}

From source file:GroupProject.OriginalChartUI.java

/**
 * The method to draw line chart//from   w  w w  . j a  va 2 s  .  co m
 * @param lineChartData the data used in the line chart
 * @param XTitle the measurement of X axis
 * @param YTitle the measurement of Y axis
 */
public void drawLineChart(Map<String, Float> lineChartData, String XTitle, String YTitle) {
    String title = XTitle + " VS " + YTitle;
    System.out.print("drawLineChart");

    ArrayList<String> keyArrayList = new ArrayList<>();
    ArrayList<Float> valueArrayList = new ArrayList<>();
    Set set = lineChartData.keySet();
    int i = 1;
    XYSeries series1 = new XYSeries("");

    for (Map.Entry<String, Float> data : lineChartData.entrySet()) {
        String key = data.getKey();
        Float value = data.getValue();
        keyArrayList.add(key);
        valueArrayList.add(value);
        series1.add(Integer.valueOf(key), value);
    }
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);
    JFreeChart chart = ChartFactory.createXYLineChart(title, XTitle, YTitle, dataset, PlotOrientation.VERTICAL,
            true, true, false);
    XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.BLUE);

    renderer.setSeriesLinesVisible(1, false);
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);

    plot.setRangeGridlinePaint(Color.GRAY);
    plot.setBackgroundPaint(Color.white);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartDisplayPanel.removeAll();
    chartDisplayPanel.add(chartPanel, BorderLayout.CENTER);
    chartDisplayPanel.validate();
}

From source file:techtonic.Techtonic.java

private void btnSetPropertiesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetPropertiesActionPerformed

    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, foreColor);
    renderer.setSeriesShapesVisible(0, false);

    plot.setRenderer(renderer);//from  w w  w .  j  a va 2 s.  c  o m
    ChartPanel cp = new ChartPanel(chart);
    System.out.println("opacity: " + cp.isOpaque());
    cp.setBackground(bgColor);
    setFreeChart(chart);
    setDisplayArea(cp);

}

From source file:Output.SplitChart.java

public void drawAggreagtedSupplyAndDemandWithTrueCostData(String outputTimeTypeSelect, int iStartTime,
        int iEndTime, int iDayHour, int[] selectIndex) {
    ArrayList genAgentSupplyOfferByDay = this.amesFrame.getAMESMarket().getGenAgentSupplyOfferByDay();

    Object[][] genData = this.amesFrame.getGeneratorData();
    int iGenNumber = genData.length;

    double[][] genOfferData = new double[iGenNumber][8]; // a, b, minCap, maxCap, 1/b, a/b, currentPower, currentPrice
    double[][] offerPrices = new double[iGenNumber * 2][2]; // price, index

    for (int i = 0; i < iGenNumber; i++) {
        genOfferData[i][0] = Support.parseDouble(genData[i][4].toString());
        genOfferData[i][1] = Support.parseDouble(genData[i][5].toString());
        genOfferData[i][2] = Support.parseDouble(genData[i][6].toString());
        genOfferData[i][3] = Support.parseDouble(genData[i][7].toString());
        genOfferData[i][4] = 1.0 / genOfferData[i][1];
        genOfferData[i][5] = genOfferData[i][0] / genOfferData[i][1];

        offerPrices[2 * i][0] = genOfferData[i][0] + (2 * genOfferData[i][1] * genOfferData[i][2]);
        offerPrices[2 * i][1] = 2 * i;//from  www . j ava  2  s  . c  o m
        offerPrices[(2 * i) + 1][0] = genOfferData[i][0] + (2 * genOfferData[i][1] * genOfferData[i][3]);
        offerPrices[(2 * i) + 1][1] = (2 * i) + 1;

        genOfferData[i][6] = genOfferData[i][2];
        genOfferData[i][7] = offerPrices[2 * i][0];
    }

    // sort the price of each generator
    double dTemp = 0;
    double iTemp = 0;
    for (int i = 0; i < (2 * iGenNumber); i++) {
        for (int j = i + 1; j < (2 * iGenNumber); j++) {
            if (offerPrices[i][0] > offerPrices[j][0]) {
                dTemp = offerPrices[i][0];
                iTemp = offerPrices[i][1];
                offerPrices[i][0] = offerPrices[j][0];
                offerPrices[i][1] = offerPrices[j][1];
                offerPrices[j][0] = dTemp;
                offerPrices[j][1] = iTemp;
            }
        }
    }

    double[][] genAggregateOfferDataPoints = new double[(iGenNumber * 2) - 1][4]; // leftPoint(power, price), rightPoint(power, price)
    int[][] genAggregateOfferCommit = new int[(iGenNumber * 2) - 1][iGenNumber * 2];
    // in the first iGenNumber of each row is the index of gen whose output is fixed
    // in the second iGenNumber of each row is the index of gen whose output is variable
    // otherwise -1

    for (int i = 0; i < ((2 * iGenNumber) - 1); i++) {
        for (int j = 0; j < (2 * iGenNumber); j++) {
            genAggregateOfferCommit[i][j] = -1;
        }
    }

    double leftPrice = offerPrices[0][0];
    for (int i = 0; i < iGenNumber; i++) {
        if (leftPrice >= genOfferData[i][7]) {
            genAggregateOfferDataPoints[0][0] += genOfferData[i][6];
        }
    }

    for (int i = 0; i < ((2 * iGenNumber) - 1); i++) {
        genAggregateOfferDataPoints[i][1] = offerPrices[i][0];
        genAggregateOfferDataPoints[i][3] = offerPrices[i + 1][0];

        if (i > 0) {
            genAggregateOfferDataPoints[i][0] = genAggregateOfferDataPoints[i - 1][2];
        }

        genAggregateOfferDataPoints[i][2] = genAggregateOfferDataPoints[i][0];

        int iIndexFixed = 0;
        int iIndexVariable = 0;

        double rightPrice = offerPrices[i + 1][0];
        for (int j = 0; j < iGenNumber; j++) {
            if (rightPrice > genOfferData[j][7]) {
                if (Math.abs(genOfferData[j][6] - genOfferData[j][3]) < 0.000001) { // already at maxCap
                    genAggregateOfferCommit[i][iIndexFixed++] = j;
                } else {
                    double power = (rightPrice - genOfferData[j][0]) / (2 * genOfferData[j][1]);
                    genAggregateOfferDataPoints[i][2] += power - genOfferData[j][6];
                    genAggregateOfferCommit[i][iGenNumber + iIndexVariable] = j;
                    iIndexVariable++;

                    genOfferData[j][7] = rightPrice;
                    genOfferData[j][6] = power;

                }

            }
        }
    }

    double HighestGenOfferPrice = genAggregateOfferDataPoints[(iGenNumber * 2) - 2][3];
    double HighestGenOfferPower = genAggregateOfferDataPoints[(iGenNumber * 2) - 2][2];

    // Demand
    Object[][][] lsePriceSensitiveData = this.amesFrame.getLSEPriceSensitiveDemandData();
    Object[][] lseHybridData = this.amesFrame.getLSEHybridDemandData();
    Object[][] lseData = this.amesFrame.getLSEData();
    int iLSENumber = lsePriceSensitiveData.length;
    double[][] lseDemandData = new double[iLSENumber][6]; // c, d, slMax, fixed demand, currentPower, currentPrice
    double[][] lsePrices = new double[iLSENumber * 2][2]; // price, index
    int hourlyLoadHybridFlagByLSE = 0;
    double priceCap = 1000.0;

    for (int i = 0; i < iLSENumber; i++) {
        hourlyLoadHybridFlagByLSE = Integer.parseInt(lseHybridData[i][iDayHour + 3].toString());

        if ((hourlyLoadHybridFlagByLSE & 2) == 2) {
            double c = Support.parseDouble(lsePriceSensitiveData[i][iDayHour][4].toString());
            double d = Support.parseDouble(lsePriceSensitiveData[i][iDayHour][5].toString());
            double slMax = Support.parseDouble(lsePriceSensitiveData[i][iDayHour][6].toString());

            lseDemandData[i][0] = c;
            lseDemandData[i][1] = d;
            lseDemandData[i][2] = slMax;
            lseDemandData[i][4] = 0.0;
            lseDemandData[i][5] = c;

            lsePrices[2 * i][0] = c;
            lsePrices[2 * i][1] = 2 * i;
            lsePrices[(2 * i) + 1][0] = c - (2 * d * slMax);
            lsePrices[(2 * i) + 1][1] = (2 * i) + 1;
        } else {
            lseDemandData[i][0] = 0.0;
            lseDemandData[i][1] = 0.0;
            lseDemandData[i][2] = 0.0;
            lseDemandData[i][4] = 0.0;
            lseDemandData[i][5] = priceCap;

            lsePrices[2 * i][0] = priceCap;
            lsePrices[2 * i][1] = 2 * i;
            lsePrices[(2 * i) + 1][0] = priceCap;
            lsePrices[(2 * i) + 1][1] = (2 * i) + 1;
        }

        if ((hourlyLoadHybridFlagByLSE & 1) == 1) { // fixed demand
            lseDemandData[i][3] = Support.parseDouble(lseData[i][iDayHour + 3].toString());
        }
    }

    // sort the price of each lse
    for (int i = 0; i < (2 * iLSENumber); i++) {
        for (int j = i + 1; j < (2 * iLSENumber); j++) {
            if (lsePrices[i][0] < lsePrices[j][0]) {
                dTemp = lsePrices[i][0];
                iTemp = lsePrices[i][1];
                lsePrices[i][0] = lsePrices[j][0];
                lsePrices[i][1] = lsePrices[j][1];
                lsePrices[j][0] = dTemp;
                lsePrices[j][1] = iTemp;
            }
        }
    }

    double[][] lseAggregateDemandDataPoints = new double[(iLSENumber * 2) - 1][4]; // leftPoint(power, price), rightPoint(power, price)
    int[][] lseAggregateDemandCommit = new int[(iLSENumber * 2) - 1][iLSENumber * 2];
    // in the first iLSENumber of each row is the index of LSE whose commit is fixed
    // in the second iLSENumber of each row is the index of LSE whose commit is variable
    // otherwise -1

    for (int i = 0; i < ((2 * iLSENumber) - 1); i++) {
        for (int j = 0; j < (2 * iLSENumber); j++) {
            lseAggregateDemandCommit[i][j] = -1;
        }
    }

    leftPrice = lsePrices[0][0];
    for (int i = 0; i < iLSENumber; i++) {
        lseAggregateDemandDataPoints[0][0] += lseDemandData[i][3];

        if (leftPrice <= lseDemandData[i][5]) {
            lseAggregateDemandDataPoints[0][0] += lseDemandData[i][4];
        }
    }

    for (int i = 0; i < ((2 * iLSENumber) - 1); i++) {
        lseAggregateDemandDataPoints[i][1] = lsePrices[i][0];
        lseAggregateDemandDataPoints[i][3] = lsePrices[i + 1][0];

        if (i > 0) {
            lseAggregateDemandDataPoints[i][0] = lseAggregateDemandDataPoints[i - 1][2];
        }

        lseAggregateDemandDataPoints[i][2] = lseAggregateDemandDataPoints[i][0];

        int iIndexFixed = 0;
        int iIndexVariable = 0;

        double rightPrice = lsePrices[i + 1][0];
        for (int j = 0; j < iLSENumber; j++) {
            if (rightPrice < lseDemandData[j][5]) {
                if (Math.abs(lseDemandData[j][4] - lseDemandData[j][2]) < 0.000001) { // already at slMax
                    lseAggregateDemandCommit[i][iIndexFixed++] = j;
                } else {
                    double power = (lseDemandData[j][0] - rightPrice) / (2 * lseDemandData[j][1]);
                    lseAggregateDemandDataPoints[i][2] += power - lseDemandData[j][4];
                    lseAggregateDemandCommit[i][iLSENumber + iIndexVariable] = j;
                    iIndexVariable++;

                    lseDemandData[j][5] = rightPrice;
                    lseDemandData[j][4] = power;

                }

            }
        }
    }

    double HighestLSEDemandPrice = lseAggregateDemandDataPoints[0][1];
    double HighestLSEDemandPower = lseAggregateDemandDataPoints[0][0];

    double highestPrice = (HighestGenOfferPrice > HighestLSEDemandPrice) ? HighestGenOfferPrice
            : HighestLSEDemandPrice;
    highestPrice += 50;

    this.chartTitle = "True Total Supply and Demand Curves at Hour " + iDayHour;
    String xLabel = "Power (MWs)";

    this.dataset = new XYSeriesCollection();

    XYSeries series = new XYSeries("Supply");

    ArrayList genTipList = new ArrayList();
    String tipString = "";

    leftPrice = genAggregateOfferDataPoints[0][1];
    double leftPower = genAggregateOfferDataPoints[0][0];
    series.add(leftPower, leftPrice);
    tipString = String.format("Power=%1$.2f Price=%2$.2f", leftPower, leftPrice);
    genTipList.add(new String(tipString));
    double rightPrice = 0;
    double rightPower = 0;

    for (int i = 0; i < ((2 * iGenNumber) - 1); i++) {
        rightPrice = genAggregateOfferDataPoints[i][3];
        rightPower = genAggregateOfferDataPoints[i][2];

        series.add(rightPower, rightPrice);

        // For tip display
        tipString = String.format("Power=%1$.2f Price=%2$.2f", rightPower, rightPrice);

        String tempFixed = " FixedGen: ";
        String tempVariable = " Marginal GenCos: ";
        String temp;
        boolean bFixed = false;
        boolean bVariable = false;

        for (int j = 0; j < (2 * iGenNumber); j++) {
            if ((j < iGenNumber) && (genAggregateOfferCommit[i][j] != -1)) {
                bFixed = true;
                tempFixed += genData[genAggregateOfferCommit[i][j]][0] + " ";
            }

            if ((j >= iGenNumber) && (genAggregateOfferCommit[i][j] != -1)) {
                bVariable = true;
                tempVariable += genData[genAggregateOfferCommit[i][j]][0] + " ";
            }
        }

        if (bFixed) {
            tipString += tempFixed;
        }

        if (bVariable) {
            tipString += tempVariable;
        }

        genTipList.add(new String(tipString));

    }
    // last infinity part
    series.add(rightPower, highestPrice);
    tipString = String.format("Power=%1$.2f Price=%2$.2f", rightPower, highestPrice);
    genTipList.add(new String(tipString));

    this.dataset.addSeries(series);

    series = new XYSeries("Demand");

    ArrayList LSETipList = new ArrayList();

    //first infinity part
    series.add(HighestLSEDemandPower, highestPrice);
    tipString = String.format("Power=%1$.2f Price=%2$.2f", HighestLSEDemandPower, highestPrice);
    LSETipList.add(new String(tipString));

    //second point
    leftPrice = lseAggregateDemandDataPoints[0][1];
    leftPower = lseAggregateDemandDataPoints[0][0];
    series.add(leftPower, leftPrice);
    tipString = String.format("Power=%1$.2f Price=%2$.2f", leftPower, leftPrice);
    LSETipList.add(new String(tipString));

    for (int i = 0; i < ((2 * iLSENumber) - 1); i++) {
        rightPrice = lseAggregateDemandDataPoints[i][3];
        rightPower = lseAggregateDemandDataPoints[i][2];

        series.add(rightPower, rightPrice);

        // For tip display
        tipString = String.format("Power=%1$.2f Price=%2$.2f", rightPower, rightPrice);

        String tempFixed = " MaxPS LSE: ";
        String tempVariable = " VariablePS LSE: ";
        String temp;
        boolean bFixed = false;
        boolean bVariable = false;

        for (int j = 0; j < (2 * iLSENumber); j++) {
            if ((j < iLSENumber) && (lseAggregateDemandCommit[i][j] != -1)) {
                bFixed = true;
                tempFixed += lseData[lseAggregateDemandCommit[i][j]][0] + " ";
            }

            if ((j >= iLSENumber) && (lseAggregateDemandCommit[i][j] != -1)) {
                bVariable = true;
                tempVariable += lseData[lseAggregateDemandCommit[i][j]][0] + " ";
            }
        }

        if (bFixed) {
            tipString += tempFixed;
        }

        if (bVariable) {
            tipString += tempVariable;
        }

        LSETipList.add(new String(tipString));

    }

    // last infinity part
    series.add(rightPower, 0.0);
    tipString = String.format("Power=%1$.2f Price=%2$.2f", rightPower, 0.0);
    LSETipList.add(new String(tipString));

    this.dataset.addSeries(series);

    // create the chart...
    this.chart = ChartFactory.createXYLineChart(this.chartTitle, // chart title
            xLabel, // x axis label
            "Price ($/MWh)", // y axis label
            this.dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    this.chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final XYPlot plot = this.chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.blue);
    plot.setRangeGridlinePaint(Color.blue);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    XYToolTipGenerator generator = new StandardXYToolTipGenerator("{2}", new DecimalFormat("0.00"),
            new DecimalFormat("0.00"));
    CustomXYToolTipGenerator customTip = new CustomXYToolTipGenerator();
    customTip.addToolTipSeries(genTipList);
    customTip.addToolTipSeries(LSETipList);

    renderer.setToolTipGenerator(customTip);
    plot.setRenderer(renderer);

    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    this.chart.getTitle().setFont(this.font);
    this.chartPanel.setChart(this.chart);
}