afreechart/src/main/java/org/afree/chart/renderer/xy/XYDotRenderer.java
/**
     * Draws the visual representation of a single data item.
     *
     * @param canvas  the graphics device.
     * @param state  the renderer state.
     * @param dataArea  the area within which the data is being drawn.
     * @param info  collects information about the drawing.
     * @param plot  the plot (can be used to obtain standard color
     *              information etc).
     * @param domainAxis  the domain (horizontal) axis.
     * @param rangeAxis  the range (vertical) axis.
     * @param dataset  the dataset.
     * @param series  the series index (zero-based).
     * @param item  the item index (zero-based).
     * @param crosshairState  crosshair information for the plot
     *                        (<code>null</code> permitted).
     * @param pass  the pass index.
     */
Draws the visual representation of a single data item.
@param canvas  the graphics device.
@param state  the renderer state.
@param dataArea  the area within which the data is being drawn.
@param info  collects information about the drawing.
@param plot  the plot (can be used to obtain standard color
information etc).
@param domainAxis  the domain (horizontal) axis.
@param rangeAxis  the range (vertical) axis.
@param dataset  the dataset.
@param series  the series index (zero-based).
@param item  the item index (zero-based).
@param crosshairState  crosshair information for the plot
(null permitted).
@param pass  the pass index.
Draws the visual representation of a single data item . @param canvas the graphics device . @param state the renderer state . @param dataArea the area within which the data is being drawn . @param info collects information about the drawing . @param plot the plot ( can be used to obtain standard color information etc ) . @param domainAxis the domain ( horizontal ) axis . @param rangeAxis the range ( vertical ) axis . @param dataset the dataset . @param series the series index ( zero - based ) . @param item the item index ( zero - based ) . @param crosshairState crosshair information for the plot ( null permitted ) . @param pass the pass index .
public void drawItem(Canvas canvas,
                         XYItemRendererState state,
                         RectShape dataArea,
                         PlotRenderingInfo info,
                         XYPlot plot,
                         ValueAxis domainAxis,
                         ValueAxis rangeAxis,
                         XYDataset dataset,
                         int series,
                         int item,
                         CrosshairState crosshairState,
                         int pass) {
        if (!getItemVisible(series, item)) {
            return;
        }
        double x = dataset.getXValue(series, item);
        double y = dataset.getYValue(series, item);
        double adjx = (this.dotWidth - 1) / 2.0;
        double adjy = (this.dotHeight - 1) / 2.0;
        if (!Double.isNaN(y)) {
            RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
            RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
            double transX = domainAxis.valueToJava2D(x, dataArea,
                    xAxisLocation) - adjx;
            double transY = rangeAxis.valueToJava2D(y, dataArea, yAxisLocation)
                    - adjy;
            Paint paint = PaintUtility.createPaint(
                    Paint.ANTI_ALIAS_FLAG,
                    getItemPaintType(series, item));
            paint.setStyle(Style.FILL);
            PlotOrientation orientation = plot.getOrientation();
            /*
            if (orientation == PlotOrientation.HORIZONTAL) {
                canvas.fillRect((int) transY, (int) transX, this.dotHeight,
                        this.dotWidth);
            }
            else if (orientation == PlotOrientation.VERTICAL) {
                canvas.fillRect((int) transX, (int) transY, this.dotWidth,
                        this.dotHeight);
            }*/
            if (orientation == PlotOrientation.HORIZONTAL) {
                canvas.drawRect((int) transX,(int) transY + this.dotHeight, (int)  transX + this.dotWidth,
                        (int) transY ,paint);
            }
            else if (orientation == PlotOrientation.VERTICAL) {
                canvas.drawRect((int) transX,(int) transY + this.dotHeight, (int)  transX + this.dotWidth,
                        (int) transY ,paint);
            }
            int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
            int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
            updateCrosshairValues(crosshairState, x, y, domainAxisIndex,
                    rangeAxisIndex, transX, transY, orientation);
        }
    }
public void drawItem ( Canvas canvas , XYItemRendererState state , RectShape dataArea , PlotRenderingInfo info , XYPlot plot , ValueAxis domainAxis , ValueAxis rangeAxis , XYDataset dataset , int series , int item , CrosshairState crosshairState , int pass ) { if ( ! getItemVisible ( series , item ) ) { return ; } double x = dataset . getXValue ( series , item ) ; double y = dataset . getYValue ( series , item ) ; double adjx = ( this . dotWidth - 1 ) / 2.0 ; double adjy = ( this . dotHeight - 1 ) / 2.0 ; if ( ! Double . isNaN ( y ) ) { RectangleEdge xAxisLocation = plot . getDomainAxisEdge ( ) ; RectangleEdge yAxisLocation = plot . getRangeAxisEdge ( ) ; double transX = domainAxis . valueToJava2D ( x , dataArea , xAxisLocation ) - adjx ; double transY = rangeAxis . valueToJava2D ( y , dataArea , yAxisLocation ) - adjy ; Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , getItemPaintType ( series , item ) ) ; paint . setStyle ( Style . FILL ) ; PlotOrientation orientation = plot . getOrientation ( ) ; /*
            if (orientation == PlotOrientation.HORIZONTAL) {
                canvas.fillRect((int) transY, (int) transX, this.dotHeight,
                        this.dotWidth);
            }
            else if (orientation == PlotOrientation.VERTICAL) {
                canvas.fillRect((int) transX, (int) transY, this.dotWidth,
                        this.dotHeight);
            }*/ if ( orientation == PlotOrientation . HORIZONTAL ) { canvas . drawRect ( ( int ) transX , ( int ) transY + this . dotHeight , ( int ) transX + this . dotWidth , ( int ) transY , paint ) ; } else if ( orientation == PlotOrientation . VERTICAL ) { canvas . drawRect ( ( int ) transX , ( int ) transY + this . dotHeight , ( int ) transX + this . dotWidth , ( int ) transY , paint ) ; } int domainAxisIndex = plot . getDomainAxisIndex ( domainAxis ) ; int rangeAxisIndex = plot . getRangeAxisIndex ( rangeAxis ) ; updateCrosshairValues ( crosshairState , x , y , domainAxisIndex , rangeAxisIndex , transX , transY , orientation ) ; } }
Draws the visual representation of a single data item.
Draws the visual representation of a single data item .
// do nothing if item is not visible // get the data point... //            canvas.setPaint(getItemPaint(series, item));