public JPanel createChart(
      Date from,
      Date to,
      StockInfo stock1,
      StockInfo stock2,
      Color color1,
      Color color2,
      StockPriceType priceType) {

    LOG.info(
        "Generating chart for tickers:"
            + stock1.getTickerSymbol()
            + " & "
            + stock2.getTickerSymbol());

    String chartTitle = df.format(from) + " to " + df.format(to) + " " + priceType;
    XYDataset dataset1 = createDataset(stock1, priceType);
    XYDataset dataset2 = createDataset(stock2, priceType);

    JFreeChart chart =
        ChartFactory.createTimeSeriesChart(
            chartTitle,
            DOMAIN_AXIS_TITLE,
            stock1.getTickerSymbol() + RANGE_AXIS_SUFFIX,
            dataset1,
            true,
            true,
            false);

    XYPlot plot = chart.getXYPlot();
    NumberAxis axis2 = new NumberAxis(stock2.getTickerSymbol() + RANGE_AXIS_SUFFIX);
    Font tickLabelFont = axis2.getTickLabelFont().deriveFont(11.0F);
    Font labelFont = axis2.getLabelFont().deriveFont(15.0F).deriveFont(Font.BOLD);
    axis2.setTickLabelFont(tickLabelFont);
    axis2.setLabelFont(labelFont);
    axis2.setAutoRangeIncludesZero(false);
    plot.setRangeAxis(1, axis2);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);

    StandardXYItemRenderer renderer = new StandardXYItemRenderer();
    renderer.setSeriesPaint(0, color1);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());
    plot.setRenderer(renderer);

    StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setSeriesPaint(0, color2);
    renderer2.setBaseShapesVisible(true);
    renderer2.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());
    plot.setRenderer(1, renderer2);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(df);

    ChartPanel chartPanel = new ChartPanel(chart);

    return chartPanel;
  }
  private JFreeChart createChart(XYZDataset xyzDataSet) {
    NumberAxis numberAxis = new NumberAxis("X");
    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberAxis.setLowerMargin(0.0D);
    numberAxis.setUpperMargin(0.0D);
    numberAxis.setAxisLinePaint(Color.white);
    numberAxis.setTickMarkPaint(Color.white);

    NumberAxis numberAxis1 = new NumberAxis("Y");
    numberAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberAxis1.setLowerMargin(0.0D);
    numberAxis1.setUpperMargin(0.0D);
    numberAxis1.setAxisLinePaint(Color.white);
    numberAxis1.setTickMarkPaint(Color.white);

    XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
    PaintScale paintScale;
    if (this.type == MarkovDataDialog.HeatMapType.COMPARISON)
      paintScale = createNewLookupPaintScale();
    else paintScale = new GrayPaintScale();

    //        paintScale.add(-1.0,Color.WHITE );
    xyblockrenderer.setPaintScale(paintScale);

    XYPlot xyplot = new XYPlot(xyzDataSet, numberAxis, numberAxis1, xyblockrenderer);
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainGridlinesVisible(false);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setOutlinePaint(Color.blue);

    JFreeChart jfreechart = new JFreeChart("heat map", xyplot);
    jfreechart.removeLegend();

    NumberAxis numberAxis2 = new NumberAxis("Scale");
    numberAxis2.setAxisLinePaint(Color.white);
    numberAxis2.setTickMarkPaint(Color.white);
    numberAxis2.setRange(-1.0D, 1.0D);
    numberAxis2.setTickLabelFont(new Font("Dialog", 0, 7));
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(paintScale, numberAxis2);
    paintscalelegend.setStripOutlineVisible(false);
    paintscalelegend.setSubdivisionCount(20);
    paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    paintscalelegend.setAxisOffset(5D);
    paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D));
    //        paintscalelegend.setFrame(new BlockBorder(Color.red));
    paintscalelegend.setPadding(new RectangleInsets(10D, 10D, 10D, 10D));
    paintscalelegend.setStripWidth(10D);
    paintscalelegend.setPosition(RectangleEdge.LEFT);
    jfreechart.addSubtitle(paintscalelegend);
    //        ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
  }
  /**
   * Creates a new demo.
   *
   * @param title the frame title.
   */
  public RoundNumberGlobal(final String title, ArrayList<Double> pf) {

    super(title);

    final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf);

    final CategoryAxis xAxis = new CategoryAxis("");
    // final NumberAxis yAxis = new NumberAxis("Round number");
    final NumberAxis yAxis = new NumberAxis("");
    yAxis.setAutoRangeIncludesZero(false);
    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    Font font = new Font("Dialog", Font.PLAIN, 16);
    xAxis.setTickLabelFont(font);
    yAxis.setTickLabelFont(font);
    yAxis.setLabelFont(font);

    final JFreeChart chart =
        new JFreeChart(
            "Round Number" + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));
    setContentPane(chartPanel);

    TextTitle legendText = null;
    if (pf.size() == 1) {
      legendText = new TextTitle("Population Size");
    } else {
      legendText = new TextTitle("Population Size - Probability of Failure");
    }

    legendText.setFont(font);
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);
    chart.getLegend().setItemFont(font);

    FileOutputStream output;
    try {
      output = new FileOutputStream("roundGlobalNumber" + pf + ".jpg");
      ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null);
    } catch (FileNotFoundException ex) {
      Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
      Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Beispiel #4
0
  private JFreeChart createScatChart(
      BufferedImage image, PaintScale ps, int plotWidth, int plotHeigh) {
    JFreeChart chart_temp =
        ChartFactory.createScatterPlot(
            null,
            null,
            null,
            new XYSeriesCollection(),
            PlotOrientation.VERTICAL,
            false,
            false,
            false);
    chart_temp.getXYPlot().getRangeAxis().setInverted(true);
    chart_temp.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT);
    XYDataImageAnnotation ann = new XYDataImageAnnotation(image, 0, 0, plotWidth, plotHeigh, true);
    XYPlot plot = (XYPlot) chart_temp.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.getRenderer().addAnnotation(ann, Layer.BACKGROUND);
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.0);
    xAxis.setUpperMargin(0.0);
    xAxis.setVisible(false);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.0);
    yAxis.setUpperMargin(0.0);
    yAxis.setVisible(false);

    NumberAxis scaleAxis = new NumberAxis();
    scaleAxis.setAxisLinePaint(Color.black);
    scaleAxis.setTickMarkPaint(Color.black);
    scaleAxis.setRange(ps.getLowerBound(), ps.getUpperBound());
    scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 9));
    PaintScaleLegend legend = new PaintScaleLegend(ps, scaleAxis);
    legend.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    legend.setMargin(new RectangleInsets(5, 5, 5, 5));
    legend.setStripWidth(10);
    legend.setPosition(RectangleEdge.RIGHT);
    legend.setBackgroundPaint(chart_temp.getBackgroundPaint());
    chart_temp.addSubtitle(legend);

    return chart_temp;
  }
    public PrecisionErrorChart() {
      super(new BorderLayout());
      timeseriescollectionPrecisionError = new TimeSeriesCollection();

      DateAxis dateaxis = new DateAxis("Time (hh:mm:ss)");
      dateaxis.setTickLabelFont(new Font("SansSerif", 0, 12));
      dateaxis.setLabelFont(new Font("SansSerif", 0, 14));
      dateaxis.setAutoRange(true);
      dateaxis.setUpperMargin(0.3D);
      dateaxis.setTickLabelsVisible(true);

      NumberAxis numberaxis = new NumberAxis("Precision error (ms)");
      numberaxis.setTickLabelFont(new Font("SansSerif", 0, 12));
      numberaxis.setLabelFont(new Font("SansSerif", 0, 14));
      numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      numberaxis.setRangeWithMargins(-100.0, 100.0);

      XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
      xylineandshaperenderer.setSeriesPaint(0, Color.blue);
      xylineandshaperenderer.setSeriesPaint(1, Color.red);
      xylineandshaperenderer.setSeriesPaint(2, Color.green);
      xylineandshaperenderer.setSeriesPaint(3, Color.pink);
      xylineandshaperenderer.setSeriesPaint(4, Color.magenta);
      xylineandshaperenderer.setSeriesPaint(5, Color.cyan);
      xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(0.7F, 0, 2));
      xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(0.7F, 0, 2));
      xylineandshaperenderer.setBaseShapesVisible(true);

      XYPlot xyplot =
          new XYPlot(
              timeseriescollectionPrecisionError, dateaxis, numberaxis, xylineandshaperenderer);
      xyplot.setBackgroundPaint(Color.lightGray);
      xyplot.setDomainGridlinePaint(Color.white);
      xyplot.setRangeGridlinePaint(Color.white);
      xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
      xyplot.setDomainGridlinesVisible(true);

      JFreeChart jfreechart =
          new JFreeChart("Time Precision Error", new Font("SansSerif", 1, 24), xyplot, true);
      jfreechart.setBackgroundPaint(Color.white);
      ChartPanel chartpanel = new ChartPanel(jfreechart, true);
      add(chartpanel);
    }
  static JFreeChart createChart(
      NavigableMap<TimeAxisKey, DiffStat> aggregatedDiffstats,
      DiffStatConfiguration configuration) {

    boolean legend = false;
    boolean tooltips = false;
    boolean urls = false;
    Font helvetica = new Font("Helvetica", Font.PLAIN, 11 * configuration.multiplierInt());

    XYDatasetMinMax datasetMinMax =
        createDeltaDataset("Additions and Delections", aggregatedDiffstats);
    XYDataset dataset = datasetMinMax.dataset;
    JFreeChart chart =
        ChartFactory.createTimeSeriesChart("", "", "", dataset, legend, tooltips, urls);

    chart.setBackgroundPaint(WHITE);
    chart.setBorderVisible(false);

    float strokeWidth = 1.2f * configuration.multiplierFloat();

    XYPlot plot = chart.getXYPlot();
    plot.setOrientation(VERTICAL);
    plot.setBackgroundPaint(WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(AXIS_LINE_COLOR);
    plot.setDomainGridlineStroke(new BasicStroke(1.0f * configuration.multiplierFloat()));
    plot.setRangeGridlinesVisible(false);

    plot.setOutlineVisible(false);

    DateAxis dateAxis = (DateAxis) plot.getDomainAxis();
    dateAxis.setDateFormatOverride(new SimpleDateFormat("MM/yy"));
    dateAxis.setTickLabelFont(helvetica);
    dateAxis.setAxisLineVisible(false);
    dateAxis.setTickUnit(computeDateTickUnit(aggregatedDiffstats));
    RectangleInsets insets =
        new RectangleInsets(
            8.0d * configuration.multiplierDouble(),
            4.0d * configuration.multiplierDouble(),
            4.0d * configuration.multiplierDouble(),
            4.0d * configuration.multiplierDouble());
    dateAxis.setTickLabelInsets(insets);

    NumberAxis additionDeletionAxis = (NumberAxis) plot.getRangeAxis(0);
    additionDeletionAxis.setAxisLineVisible(false);
    additionDeletionAxis.setLabel("Additions and Deletions");
    additionDeletionAxis.setLabelFont(helvetica);
    additionDeletionAxis.setTickLabelFont(helvetica);
    additionDeletionAxis.setRangeType(RangeType.FULL);
    int lowerBound = datasetMinMax.min + (int) (datasetMinMax.min * 0.1d);
    additionDeletionAxis.setLowerBound(lowerBound);
    int upperBound = datasetMinMax.max + (int) (datasetMinMax.max * 0.1d);
    additionDeletionAxis.setUpperBound(upperBound);
    additionDeletionAxis.setNumberFormatOverride(new AbbreviatingNumberFormat());
    additionDeletionAxis.setMinorTickMarksVisible(false);
    additionDeletionAxis.setTickMarkInsideLength(5.0f * configuration.multiplierFloat());
    additionDeletionAxis.setTickMarkOutsideLength(0.0f);
    additionDeletionAxis.setTickMarkStroke(new BasicStroke(2.0f * configuration.multiplierFloat()));
    additionDeletionAxis.setTickUnit(
        new NumberTickUnit(computeTickUnitSize(datasetMinMax.max + abs(datasetMinMax.min))));

    XYAreaRenderer areaRenderer = new XYAreaRenderer(XYAreaRenderer.AREA);
    areaRenderer.setOutline(true);
    areaRenderer.setSeriesOutlinePaint(0, ADDED_STROKE);
    areaRenderer.setSeriesOutlineStroke(0, new BasicStroke(strokeWidth));
    areaRenderer.setSeriesPaint(0, ADDED_FILL);
    areaRenderer.setSeriesOutlinePaint(1, REMOVED_STROKE);
    areaRenderer.setSeriesOutlineStroke(1, new BasicStroke(strokeWidth));
    areaRenderer.setSeriesPaint(1, REMOVED_FILL);
    plot.setRenderer(0, areaRenderer);

    // Total Axis
    NumberAxis totalAxis = new NumberAxis("Total Lines");
    totalAxis.setAxisLineVisible(false);
    totalAxis.setLabelPaint(VALUE_LABEL);
    totalAxis.setTickLabelPaint(TOTAL_LABEL);
    totalAxis.setLabelFont(helvetica);
    totalAxis.setTickLabelFont(helvetica);
    totalAxis.setNumberFormatOverride(new AbbreviatingNumberFormat());
    totalAxis.setMinorTickMarksVisible(false);
    totalAxis.setTickMarkInsideLength(5.0f * configuration.multiplierFloat());
    totalAxis.setTickMarkOutsideLength(0.0f);
    totalAxis.setTickMarkStroke(new BasicStroke(2.0f * configuration.multiplierFloat()));
    totalAxis.setTickMarkPaint(TOTAL_LABEL);
    plot.setRangeAxis(1, totalAxis);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

    XYDatasetAndTotal datasetAndTotal = createTotalDataset("Total Lines", aggregatedDiffstats);
    XYDataset totalDataSet = datasetAndTotal.dataset;
    plot.setDataset(1, totalDataSet);
    plot.mapDatasetToRangeAxis(1, 1);
    //        XYItemRenderer totalRenderer = new XYSplineRenderer();
    XYItemRenderer totalRenderer = new StandardXYItemRenderer();
    totalRenderer.setSeriesPaint(0, TOTAL_FILL);
    totalRenderer.setSeriesStroke(
        0,
        new BasicStroke(
            strokeWidth,
            CAP_ROUND,
            JOIN_ROUND,
            10.0f * configuration.multiplierFloat(),
            new float[] {
              6.0f * configuration.multiplierFloat(), 3.0f * configuration.multiplierFloat()
            },
            0.0f));
    plot.setRenderer(1, totalRenderer);

    totalAxis.setTickUnit(new NumberTickUnit(computeTickUnitSize(datasetAndTotal.total)));

    return chart;
  }
  /**
   * Add axis
   *
   * @param name new axis name
   */
  @Override
  public final void addAxis(String name) {
    boolean encontrado = false;
    for (AxisChart categoria : axes) {
      if (categoria.getName().equals(name)) {
        encontrado = true;
        break;
      }
    }
    if (!encontrado) {
      axes.add(new AxisChart((name)));
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    NumberAxis ejeOrdenada = new NumberAxis(name);

    ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    ejeOrdenada.setLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize));
    ejeOrdenada.setTickLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize));

    int i = datasetList.size();

    datasetList.add(dataset);
    AxesList.add(ejeOrdenada);
    plot.setDataset(i, dataset);
    plot.setRangeAxis(i, ejeOrdenada);
    plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_LEFT);
    plot.mapDatasetToRangeAxis(i, i);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, true);
    if (i == 0) {
      plot.setRenderer(renderer);
    } else {
      plot.setRenderer(i, renderer);
    }

    final LegendAxis le;
    final int indiceLeyenda = legendFrame.getChildren().size();

    legendFrame.getChildren().add(le = new LegendAxis(name));

    le.setOnMouseClicked(
        (MouseEvent t) -> {
          if (le.selected && t.getClickCount() == 2) {
            setOrdinateRange(AxesList.get(indiceLeyenda));
          }
        });

    le.setOnMouseEntered(
        (MouseEvent t) -> {
          le.setStyle("-fx-background-color:blue");
          le.selected = true;
          AxesList.get(indiceLeyenda)
              .setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web("blue")));
          AxesList.get(indiceLeyenda)
              .setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web("blue")));
        });

    le.setOnMouseExited(
        (MouseEvent t) -> {
          le.setStyle("-fx-background-color:" + strBackgroundColor);
          le.selected = false;
          AxesList.get(indiceLeyenda)
              .setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
          AxesList.get(indiceLeyenda)
              .setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
        });
  }
 protected void configureRangeAxis(NumberAxis rangeAxis) {
   rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
   rangeAxis.setTickLabelFont(CHART_FONT);
   rangeAxis.setLabelFont(CHART_FONT);
 }
  public JFreeChart getChart(CategoryDataset dataset) {
    // create the chart...
    final JFreeChart chart =
        ChartFactory.createBarChart3D(
            "Загрузка данных", // chart title
            "Дата", // domain axis label
            "Значение (кб.)", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
            );

    //		#44639C;

    TextTitle title = new TextTitle("Динамика загрузки данных", labelFont);
    //		Paint paint = title.getPaint();
    title.setPaint(new Color(68, 99, 156));
    chart.setTitle(title);

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    // final IntervalMarker target = new IntervalMarker(2000000, 3000000);
    // target.setLabel("Ожидаемый диапазон");
    // target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    // target.setLabelAnchor(RectangleAnchor.LEFT);
    // target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    // target.setPaint(new Color(222, 222, 255, 128));
    // plot.addRangeMarker(target, Layer.BACKGROUND);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setTickLabelFont(labelFont);

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setItemMargin(0.10);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.blue);
    final GradientPaint gp1 =
        new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(
        CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 4.0)
        // CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)
        );
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;
  }
  private JFreeChart createChart() {

    // create the chart...
    JFreeChart chart =
        ChartFactory.createXYLineChart(
            null, // chart title
            null, // x axis label
            null, // y axis label
            null, // data
            PlotOrientation.VERTICAL,
            false, // include legend
            true, // tooltips
            false // urls
            );

    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customization...
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

    // domain axis

    if ((indexAxis >= 0) && (!dataTable.isNominal(indexAxis))) {
      if ((dataTable.isDate(indexAxis)) || (dataTable.isDateTime(indexAxis))) {
        DateAxis domainAxis = new DateAxis(dataTable.getColumnName(indexAxis));
        domainAxis.setTimeZone(Tools.getPreferredTimeZone());
        chart.getXYPlot().setDomainAxis(domainAxis);
      }
    } else {
      plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US));
      ((NumberAxis) plot.getDomainAxis()).setAutoRangeStickyZero(false);
      ((NumberAxis) plot.getDomainAxis()).setAutoRangeIncludesZero(false);
    }
    ValueAxis xAxis = plot.getDomainAxis();
    if (indexAxis > -1) xAxis.setLabel(getDataTable().getColumnName(indexAxis));
    else xAxis.setLabel(SERIESINDEX_LABEL);
    xAxis.setAutoRange(true);
    xAxis.setLabelFont(LABEL_FONT_BOLD);
    xAxis.setTickLabelFont(LABEL_FONT);
    xAxis.setVerticalTickLabels(isLabelRotating());
    if (indexAxis > 0) {
      if (getRangeForDimension(indexAxis) != null) {
        xAxis.setRange(getRangeForDimension(indexAxis));
      }
    } else {
      if (getRangeForName(SERIESINDEX_LABEL) != null) {
        xAxis.setRange(getRangeForName(SERIESINDEX_LABEL));
      }
    }

    // renderer and range axis
    synchronized (dataTable) {
      int numberOfSelectedColumns = 0;
      for (int c = 0; c < dataTable.getNumberOfColumns(); c++) {
        if (getPlotColumn(c)) {
          if (dataTable.isNumerical(c)) {
            numberOfSelectedColumns++;
          }
        }
      }

      int columnCount = 0;
      for (int c = 0; c < dataTable.getNumberOfColumns(); c++) {
        if (getPlotColumn(c)) {
          if (dataTable.isNumerical(c)) {
            // YIntervalSeries series = new YIntervalSeries(this.dataTable.getColumnName(c));
            XYSeriesCollection dataset = new XYSeriesCollection();
            XYSeries series = new XYSeries(dataTable.getColumnName(c));
            Iterator<DataTableRow> i = dataTable.iterator();
            int index = 1;
            while (i.hasNext()) {
              DataTableRow row = i.next();
              double value = row.getValue(c);

              if ((indexAxis >= 0) && (!dataTable.isNominal(indexAxis))) {
                double indexValue = row.getValue(indexAxis);
                series.add(indexValue, value);
              } else {
                series.add(index++, value);
              }
            }
            dataset.addSeries(series);

            XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

            Color color = getColorProvider().getPointColor(1.0d);
            if (numberOfSelectedColumns > 1) {
              color =
                  getColorProvider()
                      .getPointColor(columnCount / (double) (numberOfSelectedColumns - 1));
            }
            renderer.setSeriesPaint(0, color);
            renderer.setSeriesStroke(
                0, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
            renderer.setSeriesShapesVisible(0, false);

            NumberAxis yAxis = new NumberAxis(dataTable.getColumnName(c));
            if (getRangeForDimension(c) != null) {
              yAxis.setRange(getRangeForDimension(c));
            } else {
              yAxis.setAutoRange(true);
              yAxis.setAutoRangeStickyZero(false);
              yAxis.setAutoRangeIncludesZero(false);
            }
            yAxis.setLabelFont(LABEL_FONT_BOLD);
            yAxis.setTickLabelFont(LABEL_FONT);
            if (numberOfSelectedColumns > 1) {
              yAxis.setAxisLinePaint(color);
              yAxis.setTickMarkPaint(color);
              yAxis.setLabelPaint(color);
              yAxis.setTickLabelPaint(color);
            }

            plot.setRangeAxis(columnCount, yAxis);
            plot.setRangeAxisLocation(columnCount, AxisLocation.TOP_OR_LEFT);

            plot.setDataset(columnCount, dataset);
            plot.setRenderer(columnCount, renderer);
            plot.mapDatasetToRangeAxis(columnCount, columnCount);

            columnCount++;
          }
        }
      }
    }

    chart.setBackgroundPaint(Color.white);

    return chart;
  }