Page 1 of 1

Coloring Outliers on Box

Posted: Thu Oct 16, 2008 11:47 pm
by 7667592
I am having trouble coloring the mild outliers on Box Plot independent from the color of the box.

Code: Select all

		ptr = teeBox.getMildOut();
		ptr.setHorizSize(7);
		ptr.setVertSize(7);
		ptr.setColor(Color.RED);
		ptr.getBrush().setColor(Color.RED);
		ptr.setInflateMargins(true);
		ptr.setStyle(PointerStyle.TRIANGLE);
		ptr.setVisible(true);
The size works. The shape works. However, the fill color seems to match the fill color of the box.

Am I doing this right?

Also, there are two setColor() calls in the above code. They appear to have the same effect internally, yet neither changes the outward appearance.

Posted: Fri Oct 17, 2008 12:04 am
by 7667592
Is there a bug preventing the outlier color from being used?

From your source code (CustomBox.java):

Code: Select all

    public void drawValue(int index) {
        SeriesPointer tmp = null;

        double tmpVal = getSampleValues().value[index];

        // inside inner fences - no point
        if ((tmpVal >= innerFence1) && (tmpVal <= innerFence3)) {
            tmp = null;
        } else
        // mild outlined points
        if (((tmpVal >= innerFence3) && (tmpVal <= outerFence3)) ||
            ((tmpVal <= innerFence1) && (tmpVal >= outerFence1))) {
            tmp = mildOut;
        } else {
            // extreme outlined points
            tmp = extrOut;
        }

        if (tmp != null) {
            if (tmp.getVisible()) {
                Color tmpColor = getValueColor(index);
                tmp.prepareCanvas(chart.getGraphics3D(), tmpColor);
                if (iVertical) {
                    tmp.draw(calcXPosValue(dPosition), calcYPos(index),
                             tmpColor);
                } else {
                    tmp.draw(calcXPos(index), calcYPosValue(dPosition),
                             tmpColor);
                }
            }
        }
    }
tmpColor seems to not take the color from the brush!

Posted: Fri Oct 17, 2008 10:11 am
by narcis
Hi Jesse,

Thanks for your report. I'll add your request to the wish-list to be investigated for next releases. However, tmpColor doesn't get pointer's brush colors, it gets series value colors so code below works fine for me here.

Code: Select all

        for (int i = 0; i<teeBox.getCount(); i++) {
            if ((teeBox.getYValues().getValue(i) > teeBox.getOuterFence3()) || 
                (teeBox.getYValues().getValue(i) < teeBox.getOuterFence1())) {
                teeBox.getColors().setColor(i, Color.RED);
            }
        }        
        
        ptr = teeBox.getMildOut();
        ptr.setHorizSize(7);
        ptr.setVertSize(7);
//        ptr.setColor(Color.RED);
//        ptr.getBrush().setColor(Color.RED);
        ptr.setInflateMargins(true);
        ptr.setStyle(PointerStyle.TRIANGLE);
        ptr.setVisible(true);

Posted: Fri Oct 17, 2008 2:11 pm
by 7667592
Well. That was a pretty safe answer. Add it to the wish list like it is a feature. I have to admit that this is frustrating.

Basically, you are saying that the pointer for the outliers ignores the values that it's methods define and that is expected behavior?

Posted: Fri Oct 17, 2008 3:13 pm
by narcis
Hi Jesse,

I'd like to apologise if you are not satisfied with my previous answer but it wasn't my intention to "underrate" your request.

In our issue tracking system we have different categories: Bug Report, Enhancement, Feature Request, Idea, etc. Calling it "bug list" or "wish list" is the less important since it is the same list with different kind of entries. So I have added this is an "Enhancement" as I thought drawValue should be modified to support pointer color settings as clearly it isn't designed for that at the moment. Therefore I think a paradigm shift may be necessary here and will confirm that when we've checked it, the status of the issue may change on review.