Package org.swtchart.internal.axis

Examples of org.swtchart.internal.axis.Axis


        series.setXAxisId(xAxisIds[0]);
        series.setYAxisId(yAxisIds[0]);

        seriesMap.put(identifier, series);

        Axis axis = (Axis) chart.getAxisSet().getXAxis(xAxisIds[0]);
        if (axis != null) {
            updateStackAndRiserData();
        }

        // legend will be shown if there is previously no series.
View Full Code Here


     * @return the Y range of series
     */
    public Range getYRange() {
        double min = minY;
        double max = maxY;
        Axis xAxis = (Axis) chart.getAxisSet().getXAxis(xAxisId);
        if (isValidStackSeries() && xAxis.isValidCategoryAxis()) {
            for (int i = 0; i < stackSeries.length; i++) {
                if (max < stackSeries[i]) {
                    max = stackSeries[i];
                }
            }
View Full Code Here

                || xSeries.length == 0 || ySeries == null
                || ySeries.length == 0) {
            return;
        }

        Axis xAxis = (Axis) chart.getAxisSet().getXAxis(getXAxisId());
        Axis yAxis = (Axis) chart.getAxisSet().getYAxis(getYAxisId());
        if (xAxis == null || yAxis == null) {
            return;
        }

        draw(gc, width, height, xAxis, yAxis);
View Full Code Here

     * Gets the array of bar rectangles for compressed series.
     *
     * @return the array of bar rectangles for compressed series
     */
    private Rectangle[] getBoundsForCompressedSeries() {
        Axis xAxis = (Axis) chart.getAxisSet().getXAxis(xAxisId);
        Axis yAxis = (Axis) chart.getAxisSet().getYAxis(yAxisId);

        // get x and y series
        double[] xseries = compressor.getCompressedXSeries();
        double[] yseries = compressor.getCompressedYSeries();
        int[] indexes = compressor.getCompressedIndexes();
        if (xAxis.isValidCategoryAxis()) {
            for (int i = 0; i < xseries.length; i++) {
                xseries[i] = indexes[i];
            }
        }

        Rectangle[] rectangles = new Rectangle[xseries.length];
        Range xRange = xAxis.getRange();
        Range yRange = yAxis.getRange();
        for (int i = 0; i < xseries.length; i++) {
            int x = xAxis.getPixelCoordinate(xseries[i]);
            int y = yAxis
                    .getPixelCoordinate(isValidStackSeries() ? stackSeries[indexes[i]]
                            : yseries[i]);
            double baseYCoordinate = yAxis.getRange().lower > 0 ? yAxis
                    .getRange().lower : 0;
            double riserwidth = getRiserWidth(xseries, i, xAxis, xRange.lower,
                    xRange.upper);
            double riserHeight = Math.abs(yAxis.getPixelCoordinate(yseries[i],
                    yRange.lower, yRange.upper)
                    - yAxis.getPixelCoordinate(
                            yAxis.isLogScaleEnabled() ? yRange.lower
                                    : baseYCoordinate, yRange.lower,
                            yRange.upper));

            // adjust riser x coordinate and riser width for multiple series
            int riserCnt = xAxis.getNumRisers();
            if (riserCnt > 1) {
                if (xAxis.isHorizontalAxis()) {
                    x = (int) (x - riserwidth / 2d + riserwidth / riserCnt
                            * (riserIndex + 0.5));
                } else {
                    x = (int) (x - riserwidth / 2d + riserwidth / riserCnt
                            * (riserCnt - riserIndex - 0.5));
                }
                riserwidth /= riserCnt;
            }

            if (xAxis.isHorizontalAxis()) {

                // adjust coordinate for negative series
                if (y > yAxis.getPixelCoordinate(0)) {
                    y = yAxis.getPixelCoordinate(0);
                }

                int width = (int) Math.ceil(riserwidth);
                width = (width == 0) ? 1 : width;

                rectangles[i] = getVisibleRectangle((int) Math.floor(x
                        - riserwidth / 2d), y, width, (int) riserHeight);
            } else {

                // adjust coordinate for negative series
                if (y < yAxis.getPixelCoordinate(0)) {
                    y = yAxis.getPixelCoordinate(0);
                }

                int height = (int) Math.ceil(riserwidth);
                height = (height == 0) ? 1 : height;

View Full Code Here

TOP

Related Classes of org.swtchart.internal.axis.Axis

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.