Package org.swtchart

Examples of org.swtchart.Range


     * @param update
     *            true if updating chart layout
     */
    public void adjustRange(boolean update) {
        if (isValidCategoryAxis()) {
            setRange(new Range(0, categorySeries.length - 1));
            return;
        }

        double minimum = Double.NaN;
        double maximum = Double.NaN;
        for (ISeries series : chart.getSeriesSet().getSeries()) {
            int axisId = direction == Direction.X ? series.getXAxisId()
                    : series.getYAxisId();
            if (!series.isVisible() || getId() != axisId) {
                continue;
            }

            // get axis length
            int length;
            if (isHorizontalAxis) {
                length = chart.getPlotArea().getSize().x;
            } else {
                length = chart.getPlotArea().getSize().y;
            }

            // get min and max value of series
            Range range = ((Series) series).getAdjustedRange(this, length);
            if (Double.isNaN(minimum) || range.lower < minimum) {
                minimum = range.lower;
            }
            if (Double.isNaN(maximum) || range.upper > maximum) {
                maximum = range.upper;
            }
        }

        // set adjusted range
        if (!Double.isNaN(minimum) && !Double.isNaN(maximum)) {
            if (minimum == maximum) {
                double margin = (minimum == 0)? 1d : Math.abs(minimum / 2d);
                minimum -= margin;
                maximum += margin;
            }
            setRange(new Range(minimum, maximum), update);
        }
    }
View Full Code Here


        } else {
            lower = min + 2 * ZOOM_RATIO * (coordinate - min);
            upper = max + 2 * ZOOM_RATIO * (coordinate - max);
        }

        setRange(new Range(lower, upper));
    }
View Full Code Here

        } else {
            lower = (min - 2 * ZOOM_RATIO * coordinate) / (1 - 2 * ZOOM_RATIO);
            upper = (max - 2 * ZOOM_RATIO * coordinate) / (1 - 2 * ZOOM_RATIO);
        }

        setRange(new Range(lower, upper));
    }
View Full Code Here

        } else {
            lower = min + (max - min) * SCROLL_RATIO;
            upper = max + (max - min) * SCROLL_RATIO;
        }

        setRange(new Range(lower, upper));
    }
View Full Code Here

        } else {
            lower = min - (max - min) * SCROLL_RATIO;
            upper = max - (max - min) * SCROLL_RATIO;
        }

        setRange(new Range(lower, upper));
    }
View Full Code Here

        }

        double min = axis.getDataCoordinate(range.x);
        double max = axis.getDataCoordinate(range.y);

        axis.setRange(new Range(min, max));
    }
View Full Code Here

                                        serie.getValues(totals), //
                                        getRenderer().getColorFor(serie.node));
                    }

                    chart.getAxisSet().adjustRange();
                    chart.getAxisSet().getYAxis(0).setRange(new Range(-0.01, 1.01));
                }
                finally
                {
                    chart.suspendUpdate(false);
                    chart.redraw();
View Full Code Here

    }

    private void paintTimeGrid(PaintEvent e)
    {
        IAxis xAxis = getAxisSet().getXAxis(0);
        Range range = xAxis.getRange();

        final DateMidnight start = dates.get(0);
        final DateMidnight end = dates.get(dates.size() - 1);

        int totalDays = Days.daysBetween(start, end).getDays() + 1;
View Full Code Here

    }

    private void paintTimeGrid(PaintEvent e)
    {
        IAxis xAxis = getAxisSet().getXAxis(0);
        Range range = xAxis.getRange();
        Date upper = new Date((long) range.upper);

        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date((long) range.lower));
        cal.add(Calendar.YEAR, 1);
View Full Code Here

                try
                {
                    for (IAxis axis : chart.getAxisSet().getXAxes())
                    {
                        Range range = new Range(axis.getDataCoordinate(rectangle.x), axis.getDataCoordinate(rectangle.x
                                        + rectangle.width));
                        axis.setRange(range);
                    }

                    for (IAxis axis : chart.getAxisSet().getYAxes())
                    {
                        Range range = new Range(axis.getDataCoordinate(rectangle.y), axis.getDataCoordinate(rectangle.y
                                        + rectangle.height));
                        axis.setRange(range);
                    }
                }
                catch (IllegalArgumentException ignore)
View Full Code Here

TOP

Related Classes of org.swtchart.Range

Copyright © 2018 www.massapicom. 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.