Examples of XYDataSeries


Examples of com.arjuna.ats.tools.perfgraph.graphbean.XYDataSeries

    boolean minMaxSet = false;

        for (int count=0;count<_dataSeries.size();count++)
        {
            XYDataSeries d = (XYDataSeries)_dataSeries.elementAt(count);

      if ( _visibleSeries.contains(d) )
      {
        minMaxSet = true;
        _minX = (d.getMinX() < _minX) ? d.getMinX() : _minX;
        _minY = (d.getMinY() < _minY) ? d.getMinY() : _minY;
        _maxX = (d.getMaxX() > _maxX) ? d.getMaxX() : _maxX;
        _maxY = (d.getMaxY() > _maxY) ? d.getMaxY() : _maxY;
      }
        }

    if ( !minMaxSet )
    {
View Full Code Here

Examples of com.arjuna.ats.tools.perfgraph.graphbean.XYDataSeries

    g.drawRect((int)graphRect.getX() + (int)graphRect.getWidth() + 10, (int)graphRect.getY() + 10, 100, (_dataSeries.size() * 12) + 20);
    g.drawString("Legend", (int)graphRect.getX() + (int)graphRect.getWidth() + 12, (int)graphRect.getY() + 22);

    for (int count=0;count<_dataSeries.size();count++)
    {
      XYDataSeries series = (XYDataSeries)_dataSeries.get(count);
      g.setColor(series.getSeriesColour());
      g.drawString( series.getName(), (int)graphRect.getX() + (int)graphRect.getWidth() + 12, (int)graphRect.getY() + 40 + (count*12));
    }

        /**
         * Draw the axis
         *
         *5|                        Pixels / Value
         *0|                        1 / 5
         *5| 1                      1 / (1/5)
         *0|
         *5|    2
         * +--------
         */
        g.setColor( Color.gray );
        g.drawLine( (int)graphRect.getX(), (int)graphRect.getY(), (int)graphRect.getX(), (int)( graphRect.getY() + graphRect.getHeight() ) );
        g.drawLine( (int)graphRect.getX(), (int)( graphRect.getY() + graphRect.getHeight() ), (int)(graphRect.getX() + graphRect.getWidth()), (int)(graphRect.getY() + graphRect.getHeight()) );

        double scaleY = graphRect.getHeight() / (_maxY - _minY); // Pixels per value
        double scaleX = graphRect.getWidth() / (_maxX - _minX);
        double incY = (graphRect.getHeight() / _numIncY);

        for (int count=0;count<=_numIncY;count++)
        {
            String label = numFormat.format(_minY + ((_maxY - _minY)/_numIncY)*(_numIncY - count));
            Rectangle2D labelRect = g.getFontMetrics().getStringBounds(label,g);

            g.setColor(Color.black);
            g.drawString( label, (int)graphRect.getX() - (int)labelRect.getWidth() - 2, (int)(count * incY) + (int)graphRect.getY() + 5 );
            g.drawLine((int)graphRect.getX(), (int)(count * incY) + (int)graphRect.getY(), (int)graphRect.getX() - 2, (int)(count * incY) + (int)graphRect.getY());

            g.setColor(Color.lightGray);
            g.drawLine((int)graphRect.getX() + 1, (int)(count * incY) + (int)graphRect.getY(), (int)graphRect.getMaxX(), (int)(count * incY) + (int)graphRect.getY());
        }

        double incX = (graphRect.getWidth() / _numIncX);
        for (int count=0;count<=_numIncX;count++)
        {
            g.setColor(Color.black);

            BufferedImage img = createYAxisLabel(g, numFormat.format((_minX +((_maxX - _minX)/_numIncX)*(count))));
            maxLabelHeight = (img.getHeight() > maxLabelHeight) ? img.getHeight() : maxLabelHeight;
            g.drawImage( img, (int)(count * incX) + (int)graphRect.getX() - 8, (int)(graphRect.getY() + graphRect.getHeight() + 15),this);
            g.drawLine( (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY() + graphRect.getHeight()),
                        (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY() + graphRect.getHeight()) + 2 );

            g.setColor(Color.lightGray);
            g.drawLine( (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY() + graphRect.getHeight() - 1),
                        (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY()) );
        }

        g.setColor(Color.black);
        Rectangle2D xAxisLabelRect = g.getFontMetrics().getStringBounds(getXAxisLabel(),g);
        g.drawString(getXAxisLabel(), (int)graphRect.getCenterX() - (int)(xAxisLabelRect.getWidth() / 2), height - 5);
        g.drawImage(_yAxisLabel, (int)(graphRect.getX() - maxLabelWidth - 10), (int)graphRect.getCenterY() - _yAxisLabel.getHeight(), this);

        for (int count=0;count<_dataSeries.size();count++)
        {
            XYDataSeries dataSeries = ((XYDataSeries)_dataSeries.elementAt(count));
            XYDataPoint[] points = dataSeries.getDataSeries();
            XYDataPoint previous = null;

      if ( _visibleSeries.contains(dataSeries) )
      {
        if (dataSeries.getBeginAtOrigin())
        {
          previous = new XYDataPoint(_minX,_minY);
        }
        else
        {
          if (points.length!=0)
          {
            previous = points[0];
          }
          else
          {
            previous = new XYDataPoint(_minX, _minY);
          }
        }

        g.setColor(dataSeries.getSeriesColour());

        for (int pCount=0;pCount<points.length;pCount++)
        {
          int xPosition = (int)graphRect.getX() + (int)( ( points[pCount].getX() - _minX ) * scaleX );
          int xPreviousPosition = (int)graphRect.getX() + (int)( ( previous.getX() - _minX ) * scaleX );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.