]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java
Render last known value in time series chart hairline value tip
[simantics/platform.git] / bundles / org.simantics.trend / src / org / simantics / trend / impl / JarisPaints.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.Color;
15
16 public class JarisPaints {
17         
18         public static final Color[] JarisPaintSequence;
19         public static final String[] JarisPaintName;
20
21         /**
22          * Get color. First color ( blue ) is 1.
23          * @param paintIndex
24          * @return
25          */
26         public static Color getColor( int paintIndex )
27         {
28                 return JarisPaintSequence[ modulus(paintIndex-1, JarisPaintSequence.length) ];
29         }
30         
31         public static int modulus( int a, int b )
32         {
33                 return a>=0? a%b : (((a%b)+b)%b);
34         }
35
36         static {
37             JarisPaintSequence = new Color[] {
38                     new Color(0.00f, 0.00f, 1.00f),
39                     new Color(0.00f, 0.50f, 0.00f),
40                     new Color(1.00f, 0.00f, 0.00f),
41                     new Color(0.00f, 0.75f, 0.75f),
42                     new Color(0.75f, 0.00f, 0.75f),
43                     new Color(0.40f, 0.40f, 0.00f), // Keltainen
44                     new Color(0.25f, 0.25f, 0.25f),
45                     new Color(0.75f, 0.25f, 0.25f),
46                     new Color(0.75f, 0.75f, 0.00f), // Kirkkaampi keltainen
47                     new Color(0.25f, 0.25f, 0.75f),
48                     new Color(0.58f, 0.58f, 0.58f),
49                     new Color(0.00f, 1.00f, 0.00f),
50                     new Color(0.76f, 0.57f, 0.17f),
51                     new Color(0.54f, 0.63f, 0.22f),
52                     new Color(0.80f, 0.52f, 0.85f),
53                     new Color(0.10f, 0.49f, 0.47f),
54                     new Color(0.66f, 0.34f, 0.65f),
55                     new Color(0.99f, 0.41f, 0.23f)
56             };
57             JarisPaintName = new String[] {
58                     Messages.JarisPaints_0,
59                     Messages.JarisPaints_1,
60                     Messages.JarisPaints_2,
61                     Messages.JarisPaints_3,
62                     Messages.JarisPaints_4,
63                     Messages.JarisPaints_5,
64                     Messages.JarisPaints_6,
65                     Messages.JarisPaints_7,
66                     Messages.JarisPaints_8,
67                     Messages.JarisPaints_9,
68                     Messages.JarisPaints_10,
69                     Messages.JarisPaints_11,
70                     Messages.JarisPaints_12,
71                     Messages.JarisPaints_13,
72                     Messages.JarisPaints_14,
73                     Messages.JarisPaints_15,
74                     Messages.JarisPaints_16,
75                     Messages.JarisPaints_17
76             };  
77             
78         }
79
80 }