Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 How do I change the color of an active plot?

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 - 24 Apr 2009 : 11:12:10
Hi,

I've got a graph with up to 10 plot lines at a time. I've enabled the legend items to be mouse enabled so that I can change the color of the plot according to which legend item is entered. What I do is the following:


   public void mouseEntered(MouseEvent e) {
        setBackground(Color.WHITE);
        plot.setLineColor(Color.red.brighter());
        plot.setUpdateFlag(true);
    }
    
    public void mouseExited(MouseEvent e) {
        setBackground(BACKGROUND_COLOR);
        plot.setLineColor(this.textColor);
        plot.setUpdateFlag(true);
    }



where plot is:

private SimplePlot plot;

Unfortunately, this doesn't work. I want the item to turn red so as to be highlighted when the mouse is over the legend item. I thought that turning the lineColor to the newly desired color would make the plot in the graph change. No go...

Can you tell me what else I need to do to affect the change? Do I need to call something in the graph or what?

many thanx.

Thanx - Joe!
3   L A T E S T    R E P L I E S    (Newest First)
javaman Posted - 05 May 2009 : 14:48:28
Hey - I implemented this - and it didn't work. Plot never changed color. Do you have any other suggestions?

Thanx - Joe!
javaman Posted - 03 May 2009 : 00:00:46
Thanx - that's what I needed.

As for enabling the legend items - I do it myself - it's my own custom legend that I attach in - since yours doesn't have the capabilities that I need...



Thanx - Joe!
quinncurtis Posted - 24 Apr 2009 : 11:44:01
We don't know what you mean by enabling the legend items to be mouse enabled, since we have no explicit support for any mouse events in the legend items. But assuming you some how are generating a mouse event the way you want, any time you change a displayable attribute of a single or a group of chart objects, you must call the ChartView.updateDraw method for it to update on the screen. So you might try, the following code, assuming that "chartvu." references the graphs ChartView.

public void mouseEntered(MouseEvent e) {
setBackground(Color.WHITE);
plot.setLineColor(Color.red.brighter());
chartvu.updateDraw();
}

public void mouseExited(MouseEvent e) {
setBackground(BACKGROUND_COLOR);
plot.setLineColor(this.textColor);
chartvu.updateDraw();
}

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