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

📄 contourplot.html

📁 jfreechart1。0。2的api。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<FONT color="green">590</FONT>            );<a name="line.590"></a><FONT color="green">591</FONT>            Rectangle2D adjustedPlotArea = space2.shrink(area, null);<a name="line.591"></a><FONT color="green">592</FONT>            <a name="line.592"></a><FONT color="green">593</FONT>            Rectangle2D dataArea = space.shrink(adjustedPlotArea, null);<a name="line.593"></a><FONT color="green">594</FONT>    <a name="line.594"></a><FONT color="green">595</FONT>            Rectangle2D colorBarArea = space2.reserved(<a name="line.595"></a><FONT color="green">596</FONT>                area, this.colorBarLocation<a name="line.596"></a><FONT color="green">597</FONT>            );<a name="line.597"></a><FONT color="green">598</FONT>    <a name="line.598"></a><FONT color="green">599</FONT>            // additional dataArea modifications<a name="line.599"></a><FONT color="green">600</FONT>            if (getDataAreaRatio() != 0.0) { //check whether modification is<a name="line.600"></a><FONT color="green">601</FONT>                double ratio = getDataAreaRatio();<a name="line.601"></a><FONT color="green">602</FONT>                Rectangle2D tmpDataArea = (Rectangle2D) dataArea.clone();<a name="line.602"></a><FONT color="green">603</FONT>                double h = tmpDataArea.getHeight();<a name="line.603"></a><FONT color="green">604</FONT>                double w = tmpDataArea.getWidth();<a name="line.604"></a><FONT color="green">605</FONT>    <a name="line.605"></a><FONT color="green">606</FONT>                if (ratio &gt; 0) { // ratio represents pixels<a name="line.606"></a><FONT color="green">607</FONT>                    if (w * ratio &lt;= h) {<a name="line.607"></a><FONT color="green">608</FONT>                        h = ratio * w;<a name="line.608"></a><FONT color="green">609</FONT>                    }<a name="line.609"></a><FONT color="green">610</FONT>                    else {<a name="line.610"></a><FONT color="green">611</FONT>                        w = h / ratio;<a name="line.611"></a><FONT color="green">612</FONT>                    }<a name="line.612"></a><FONT color="green">613</FONT>                }<a name="line.613"></a><FONT color="green">614</FONT>                else {  // ratio represents axis units<a name="line.614"></a><FONT color="green">615</FONT>                    ratio *= -1.0;<a name="line.615"></a><FONT color="green">616</FONT>                    double xLength = getDomainAxis().getRange().getLength();<a name="line.616"></a><FONT color="green">617</FONT>                    double yLength = getRangeAxis().getRange().getLength();<a name="line.617"></a><FONT color="green">618</FONT>                    double unitRatio = yLength / xLength;<a name="line.618"></a><FONT color="green">619</FONT>    <a name="line.619"></a><FONT color="green">620</FONT>                    ratio = unitRatio * ratio;<a name="line.620"></a><FONT color="green">621</FONT>    <a name="line.621"></a><FONT color="green">622</FONT>                    if (w * ratio &lt;= h) {<a name="line.622"></a><FONT color="green">623</FONT>                        h = ratio * w;<a name="line.623"></a><FONT color="green">624</FONT>                    }<a name="line.624"></a><FONT color="green">625</FONT>                    else {<a name="line.625"></a><FONT color="green">626</FONT>                        w = h / ratio;<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>    <a name="line.629"></a><FONT color="green">630</FONT>                dataArea.setRect(<a name="line.630"></a><FONT color="green">631</FONT>                    tmpDataArea.getX() + tmpDataArea.getWidth() / 2 - w / 2,<a name="line.631"></a><FONT color="green">632</FONT>                    tmpDataArea.getY(), w, h<a name="line.632"></a><FONT color="green">633</FONT>                );<a name="line.633"></a><FONT color="green">634</FONT>            }<a name="line.634"></a><FONT color="green">635</FONT>    <a name="line.635"></a><FONT color="green">636</FONT>            if (info != null) {<a name="line.636"></a><FONT color="green">637</FONT>                info.setDataArea(dataArea);<a name="line.637"></a><FONT color="green">638</FONT>            }<a name="line.638"></a><FONT color="green">639</FONT>    <a name="line.639"></a><FONT color="green">640</FONT>            CrosshairState crosshairState = new CrosshairState();<a name="line.640"></a><FONT color="green">641</FONT>            crosshairState.setCrosshairDistance(Double.POSITIVE_INFINITY);<a name="line.641"></a><FONT color="green">642</FONT>    <a name="line.642"></a><FONT color="green">643</FONT>            // draw the plot background...<a name="line.643"></a><FONT color="green">644</FONT>            drawBackground(g2, dataArea);<a name="line.644"></a><FONT color="green">645</FONT>    <a name="line.645"></a><FONT color="green">646</FONT>            double cursor = dataArea.getMaxY();<a name="line.646"></a><FONT color="green">647</FONT>            if (this.domainAxis != null) {<a name="line.647"></a><FONT color="green">648</FONT>                this.domainAxis.draw(<a name="line.648"></a><FONT color="green">649</FONT>                    g2, cursor, adjustedPlotArea, dataArea, RectangleEdge.BOTTOM, <a name="line.649"></a><FONT color="green">650</FONT>                    info<a name="line.650"></a><FONT color="green">651</FONT>                );<a name="line.651"></a><FONT color="green">652</FONT>            }<a name="line.652"></a><FONT color="green">653</FONT>    <a name="line.653"></a><FONT color="green">654</FONT>            if (this.rangeAxis != null) {<a name="line.654"></a><FONT color="green">655</FONT>                cursor = dataArea.getMinX();<a name="line.655"></a><FONT color="green">656</FONT>                this.rangeAxis.draw(<a name="line.656"></a><FONT color="green">657</FONT>                    g2, cursor, adjustedPlotArea, dataArea, RectangleEdge.LEFT, info<a name="line.657"></a><FONT color="green">658</FONT>                );<a name="line.658"></a><FONT color="green">659</FONT>            }<a name="line.659"></a><FONT color="green">660</FONT>    <a name="line.660"></a><FONT color="green">661</FONT>            if (this.colorBar != null) {<a name="line.661"></a><FONT color="green">662</FONT>                cursor = 0.0;<a name="line.662"></a><FONT color="green">663</FONT>                cursor = this.colorBar.draw(<a name="line.663"></a><FONT color="green">664</FONT>                    g2, cursor, adjustedPlotArea, dataArea, colorBarArea, <a name="line.664"></a><FONT color="green">665</FONT>                    this.colorBarLocation<a name="line.665"></a><FONT color="green">666</FONT>                );<a name="line.666"></a><FONT color="green">667</FONT>            }<a name="line.667"></a><FONT color="green">668</FONT>            Shape originalClip = g2.getClip();<a name="line.668"></a><FONT color="green">669</FONT>            Composite originalComposite = g2.getComposite();<a name="line.669"></a><FONT color="green">670</FONT>    <a name="line.670"></a><FONT color="green">671</FONT>            g2.clip(dataArea);<a name="line.671"></a><FONT color="green">672</FONT>            g2.setComposite(AlphaComposite.getInstance(<a name="line.672"></a><FONT color="green">673</FONT>                AlphaComposite.SRC_OVER, getForegroundAlpha())<a name="line.673"></a><FONT color="green">674</FONT>            );<a name="line.674"></a><FONT color="green">675</FONT>            render(g2, dataArea, info, crosshairState);<a name="line.675"></a><FONT color="green">676</FONT>    <a name="line.676"></a><FONT color="green">677</FONT>            if (this.domainMarkers != null) {<a name="line.677"></a><FONT color="green">678</FONT>                Iterator iterator = this.domainMarkers.iterator();<a name="line.678"></a><FONT color="green">679</FONT>                while (iterator.hasNext()) {<a name="line.679"></a><FONT color="green">680</FONT>                    Marker marker = (Marker) iterator.next();<a name="line.680"></a><FONT color="green">681</FONT>                    drawDomainMarker(g2, this, getDomainAxis(), marker, dataArea);<a name="line.681"></a><FONT color="green">682</FONT>                }<a name="line.682"></a><FONT color="green">683</FONT>            }<a name="line.683"></a><FONT color="green">684</FONT>    <a name="line.684"></a><FONT color="green">685</FONT>            if (this.rangeMarkers != null) {<a name="line.685"></a><FONT color="green">686</FONT>                Iterator iterator = this.rangeMarkers.iterator();<a name="line.686"></a><FONT color="green">687</FONT>                while (iterator.hasNext()) {<a name="line.687"></a><FONT color="green">688</FONT>                    Marker marker = (Marker) iterator.next();<a name="line.688"></a><FONT color="green">689</FONT>                    drawRangeMarker(g2, this, getRangeAxis(), marker, dataArea);<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>    <a name="line.692"></a><FONT color="green">693</FONT>    // TO DO:  these annotations only work with XYPlot, see if it is possible to <a name="line.693"></a><FONT color="green">694</FONT>    // make ContourPlot a subclass of XYPlot (DG);<a name="line.694"></a><FONT color="green">695</FONT>    <a name="line.695"></a><FONT color="green">696</FONT>    //        // draw the annotations...<a name="line.696"></a><FONT color="green">697</FONT>    //        if (this.annotations != null) {<a name="line.697"></a><FONT color="green">698</FONT>    //            Iterator iterator = this.annotations.iterator();<a name="line.698"></a><FONT color="green">699</FONT>    //            while (iterator.hasNext()) {<a name="line.699"></a><FONT color="green">700</FONT>    //                Annotation annotation = (Annotation) iterator.next();<a name="line.700"></a><FONT color="green">701</FONT>    //                if (annotation instanceof XYAnnotation) {<a name="line.701"></a><FONT color="green">702</FONT>    //                    XYAnnotation xya = (XYAnnotation) annotation;<a name="line.702"></a><FONT color="green">703</FONT>    //                    // get the annotation to draw itself...<a name="line.703"></a><FONT color="green">704</FONT>    //                    xya.draw(g2, this, dataArea, getDomainAxis(), <a name="line.704"></a><FONT color="green">705</FONT>    //                             getRangeAxis());<a name="line.705"></a><FONT color="green">706</FONT>    //                }<a name="line.706"></a><FONT color="green">707</FONT>    //            }<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>            g2.setClip(originalClip);<a name="line.710"></a><FONT color="green">711</FONT>            g2.setComposite(originalComposite);<a name="line.711"></a><FONT color="green">712</FONT>            drawOutline(g2, dataArea);<a name="line.712"></a><FONT color="green">713</FONT>    <a name="line.713"></a><FONT color="green">714</FONT>        }<a name="line.714"></a><FONT color="green">715</FONT>    <a name="line.715"></a><FONT color="green">716</FONT>        /**<a name="line.716"></a><FONT color="green">717</FONT>         * Draws a representation of the data within the dataArea region, using the<a name="line.717"></a><FONT color="green">718</FONT>         * current renderer.<a name="line.718"></a><FONT color="green">719</FONT>         * &lt;P&gt;<a name="line.719"></a><FONT color="green">720</FONT>         * The &lt;code&gt;info&lt;/code&gt; and &lt;code&gt;crosshairState&lt;/code&gt; arguments may be <a name="line.720"></a><FONT color="green">721</FONT>         * &lt;code&gt;null&lt;/code&gt;.<a name="line.721"></a><FONT color="green">722</FONT>         *<a name="line.722"></a><FONT color="green">723</FONT>         * @param g2  the graphics device.<a name="line.723"></a><FONT color="green">724</FONT>         * @param dataArea  the region in which the data is to be drawn.<a name="line.724"></a><FONT color="green">725</FONT>         * @param info  an optional object for collection dimension information.<a name="line.725"></a><FONT color="green">726</FONT>         * @param crosshairState  an optional object for collecting crosshair info.<a name="line.726"></a><FONT color="green">727</FONT>         */<a name="line.727"></a><FONT color="green">728</FONT>        public void render(Graphics2D g2, Rectangle2D dataArea,<a name="line.728"></a><FONT color="green">729</FONT>                           PlotRenderingInfo info, CrosshairState crosshairState) {<a name="line.729"></a><FONT color="green">730</FONT>    <a name="line.730"></a><FONT color="green">731</FONT>            // now get the data and plot it (the visual representation will depend<a name="line.731"></a><FONT color="green">732</FONT>            // on the renderer that has been set)...<a name="line.732"></a><FONT color="green">733</FONT>            ContourDataset data = getDataset();<a name="line.733"></a><FONT color="green">734</FONT>            if (data != null) {<a name="line.734"></a><FONT color="green">735</FONT>    <a name="line.735"></a><FONT color="green">736</FO

⌨️ 快捷键说明

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