Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 Question about label placement...

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
javaman Posted - 21 Apr 2009 : 18:39:10
Hi,

I'm using some of your example code to allow someone to add a label to a point on a plotted graph. The only difference in my code is that the plot is scrolling off to the left as more points come in. Thus, the added label will move as the plot adjusts - cool.

The problem I'm having is that when the label gets near the axis, it will cross the X-Axis and appear in the area where a legend would go - totally outside of the plot.

The question I have is how can I stop this? How can I tell the label (type Marker) that when it gets to the Axis to stop displaying.

Here's the code for the creation of the label (it's basically modified code from your own example):




                 if (found) {
                    // create marker object at place it at the nearest point
                    Marker amarker = new Marker(getChartObjScale(), MARKER_BOX,
                            nearestPoint.getX(), nearestPoint.getY(), 10.0,
                            PHYS_POS);
                    chartview.addChartObject(amarker);
                    rNumericLabelCntr += 1.0;
                    // Add a numeric label the identifies the marker
                    pointLabel = new StringLabel(getChartObjScale(),
                            textCoordsFont, name, nearestPoint
                                    .getX(), nearestPoint.getY(), PHYS_POS,
                            DECIMALFORMAT, 0, 0.0);
                    pointLabel.setTextBoxColor(Color.WHITE);
                    pointLabel.setTextBgColor(Color.WHITE);
                    pointLabel.setTextBgMode(true);
                    // Nudge text to the right and up so that it does not write over marker
                    pointLabel.setTextNudge(5, -5);
                    chartview.addChartObject(pointLabel);
                    chartview.repaint();
                }



Thanx - Joe!
2   L A T E S T    R E P L I E S    (Newest First)
javaman Posted - 23 Apr 2009 : 13:52:27
That worked! Many thanx.

Thanx - Joe!
quinncurtis Posted - 22 Apr 2009 : 09:04:06
A text object can be clipped to the entire graph area (the area inside and outside the axes), or to just the plotting area (the area bounded by the axes). The default is graph area clipping, ChartObj.GRAPH_AREA_CLIPPING.

You can change this to plot area clipping, ChartObj.PLOT_AREA_CLIPPING, using text objects setChartObjClipping method.

pointLabel.setChartObjClipping(ChartObj.PLOT_AREA_CLIPPING);

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07