Package com.vaadin.addon.timeline.gwt.client.VCanvasPlotter

Examples of com.vaadin.addon.timeline.gwt.client.VCanvasPlotter.Point


            List<Point> points = graph.getPoints();

            // Search for index of the closes point
            float minDiff = 10000000f;
            int pointIndex = 0;
            Point p;
            for (int i = 0; i < points.size(); i++) {
                p = points.get(i);
                if (p.x < 0 || p.x > canvas.getWidth()) {
                    continue;
                }

                float diff = Math.abs(x - p.x);
                if (currentMode == PlotMode.BAR) {
                    // Barchart renders to the left of the point so we have to
                    // adjust
                    diff = Math.abs(x - (p.x - p.width / 2f));
                }

                if (diff < minDiff) {
                    minDiff = diff;
                    pointIndex = i;
                }
            }

            // Retrieve the selected point
            p = points.get(pointIndex);
            if (dots.size() > g) {
                HTML dot = dots.get(g);
                dot.setVisible(true);
                if (widget.isGraphsStacked()) {
                    float pSum = 0;
                    for (int j = 0; j < g; j++) {
                        Graph graph2 = currentGraphs.get(j);
                        Point q = graph2.getPoints().get(pointIndex);
                        if (q != null) {
                            pSum += q.y - getCurrentZeroCoordinate();
                        }
                    }
View Full Code Here


                    timeFromStart = date.getTime() - startTime;

                    float y = currentZeroCoordinate - value * yUnit;
                    float x = timeFromStart * xUnit;

                    Point p;
                    if (normalizedValues.size() == 1) {
                        /*
                         * Special behaviour for a graph with one point since we
                         * cannot calculate the width for it
                         */
                        p = new Point(Math.round(x), Math.round(y), graph, 1,
                                value);
                        lastWidth = 1;

                    } else if (i == 0) {
                        /*
                         * Setting width for the first point to zero
                         */
                        Date d = dates.get(1);
                        timeFromStart = d.getTime() - startTime;
                        lastWidth = 0;
                        p = new Point(Math.round(x), Math.round(y), graph,
                                lastWidth, value);

                    } else {
                        /*
                         * Other points calculate backwards
                         */
                        if (getPlotMode() == PlotMode.BAR) {
                            // MT 22.3.2013: I have no idea why some points are
                            // ignored. Without this bars get totally messed,
                            // but without essential points may be dropped in
                            // lines (no 1 priority)
                            int diff = Math.round(x - lastX);
                            if (diff > 2) {
                                lastWidth = diff;
                                p = new Point(Math.round(x), Math.round(y),
                                        graph, lastWidth, value);
                            } else {
                                p = null;
                            }
                        } else {
                            p = new Point(Math.round(x), Math.round(y), graph,
                                    lastWidth, value);
                        }

                    }
                    if (p != null) {
View Full Code Here

TOP

Related Classes of com.vaadin.addon.timeline.gwt.client.VCanvasPlotter.Point

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.