⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polarplot.html

📁 jfreechart1。0。2的api。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<FONT color="green">582</FONT>         *<a name="line.582"></a><FONT color="green">583</FONT>         * @param paint  the paint (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.583"></a><FONT color="green">584</FONT>         */<a name="line.584"></a><FONT color="green">585</FONT>        public void setRadiusGridlinePaint(Paint paint) {<a name="line.585"></a><FONT color="green">586</FONT>            this.radiusGridlinePaint = paint;<a name="line.586"></a><FONT color="green">587</FONT>            notifyListeners(new PlotChangeEvent(this));<a name="line.587"></a><FONT color="green">588</FONT>        }<a name="line.588"></a><FONT color="green">589</FONT>        <a name="line.589"></a><FONT color="green">590</FONT>        /**<a name="line.590"></a><FONT color="green">591</FONT>         * Draws the plot on a Java 2D graphics device (such as the screen or a <a name="line.591"></a><FONT color="green">592</FONT>         * printer).<a name="line.592"></a><FONT color="green">593</FONT>         * &lt;P&gt;<a name="line.593"></a><FONT color="green">594</FONT>         * This plot relies on an <a name="line.594"></a><FONT color="green">595</FONT>         * {@link org.jfree.chart.renderer.DefaultPolarItemRenderer} to draw each <a name="line.595"></a><FONT color="green">596</FONT>         * item in the plot.  This allows the visual representation of the data to <a name="line.596"></a><FONT color="green">597</FONT>         * be changed easily.<a name="line.597"></a><FONT color="green">598</FONT>         * &lt;P&gt;<a name="line.598"></a><FONT color="green">599</FONT>         * The optional info argument collects information about the rendering of<a name="line.599"></a><FONT color="green">600</FONT>         * the plot (dimensions, tooltip information etc).  Just pass in <a name="line.600"></a><FONT color="green">601</FONT>         * &lt;code&gt;null&lt;/code&gt; if you do not need this information.<a name="line.601"></a><FONT color="green">602</FONT>         *<a name="line.602"></a><FONT color="green">603</FONT>         * @param g2  the graphics device.<a name="line.603"></a><FONT color="green">604</FONT>         * @param area  the area within which the plot (including axes and <a name="line.604"></a><FONT color="green">605</FONT>         *              labels) should be drawn.<a name="line.605"></a><FONT color="green">606</FONT>         * @param anchor  the anchor point (&lt;code&gt;null&lt;/code&gt; permitted).<a name="line.606"></a><FONT color="green">607</FONT>         * @param parentState  ignored.<a name="line.607"></a><FONT color="green">608</FONT>         * @param info  collects chart drawing information (&lt;code&gt;null&lt;/code&gt; <a name="line.608"></a><FONT color="green">609</FONT>         *              permitted).<a name="line.609"></a><FONT color="green">610</FONT>         */<a name="line.610"></a><FONT color="green">611</FONT>        public void draw(Graphics2D g2, <a name="line.611"></a><FONT color="green">612</FONT>                         Rectangle2D area, <a name="line.612"></a><FONT color="green">613</FONT>                         Point2D anchor,<a name="line.613"></a><FONT color="green">614</FONT>                         PlotState parentState,<a name="line.614"></a><FONT color="green">615</FONT>                         PlotRenderingInfo info) {<a name="line.615"></a><FONT color="green">616</FONT>           <a name="line.616"></a><FONT color="green">617</FONT>            // if the plot area is too small, just return...<a name="line.617"></a><FONT color="green">618</FONT>            boolean b1 = (area.getWidth() &lt;= MINIMUM_WIDTH_TO_DRAW);<a name="line.618"></a><FONT color="green">619</FONT>            boolean b2 = (area.getHeight() &lt;= MINIMUM_HEIGHT_TO_DRAW);<a name="line.619"></a><FONT color="green">620</FONT>            if (b1 || b2) {<a name="line.620"></a><FONT color="green">621</FONT>                return;<a name="line.621"></a><FONT color="green">622</FONT>            }<a name="line.622"></a><FONT color="green">623</FONT>           <a name="line.623"></a><FONT color="green">624</FONT>            // record the plot area...<a name="line.624"></a><FONT color="green">625</FONT>            if (info != null) {<a name="line.625"></a><FONT color="green">626</FONT>                info.setPlotArea(area);<a name="line.626"></a><FONT color="green">627</FONT>            }<a name="line.627"></a><FONT color="green">628</FONT>           <a name="line.628"></a><FONT color="green">629</FONT>            // adjust the drawing area for the plot insets (if any)...<a name="line.629"></a><FONT color="green">630</FONT>            RectangleInsets insets = getInsets();<a name="line.630"></a><FONT color="green">631</FONT>            insets.trim(area);<a name="line.631"></a><FONT color="green">632</FONT>          <a name="line.632"></a><FONT color="green">633</FONT>            Rectangle2D dataArea = area;<a name="line.633"></a><FONT color="green">634</FONT>            if (info != null) {<a name="line.634"></a><FONT color="green">635</FONT>                info.setDataArea(dataArea);<a name="line.635"></a><FONT color="green">636</FONT>            }<a name="line.636"></a><FONT color="green">637</FONT>           <a name="line.637"></a><FONT color="green">638</FONT>            // draw the plot background and axes...<a name="line.638"></a><FONT color="green">639</FONT>            drawBackground(g2, dataArea);<a name="line.639"></a><FONT color="green">640</FONT>            double h = Math.min(<a name="line.640"></a><FONT color="green">641</FONT>                dataArea.getWidth() / 2.0, dataArea.getHeight() / 2.0<a name="line.641"></a><FONT color="green">642</FONT>            ) - MARGIN;<a name="line.642"></a><FONT color="green">643</FONT>            Rectangle2D quadrant = new Rectangle2D.Double(<a name="line.643"></a><FONT color="green">644</FONT>                dataArea.getCenterX(), dataArea.getCenterY(), h, h<a name="line.644"></a><FONT color="green">645</FONT>            );<a name="line.645"></a><FONT color="green">646</FONT>            AxisState state = drawAxis(g2, area, quadrant);<a name="line.646"></a><FONT color="green">647</FONT>            if (this.renderer != null) {<a name="line.647"></a><FONT color="green">648</FONT>                Shape originalClip = g2.getClip();<a name="line.648"></a><FONT color="green">649</FONT>                Composite originalComposite = g2.getComposite();<a name="line.649"></a><FONT color="green">650</FONT>              <a name="line.650"></a><FONT color="green">651</FONT>                g2.clip(dataArea);<a name="line.651"></a><FONT color="green">652</FONT>                g2.setComposite(<a name="line.652"></a><FONT color="green">653</FONT>                    AlphaComposite.getInstance(<a name="line.653"></a><FONT color="green">654</FONT>                        AlphaComposite.SRC_OVER, getForegroundAlpha()<a name="line.654"></a><FONT color="green">655</FONT>                    )<a name="line.655"></a><FONT color="green">656</FONT>                );<a name="line.656"></a><FONT color="green">657</FONT>              <a name="line.657"></a><FONT color="green">658</FONT>                drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());<a name="line.658"></a><FONT color="green">659</FONT>              <a name="line.659"></a><FONT color="green">660</FONT>                // draw...<a name="line.660"></a><FONT color="green">661</FONT>                render(g2, dataArea, info);<a name="line.661"></a><FONT color="green">662</FONT>              <a name="line.662"></a><FONT color="green">663</FONT>                g2.setClip(originalClip);<a name="line.663"></a><FONT color="green">664</FONT>                g2.setComposite(originalComposite);<a name="line.664"></a><FONT color="green">665</FONT>            }<a name="line.665"></a><FONT color="green">666</FONT>            drawOutline(g2, dataArea);<a name="line.666"></a><FONT color="green">667</FONT>            drawCornerTextItems(g2, dataArea);<a name="line.667"></a><FONT color="green">668</FONT>        }<a name="line.668"></a><FONT color="green">669</FONT>       <a name="line.669"></a><FONT color="green">670</FONT>        /**<a name="line.670"></a><FONT color="green">671</FONT>         * Draws the corner text items.<a name="line.671"></a><FONT color="green">672</FONT>         * <a name="line.672"></a><FONT color="green">673</FONT>         * @param g2  the drawing surface.<a name="line.673"></a><FONT color="green">674</FONT>         * @param area  the area.<a name="line.674"></a><FONT color="green">675</FONT>         */<a name="line.675"></a><FONT color="green">676</FONT>        protected void drawCornerTextItems(Graphics2D g2, Rectangle2D area) {<a name="line.676"></a><FONT color="green">677</FONT>            if (this.cornerTextItems.isEmpty()) {<a name="line.677"></a><FONT color="green">678</FONT>                return;<a name="line.678"></a><FONT color="green">679</FONT>            }<a name="line.679"></a><FONT color="green">680</FONT>           <a name="line.680"></a><FONT color="green">681</FONT>            g2.setColor(Color.black);<a name="line.681"></a><FONT color="green">682</FONT>            double width = 0.0;<a name="line.682"></a><FONT color="green">683</FONT>            double height = 0.0;<a name="line.683"></a><FONT color="green">684</FONT>            for (Iterator it = this.cornerTextItems.iterator(); it.hasNext();) {<a name="line.684"></a><FONT color="green">685</FONT>                String msg = (String) it.next();<a name="line.685"></a><FONT color="green">686</FONT>                FontMetrics fm = g2.getFontMetrics();<a name="line.686"></a><FONT color="green">687</FONT>                Rectangle2D bounds = TextUtilities.getTextBounds(msg, g2, fm);<a name="line.687"></a><FONT color="green">688</FONT>                width = Math.max(width, bounds.getWidth());<a name="line.688"></a><FONT color="green">689</FONT>                height += bounds.getHeight();<a name="line.689"></a><FONT color="green">690</FONT>            }<a name="line.690"></a><FONT color="green">691</FONT>            <a name="line.691"></a><FONT color="green">692</FONT>            double xadj = ANNOTATION_MARGIN * 2.0;<a name="line.692"></a><FONT color="green">693</FONT>            double yadj = ANNOTATION_MARGIN;<a name="line.693"></a><FONT color="green">694</FONT>            width += xadj;<a name="line.694"></a><FONT color="green">695</FONT>            height += yadj;<a name="line.695"></a><FONT color="green">696</FONT>           <a name="line.696"></a><FONT color="green">697</FONT>            double x = area.getMaxX() - width;<a name="line.697"></a><FONT color="green">698</FONT>            double y = area.getMaxY() - height;<a name="line.698"></a><FONT color="green">699</FONT>            g2.drawRect((int) x, (int) y, (int) width, (int) height);<a name="line.699"></a><FONT color="green">700</FONT>            x += ANNOTATION_MARGIN;<a name="line.700"></a><FONT color="green">701</FONT>            for (Iterator it = this.cornerTextItems.iterator(); it.hasNext();) {<a name="line.701"></a><FONT color="green">702</FONT>                String msg = (String) it.next();<a name="line.702"></a><FONT color="green">703</FONT>                Rectangle2D bounds = TextUtilities.getTextBounds(<a name="line.703"></a><FONT color="green">704</FONT>                    msg, g2, g2.getFontMetrics()<a name="line.704"></a><FONT color="green">705</FONT>                );<a name="line.705"></a><FONT color="green">706</FONT>                y += bounds.getHeight();<a name="line.706"></a><FONT color="green">707</FONT>                g2.drawString(msg, (int) x, (int) y);<a name="line.707"></a><FONT color="green">708</FONT>            }<a name="line.708"></a><FONT color="green">709</FONT>        }<a name="line.709"></a><FONT color="green">710</FONT>       <a name="line.710"></a><FONT color="green">711</FONT>        /**<a name="line.711"></a><FONT color="green">712</FONT>         * A utility method for drawing the axes.<a name="line.712"></a><FONT color="green">713</FONT>         *<a name="line.713"></a><FONT color="green">714</FONT>         * @param g2  the graphics device.<a name="line.714"></a><FONT color="green">715</FONT>         * @param plotArea  the plot area.<a name="line.715"></a><FONT color="green">716</FONT>         * @param dataArea  the data area.<a name="line.716"></a><FONT color="green">717</FONT>         * <a name="line.717"></a><FONT color="green">718</FONT>         * @return A map containing the axis states.<a name="line.718"></a><FONT color="green">719</FONT>         */<a name="line.719"></a><FONT color="green">720</FONT>        protected AxisState drawAxis(Graphics2D g2, Rectangle2D plotArea, <a name="line.720"></a><FONT color="green">721</FONT>                                     Rectangle2D dataArea) {<a name="line.721"></a><FONT color="green">722</FONT>            return this.axis.draw(<a name="line.722"></a><FONT color="green">723</FONT>                g2, dataArea.getMinY(), plotArea, dataArea, RectangleEdge.TOP, null<a name="line.723"></a><FONT colo

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -