Skip to content
Snippets Groups Projects
Commit ac167663 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Intermediate checkin.

refs 2589
parent f0e8bab1
No related branches found
No related tags found
No related merge requests found
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.spiderchart.util;
import java.util.Arrays;
import java.util.List;
/**
* Utility methods for Spider Charts
*
* @author mondal
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 13207B1B51F8F60D2122999D2EDB0603
*/
public final class ChartUtil {
/**
* Returns the array of string represented constants of any Enum
*/
public static <E extends Enum<E>> List<String> enumConstants(final Class<E> value) {
final String[] constants = new String[value.getEnumConstants().length];
int i = 0;
for(final Enum<E> enumVal : value.getEnumConstants()) {
constants[i++] = enumVal.name();
}
return Arrays.asList(constants);
}
/** Returns the primitive double array from wrapper double array */
public static double[] toDoublePrimitiveArray(final Double[] wrappedArray) {
final double[] array = new double[wrappedArray.length];
for(int i = 0; i < wrappedArray.length; i++) {
array[i] = wrappedArray[i].intValue();
}
return array;
}
/**
* Wraps a list of values and converts it to its corresponding double values
*/
public static double[] wrapValues(final Object[] values) {
final double[] wrappedValues = new double[values.length];
int i = 0;
for(final Object value : values) {
if(value instanceof Double || value instanceof Integer) {
wrappedValues[i++] = (double)value;
}
if(value instanceof Long) {
Long l = new Long((long)value);
wrappedValues[i++] = l.doubleValue();
}
if(value instanceof Enum<?>) {
final Enum<?> enumConst = (Enum<?>)value;
wrappedValues[i++] = enumConst.ordinal() + 1;
}
}
return wrappedValues;
}
/**
* Constructor
*/
private ChartUtil() {
}
}
......@@ -386,7 +386,9 @@ public final class SpiderChartWidget extends SpiderChartWidgetBase {
/** Draws the data series. */
private void drawDataSeries(SpiderChartSwtGraphics g, DataSeries data) {
// TODO: implement
for(Axis axis : chart.getAxes()) {
// TODO: continue HERE
}
}
/** Draws the axes of the spider chart. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment