]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.trend/src/org/simantics/trend/impl/TooltipNode.java
Render last known value in time series chart hairline value tip
[simantics/platform.git] / bundles / org.simantics.trend / src / org / simantics / trend / impl / TooltipNode.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.trend.impl;
13
14 import java.awt.AlphaComposite;
15 import java.awt.Color;
16 import java.awt.Composite;
17 import java.awt.Graphics2D;
18
19 public class TooltipNode extends TrendGraphicalNode {
20
21     private static final long serialVersionUID = 8818424722082593562L;
22
23     public static final AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .61f);
24         
25         public boolean visible = true;
26         public double time;
27         
28         @Override
29         protected void doRender(Graphics2D g) {
30                 if ( !visible ) return;
31                 
32                 //double w = getWidth();
33                 //double h = getHeight();
34                 
35                 Composite c = g.getComposite();
36                 g.setComposite(composite);
37                 try {
38                         g.setColor(Color.BLACK);
39                         g.fill( bounds );
40                 } finally {
41                         g.setComposite(c);
42                 }
43         }
44         
45         
46
47 }