Example usage for java.awt BasicStroke BasicStroke

List of usage examples for java.awt BasicStroke BasicStroke

Introduction

In this page you can find the example usage for java.awt BasicStroke BasicStroke.

Prototype

public BasicStroke(float width) 

Source Link

Document

Constructs a solid BasicStroke with the specified line width and with default values for the cap and join styles.

Usage

From source file:org.jreserve.gui.calculations.factor.editor.DevelopmentFactorPlot.java

private Component createPlotComponent() {

    boolean legend = true;
    boolean tooltips = false;
    boolean urls = false;
    chart = ChartFactory.createLineChart(null, null, null, dataSet, PlotOrientation.VERTICAL, legend, tooltips,
            urls);/*from  w w  w  .j a  v  a  2 s . c om*/

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.GRAY);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.WHITE);

    NumberAxis axis = (NumberAxis) plot.getRangeAxis();
    axis.setAutoRangeIncludesZero(false);
    axis.setAutoRangeStickyZero(true);

    renderer = plot.getRenderer();
    if (renderer instanceof LineAndShapeRenderer) {
        LineAndShapeRenderer lasr = (LineAndShapeRenderer) renderer;
        lasr.setBaseShapesVisible(true);
        lasr.setDrawOutlines(true);
        lasr.setUseFillPaint(true);
        lasr.setBaseStroke(new BasicStroke(2));

        int r = 3;
        Shape circle = new Ellipse2D.Float(-r, -r, 2 * r, 2 * r);
        int count = dataSet.getRowCount();
        for (int i = 0; i < count; i++) {
            PlotLabel label = (PlotLabel) dataSet.getRowKey(i);
            boolean isLr = label.getId() >= developments;

            Color color = isLr ? LINK_RATIO : FACTOR;
            lasr.setSeriesPaint(i, color);
            lasr.setSeriesFillPaint(i, color);
            lasr.setSeriesShape(i, circle);

            lasr.setSeriesShapesVisible(i, !isLr);
            lasr.setSeriesLinesVisible(i, isLr);
        }
    }

    return new ChartPanel(chart);
}

From source file:au.edu.uwa.csse.plot.Clustering.java

private void setUpView(Graph graph) throws IOException {

    //Create a simple layout frame
    //specify the Fruchterman-Rheingold layout algorithm
    final AggregateLayout<Integer, Number> layout = new AggregateLayout<Integer, Number>(
            new FRLayout<Integer, Number>(graph));

    vv = new VisualizationViewer<Integer, Number>(layout);
    vv.setBackground(Color.white);
    vv.setVertexToolTipTransformer(Plot.vertexLabelTransformer);
    //Tell the renderer to use our own customized color rendering
    vv.getRenderContext()//from   w ww  .  ja  v  a  2  s . co m
            .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.cyan;
            } else {
                return Color.BLACK;
            }
        }
    });

    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        protected final Stroke THICK = new BasicStroke(2);

        public Stroke transform(Number e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY)
                return THIN;
            else
                return THICK;
        }
    });

    //add restart button
    JButton scramble = new JButton("Restart");
    scramble.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Layout layout = vv.getGraphLayout();
            layout.initialize();
            Relaxer relaxer = vv.getModel().getRelaxer();
            if (relaxer != null) {
                relaxer.stop();
                relaxer.prerelax();
                relaxer.relax();
            }
        }

    });

    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");

    //Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(graph.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    //      edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black));
    //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):"));
    //I also want the slider value to appear
    final JPanel eastControls = new JPanel();
    eastControls.setOpaque(true);
    eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS));
    eastControls.add(Box.createVerticalGlue());
    eastControls.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    eastControls.setBorder(sliderBorder);
    //eastControls.add(eastSize);
    eastControls.add(Box.createVerticalGlue());

    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                eastControls.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });

    Container content = getContentPane();
    content.add(new GraphZoomScrollPane(vv));
    JPanel south = new JPanel();
    JPanel grid = new JPanel(new GridLayout(2, 1));
    grid.add(scramble);
    grid.add(groupVertices);
    south.add(grid);
    south.add(eastControls);
    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    p.add(gm.getModeComboBox());
    south.add(p);
    content.add(south, BorderLayout.SOUTH);
}

From source file:tl.lib.dataCollection.gui.NumXYChart.java

public void addPoint(SourceId sourceId, double x, double y) {
    if (default_all && !selected.contains(sourceId))
        selected.add(sourceId);/*  w  w  w .j av  a2  s.  co  m*/
    if (selected.contains(sourceId)) {
        if (collection.indexOf(sourceId) < 0) {
            XYSeries series = new XYSeries(sourceId);
            collection.addSeries(series);
            XYItemRenderer renderer = plot.getRenderer();
            renderer.setSeriesPaint(collection.indexOf(sourceId), sourceDescriptor.getColor(sourceId));
            BasicStroke wideLine = new BasicStroke(1.0f);
            renderer.setSeriesStroke(collection.indexOf(sourceId), wideLine);
        }
        collection.getSeries(sourceId).add(x, y);
    }
}

From source file:org.adempiere.webui.apps.graph.WPerformanceIndicator.java

private JFreeChart createChart() {
    JFreeChart chart = null;/*from  w w w.j  a  v a  2  s.co  m*/

    //   Set Text
    StringBuffer text = new StringBuffer(m_goal.getName());
    if (m_goal.isTarget())
        text.append(": ").append(m_goal.getPercent()).append("%");
    else
        text.append(": ").append(s_format.format(m_goal.getMeasureActual()));

    m_text = text.toString();

    //   ToolTip
    text = new StringBuffer();
    if (m_goal.getDescription() != null)
        text.append(m_goal.getDescription()).append(": ");
    text.append(s_format.format(m_goal.getMeasureActual()));
    if (m_goal.isTarget())
        text.append(" ").append(Msg.getMsg(Env.getCtx(), "of")).append(" ")
                .append(s_format.format(m_goal.getMeasureTarget()));
    setTooltiptext(text.toString());
    //
    DefaultValueDataset data = new DefaultValueDataset((float) m_goal.getPercent());
    MeterPlot plot = new MeterPlot(data);

    MColorSchema colorSchema = m_goal.getColorSchema();
    int rangeLo = 0;
    int rangeHi = 0;
    for (int i = 1; i <= 4; i++) {
        switch (i) {
        case 1:
            rangeHi = colorSchema.getMark1Percent();
            break;
        case 2:
            rangeHi = colorSchema.getMark2Percent();
            break;
        case 3:
            rangeHi = colorSchema.getMark3Percent();
            break;
        case 4:
            rangeHi = colorSchema.getMark4Percent();
            break;
        }
        if (rangeHi == 9999)
            rangeHi = (int) Math.floor(rangeLo * 1.5);
        if (rangeLo < rangeHi) {
            plot.addInterval(new MeterInterval("Normal", //label
                    new Range(rangeLo, rangeHi), //range
                    colorSchema.getColor(rangeHi), new BasicStroke(7.0f), new Color(-13091716)));
            rangeLo = rangeHi;
        }
    }
    plot.setRange(new Range(0, rangeLo));

    plot.setDialBackgroundPaint(new Color(-13091716));
    plot.setUnits("");
    plot.setDialShape(DialShape.CHORD);//CIRCLE);
    plot.setNeedlePaint(Color.white);
    plot.setTickSize(2000);
    plot.setTickLabelFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setValueFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setNoDataMessageFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setTickLabelPaint(Color.white);
    plot.setInsets(new RectangleInsets(1.0, 2.0, 3.0, 4.0));

    chart = new JFreeChart(m_text, new Font("SansSerif", Font.BOLD, 9), plot, false);

    return chart;
}

From source file:gov.nih.nci.rembrandt.web.plots.RBTPrincipalComponentAnalysisPlot.java

/**
 * This chart uses the XYAnnotation as a glyph to represent
 * a single pca data point. Glyph shape is determined by survival time.
 * Survival of more than 10 months is represented by a circle. 10 months or less
 * is represented by a square. Component1 values are represented by X 
 * Component2 values are represented by Y
 *//*w  w w .j a v  a 2s.c om*/
protected void createGlyphsAndAddToPlot(XYPlot plot) {

    //for RBT, if its non_tumor, show a diamond meaning "N/A for survival"

    XYShapeAnnotation glyph;
    Shape glyphShape;
    Color glyphColor;

    PrincipalComponentAnalysisDataPoint pcaPoint;
    double x, y;
    for (Iterator i = dataPoints.iterator(); i.hasNext();) {
        pcaPoint = (PrincipalComponentAnalysisDataPoint) i.next();

        x = pcaPoint.getComponentValue(component1);
        y = pcaPoint.getComponentValue(component2);
        double survival = pcaPoint.getSurvivalInMonths();
        String diseaseName = pcaPoint.getDiseaseName();

        if (this.colorBy.equals(PCAcolorByType.NONE)) {
            Ellipse2D.Double circle = new Ellipse2D.Double();
            circle.setFrameFromCenter(x, y, x + 2, y + 2);
            glyphShape = circle;
        } else if (diseaseName.equals(RembrandtConstants.NON_TUMOR) || diseaseName.equals("CELL_LINE")) {
            //glyphShape = ShapeUtilities.createDiamond(new Float(x));
            Rectangle2D.Double rect = new Rectangle2D.Double();
            rect.setFrameFromCenter(x, y, x + 2, y + 2);
            glyphShape = rect;
            Shape gShape = ShapeUtilities.rotateShape(glyphShape, new Double(0.785398163), new Float(x),
                    new Float(y));
            glyphShape = gShape;
        } else if ((survival > 0) && (survival < 10.0)) {
            Rectangle2D.Double rect = new Rectangle2D.Double();
            rect.setFrameFromCenter(x, y, x + 2, y + 2);
            glyphShape = rect;
        } else if ((survival > 0) && (survival >= 10.0)) {
            Ellipse2D.Double circle = new Ellipse2D.Double();
            circle.setFrameFromCenter(x, y, x + 2, y + 2);
            glyphShape = circle;
        } else {
            GeneralPath gp = new GeneralPath();
            float xf = (float) x;
            float yf = (float) y;
            //make a triangle
            gp.moveTo(xf, yf);
            gp.lineTo(xf + 3.0f, yf - 3.0f);
            gp.lineTo(xf - 3.0f, yf - 3.0f);
            gp.closePath();
            glyphShape = gp;
        }

        glyphColor = getColorForDataPoint(pcaPoint);
        glyph = new XYShapeAnnotation(glyphShape, new BasicStroke(1.0f), Color.BLACK, glyphColor);
        String tooltip = "";
        if (pcaPoint.getSurvivalInMonths() <= 0.0) {
            tooltip = pcaPoint.getSampleId() + " " + pcaPoint.getDiseaseName();
        } else {
            tooltip = pcaPoint.getSampleId() + " " + pcaPoint.getDiseaseName() + " survivalMonths="
                    + nf.format(pcaPoint.getSurvivalInMonths());
        }
        glyph.setToolTipText(tooltip);
        plot.addAnnotation(glyph);
    }

}

From source file:com.rcp.wbw.demo.editor.SWTPlotAppearanceEditor.java

SWTPlotAppearanceEditor(Composite parent, int style, Plot plot) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);/* w ww .  jav a  2  s.  c om*/

    Group general = new Group(this, SWT.NONE);
    GridLayout groupLayout = new GridLayout(3, false);
    groupLayout.marginHeight = groupLayout.marginWidth = 4;
    general.setLayout(groupLayout);
    general.setText(localizationResources.getString("General"));

    // row 1: stroke
    new Label(general, SWT.NONE).setText(localizationResources.getString("Outline_stroke"));
    this.strokeCanvas = new SWTStrokeCanvas(general, SWT.NONE);
    this.strokeCanvas.setStroke(plot.getOutlineStroke());
    GridData strokeGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    strokeGridData.heightHint = 20;
    this.strokeCanvas.setLayoutData(strokeGridData);
    this.selectStroke = new Spinner(general, SWT.BORDER);
    this.selectStroke.setMinimum(1);
    this.selectStroke.setMaximum(3);
    this.selectStroke.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    this.selectStroke.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            int w = SWTPlotAppearanceEditor.this.selectStroke.getSelection();
            if (w > 0) {
                SWTPlotAppearanceEditor.this.strokeCanvas.setStroke(new BasicStroke(w));
                SWTPlotAppearanceEditor.this.strokeCanvas.redraw();
            }
        }
    });
    // row 2: outline color
    new Label(general, SWT.NONE).setText(localizationResources.getString("Outline_Paint"));
    this.outlinePaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), plot.getOutlinePaint()));
    GridData outlineGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    outlineGridData.heightHint = 20;
    this.outlinePaintCanvas.setLayoutData(outlineGridData);
    Button selectOutlineColor = new Button(general, SWT.PUSH);
    selectOutlineColor.setText(localizationResources.getString("Select..."));
    selectOutlineColor.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    selectOutlineColor.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(getShell());
            dlg.setText(localizationResources.getString("Outline_Paint"));
            dlg.setRGB(SWTPlotAppearanceEditor.this.outlinePaintCanvas.getColor().getRGB());
            RGB rgb = dlg.open();
            if (rgb != null) {
                SWTPlotAppearanceEditor.this.outlinePaintCanvas.setColor(new Color(getDisplay(), rgb));
            }
        }
    });
    // row 3: background paint
    new Label(general, SWT.NONE).setText(localizationResources.getString("Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), plot.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    selectBgPaint.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(getShell());
            dlg.setText(localizationResources.getString("Background_paint"));
            dlg.setRGB(SWTPlotAppearanceEditor.this.backgroundPaintCanvas.getColor().getRGB());
            RGB rgb = dlg.open();
            if (rgb != null) {
                SWTPlotAppearanceEditor.this.backgroundPaintCanvas.setColor(new Color(getDisplay(), rgb));
            }
        }
    });
    // row 4: orientation
    if (plot instanceof CategoryPlot) {
        this.plotOrientation = ((CategoryPlot) plot).getOrientation();
    } else if (plot instanceof XYPlot) {
        this.plotOrientation = ((XYPlot) plot).getOrientation();
    }
    if (this.plotOrientation != null) {
        boolean isVertical = this.plotOrientation.equals(PlotOrientation.VERTICAL);
        int index = isVertical ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL;
        new Label(general, SWT.NONE).setText(localizationResources.getString("Orientation"));
        this.orientation = new Combo(general, SWT.DROP_DOWN);
        this.orientation.setItems(orientationNames);
        this.orientation.select(index);
        this.orientation.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 2, 1));
        this.orientation.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                switch (SWTPlotAppearanceEditor.this.orientation.getSelectionIndex()) {
                case ORIENTATION_VERTICAL:
                    SWTPlotAppearanceEditor.this.plotOrientation = PlotOrientation.VERTICAL;
                    break;
                case ORIENTATION_HORIZONTAL:
                    SWTPlotAppearanceEditor.this.plotOrientation = PlotOrientation.HORIZONTAL;
                    break;
                default:
                    SWTPlotAppearanceEditor.this.plotOrientation = PlotOrientation.VERTICAL;
                }
            }
        });
    }
}

From source file:org.ash.detail.StackedChartDetail.java

/**
 * Sets the threshold begin time auto selection.
 * /*from  w  w  w .  j  a v  a  2  s.  c o m*/
 * @param beginTime the begin time
 * @param range the range
 */
public synchronized void setThresholdBeginTimeAutoSelection(double beginTime, int range) {
    plot.removeDomainMarker(currentEnd);
    currentEnd = new ValueMarker(beginTime);
    currentEnd.setPaint(Color.red);
    currentEnd.setLabel(range + " min");
    currentEnd.setStroke(new BasicStroke(1.0f));
    currentEnd.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    currentEnd.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    plot.addDomainMarker(currentEnd);
}

From source file:grafix.graficos.eixos.Eixo.java

private void incluirEixoX(XYPlot plot) {
    if (Controle.getConfiguracoesUsuario().isExibeEixoX()) {
        ValueMarker mx = new ValueMarker(0);
        mx.setPaint(Color.BLACK);
        mx.setStroke(new BasicStroke(.9f));
        mx.setAlpha(1.0f);//  ww  w  . j a  v  a2s  .c  o  m
        plot.addRangeMarker(mx);
    }
}

From source file:by.bsu.zmiecer.PieChartDemo1.java

/**
 * Creates a chart./*ww  w  .  j a v  a 2 s .  com*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("   ", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(0, 255, 11), new Point(400, 200), Color.BLUE));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    //plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    //plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    //plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    //plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    /*
    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
        new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    */
    return chart;

}

From source file:ecg.ecgshow.ECGShowUI.java

private void createECGData(long timeZone) {
    ECGData = new JPanel(new GridLayout(LEAD_COUNT, 1));
    dateAxises = new DateAxis[LEAD_COUNT];
    ECGSeries = new TimeSeries[LEAD_COUNT * 2];
    for (int i = 0; i < LEAD_COUNT; i++) {
        TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(); //XYDataset  TimeSeriesCollection
        ECGSeries[i] = new TimeSeries("?" + (i + 1));
        ECGSeries[i].setMaximumItemCount(500);
        ECGSeries[i + LEAD_COUNT] = new TimeSeries("");
        ECGSeries[i + LEAD_COUNT].setMaximumItemAge(timeZone);
        ECGSeries[i + LEAD_COUNT].setMaximumItemCount(2);

        timeseriescollection.addSeries(ECGSeries[i]);
        timeseriescollection.addSeries(ECGSeries[i + LEAD_COUNT]);

        //DateAxis dateaxis = new DateAxis("Time");
        dateAxises[i] = new DateAxis("");
        dateAxises[i].setTickLabelFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.016)));
        dateAxises[i].setLabelFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.018)));
        dateAxises[i].setTickLabelsVisible(true);
        dateAxises[i].setVisible(false);

        //NumberAxis numberaxis = new NumberAxis("ecg");
        NumberAxis numberaxis = new NumberAxis("ecg");
        numberaxis.setTickLabelFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.016)));
        numberaxis.setLabelFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.018)));
        numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        numberaxis.setVisible(false);/* w  w  w . j  a  v  a2s  .  c  om*/
        numberaxis.setLowerBound(1500D);
        numberaxis.setUpperBound(3000D);

        XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
        xylineandshaperenderer.setSeriesPaint(0, Color.GREEN); //
        xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(2));
        xylineandshaperenderer.setSeriesPaint(1, Color.LIGHT_GRAY); //
        xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(5));

        XYPlot xyplot = new XYPlot(timeseriescollection, dateAxises[i], numberaxis, xylineandshaperenderer);
        xyplot.setBackgroundPaint(Color.LIGHT_GRAY);
        xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);
        xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY);
        xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
        xyplot.setBackgroundPaint(Color.BLACK);

        JFreeChart jfreechart = new JFreeChart(xyplot);
        jfreechart.setBackgroundPaint(new Color(237, 237, 237));//?
        jfreechart.getLegend().setVisible(false);

        ChartPanel chartpanel = new ChartPanel(jfreechart, (int) (WIDTH * 46 / 100), (int) (HEIGHT * 17 / 100),
                0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, false, true, false, false);

        chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0) //??0
                , BorderFactory.createEmptyBorder() //????
        ));
        chartpanel.setMouseZoomable(false); //?
        ECGData.add(chartpanel);
    }
}